Load packages and data

library(qualtRics)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.4     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(psych)      # for reliability
## 
## Attaching package: 'psych'
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
library(broom)      # for tidy model outputs

df <- read_survey("~/Google drive/My Drive/YEAR 3/PROJECTS/DANIEL/Belonging/belonging_pilot1.csv")
## 
## ── Column specification ────────────────────────────────────────────────────────
## cols(
##   .default = col_double(),
##   StartDate = col_character(),
##   EndDate = col_character(),
##   IPAddress = col_character(),
##   RecordedDate = col_character(),
##   ResponseId = col_character(),
##   RecipientLastName = col_logical(),
##   RecipientFirstName = col_logical(),
##   RecipientEmail = col_logical(),
##   ExternalReference = col_logical(),
##   DistributionChannel = col_character(),
##   UserLanguage = col_character(),
##   open_1 = col_character(),
##   open_2 = col_character(),
##   industry = col_character(),
##   attn_bots = col_character(),
##   gender_4_TEXT = col_logical(),
##   race = col_number(),
##   race_8_TEXT = col_logical(),
##   race_9_TEXT = col_logical(),
##   ses_7_TEXT = col_logical()
##   # ... with 12 more columns
## )
## ℹ Use `spec()` for the full column specifications.
df_clean <- df %>%
  filter(attn == 24)

Demographic overview

Sample

table(df_clean$gender)
## 
##  1  2  3 
## 54 44  1
table(df_clean$race)
## 
##  1  2  3  4  5 15 25 
## 72 13  7  1  2  3  1
table(df_clean$ses)
## 
##  1  2  3  4  5  6 
##  1 10 47 17 23  1
table(df_clean$income_now)
## 
##  1  2  3  4  5  6  7 
##  2  2 24 29 18 16  8
table(df_clean$employment)
## 
##  1  3 
## 98  1
mean(df_clean$age, na.rm = T)
## [1] 41.21212

Team info

table(df_clean$team_info)
## 
##  1  2 
## 95  4

1 = current team 2 = past team

Current

mean(df_clean$team_size_current, na.rm = T)
## [1] 8.568421

Former

mean(df_clean$team_size_former, na.rm = T)
## [1] 12.75

Clean data

Reverse coding

# Detect reverse-coded items (ending in R)
df_clean <- df_clean %>%
  mutate(across(ends_with("R"),
                ~ 8 - .,   # change 8 to (max+1)
                .names = "{.col}_recoded"))
df_clean <- df_clean %>%
  mutate(across(ends_with("R"),
                ~ 8 - .))   # overwrite directly (simpler)

Create composites

df_scales <- df_clean %>%
  mutate(
    idea_attachment = rowMeans(select(., starts_with("attach_")), na.rm = TRUE),
    interactional_justice = rowMeans(select(., starts_with("colquitt_")), na.rm = TRUE),
    personal_treatment = rowMeans(select(., starts_with("treat_")), na.rm = TRUE),
    idea_inclusion = rowMeans(select(., starts_with("idea_")), na.rm = TRUE),
    belonging = rowMeans(select(., starts_with("belong_")), na.rm = TRUE)
  )

Check reliability

psych::alpha(df_scales %>% select(starts_with("attach_")))
## Warning in cor.smooth(r): Matrix was not positive definite, smoothing was done
## In factor.stats, I could not find the RMSEA upper bound . Sorry about that
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## 
## Reliability analysis   
## Call: psych::alpha(x = df_scales %>% select(starts_with("attach_")))
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean sd median_r
##       0.93      0.93    0.89      0.47  13 0.011  3.6  1     0.45
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.90  0.93  0.95
## Duhachek  0.91  0.93  0.95
## 
##  Reliability if an item is dropped:
##                    raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r
## attach_1                0.93      0.93    0.88      0.48  13    0.011 0.035
## attach_2                0.93      0.93    0.88      0.49  13    0.011 0.032
## attach_3                0.92      0.92    0.88      0.46  12    0.012 0.039
## attach_4                0.93      0.93    0.88      0.48  13    0.011 0.035
## attach_5                0.93      0.93    0.88      0.48  13    0.011 0.039
## attach_6R               0.92      0.92    0.89      0.46  12    0.012 0.034
## attach_7R               0.92      0.92    0.89      0.46  12    0.012 0.036
## attach_8R               0.92      0.92    0.89      0.46  12    0.012 0.034
## attach_9R               0.92      0.92    0.89      0.47  12    0.011 0.033
## attach_10R              0.92      0.92    0.89      0.45  12    0.012 0.034
## attach_6R_recoded       0.92      0.92    0.89      0.46  12    0.012 0.034
## attach_7R_recoded       0.92      0.92    0.89      0.46  12    0.012 0.036
## attach_8R_recoded       0.92      0.92    0.89      0.46  12    0.012 0.034
## attach_9R_recoded       0.92      0.92    0.89      0.47  12    0.011 0.033
## attach_10R_recoded      0.92      0.92    0.89      0.45  12    0.012 0.034
##                    med.r
## attach_1            0.49
## attach_2            0.49
## attach_3            0.45
## attach_4            0.49
## attach_5            0.51
## attach_6R           0.45
## attach_7R           0.46
## attach_8R           0.45
## attach_9R           0.45
## attach_10R          0.44
## attach_6R_recoded   0.45
## attach_7R_recoded   0.46
## attach_8R_recoded   0.45
## attach_9R_recoded   0.45
## attach_10R_recoded  0.44
## 
##  Item statistics 
##                     n raw.r std.r r.cor r.drop mean  sd
## attach_1           99  0.56  0.55  0.53   0.49  4.9 1.5
## attach_2           99  0.52  0.50  0.47   0.44  4.9 1.5
## attach_3           99  0.77  0.76  0.76   0.72  4.2 1.8
## attach_4           99  0.58  0.56  0.55   0.51  4.8 1.4
## attach_5           99  0.62  0.62  0.60   0.55  4.0 1.5
## attach_6R          99  0.80  0.80  0.75   0.76  3.2 1.4
## attach_7R          99  0.78  0.76  0.71   0.73  3.7 1.5
## attach_8R          99  0.72  0.75  0.69   0.68  2.7 1.2
## attach_9R          99  0.67  0.69  0.63   0.62  2.5 1.2
## attach_10R         99  0.81  0.82  0.77   0.78  3.2 1.4
## attach_6R_recoded  99  0.80  0.80  0.75   0.76  3.2 1.4
## attach_7R_recoded  99  0.78  0.76  0.71   0.73  3.7 1.5
## attach_8R_recoded  99  0.72  0.75  0.69   0.68  2.7 1.2
## attach_9R_recoded  99  0.67  0.69  0.63   0.62  2.5 1.2
## attach_10R_recoded 99  0.81  0.82  0.77   0.78  3.2 1.4
## 
## Non missing response frequency for each item
##                       1    2    3    4    5    6    7 miss
## attach_1           0.03 0.04 0.12 0.07 0.36 0.26 0.11    0
## attach_2           0.03 0.04 0.14 0.09 0.33 0.24 0.12    0
## attach_3           0.09 0.14 0.15 0.05 0.31 0.20 0.05    0
## attach_4           0.03 0.03 0.12 0.12 0.39 0.20 0.10    0
## attach_5           0.09 0.07 0.17 0.21 0.31 0.12 0.02    0
## attach_6R          0.10 0.25 0.27 0.14 0.18 0.04 0.01    0
## attach_7R          0.07 0.19 0.21 0.15 0.25 0.10 0.02    0
## attach_8R          0.18 0.23 0.39 0.12 0.06 0.01 0.00    0
## attach_9R          0.22 0.36 0.20 0.12 0.08 0.01 0.00    0
## attach_10R         0.16 0.12 0.34 0.20 0.12 0.04 0.01    0
## attach_6R_recoded  0.10 0.25 0.27 0.14 0.18 0.04 0.01    0
## attach_7R_recoded  0.07 0.19 0.21 0.15 0.25 0.10 0.02    0
## attach_8R_recoded  0.18 0.23 0.39 0.12 0.06 0.01 0.00    0
## attach_9R_recoded  0.22 0.36 0.20 0.12 0.08 0.01 0.00    0
## attach_10R_recoded 0.16 0.12 0.34 0.20 0.12 0.04 0.01    0
psych::alpha(df_scales %>% select(starts_with("colquitt_")))
## 
## Reliability analysis   
## Call: psych::alpha(x = df_scales %>% select(starts_with("colquitt_")))
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.85      0.87    0.85      0.62 6.6 0.025  5.9 0.81     0.62
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt      0.8  0.85  0.89
## Duhachek   0.8  0.85  0.90
## 
##  Reliability if an item is dropped:
##            raw_alpha std.alpha G6(smc) average_r S/N alpha se   var.r med.r
## colquitt_1      0.79      0.81    0.78      0.59 4.3    0.038 0.02883  0.51
## colquitt_2      0.78      0.81    0.76      0.58 4.2    0.038 0.01765  0.51
## colquitt_3      0.78      0.80    0.75      0.57 4.0    0.039 0.01974  0.50
## colquitt_4      0.90      0.90    0.86      0.75 9.0    0.017 0.00093  0.74
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean   sd
## colquitt_1 99  0.86  0.88  0.83   0.76  5.9 0.90
## colquitt_2 99  0.87  0.88  0.85   0.76  5.9 0.92
## colquitt_3 99  0.88  0.90  0.87   0.79  5.9 0.86
## colquitt_4 99  0.77  0.73  0.57   0.54  5.7 1.19
## 
## Non missing response frequency for each item
##               1    2    3    4    5    6    7 miss
## colquitt_1 0.00 0.00 0.02 0.07 0.10 0.58 0.23    0
## colquitt_2 0.00 0.00 0.03 0.04 0.18 0.51 0.24    0
## colquitt_3 0.00 0.00 0.01 0.06 0.16 0.53 0.24    0
## colquitt_4 0.01 0.01 0.03 0.07 0.21 0.38 0.28    0
psych::alpha(df_scales %>% select(starts_with("treat_")))
## 
## Reliability analysis   
## Call: psych::alpha(x = df_scales %>% select(starts_with("treat_")))
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.88      0.89    0.89      0.53 7.8 0.018  5.6 0.81     0.54
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.84  0.88  0.91
## Duhachek  0.84  0.88  0.92
## 
##  Reliability if an item is dropped:
##         raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## treat_1      0.89      0.89    0.88      0.57 8.0    0.017 0.0062  0.60
## treat_2      0.85      0.86    0.86      0.51 6.2    0.023 0.0125  0.51
## treat_3      0.85      0.86    0.86      0.51 6.3    0.023 0.0132  0.51
## treat_4      0.86      0.87    0.86      0.52 6.6    0.022 0.0135  0.51
## treat_5      0.86      0.86    0.86      0.51 6.2    0.022 0.0112  0.49
## treat_6      0.87      0.87    0.87      0.54 6.9    0.021 0.0134  0.55
## treat_7      0.87      0.88    0.87      0.55 7.2    0.020 0.0094  0.58
## 
##  Item statistics 
##          n raw.r std.r r.cor r.drop mean   sd
## treat_1 99  0.69  0.66  0.57   0.54  5.1 1.31
## treat_2 99  0.83  0.83  0.80   0.75  5.7 1.11
## treat_3 99  0.83  0.82  0.79   0.75  5.4 1.20
## treat_4 99  0.79  0.79  0.75   0.71  5.7 1.03
## treat_5 99  0.81  0.83  0.81   0.75  6.1 0.89
## treat_6 99  0.73  0.75  0.70   0.65  5.9 0.89
## treat_7 99  0.70  0.72  0.66   0.60  5.7 0.95
## 
## Non missing response frequency for each item
##            2    3    4    5    6    7 miss
## treat_1 0.04 0.08 0.20 0.25 0.29 0.13    0
## treat_2 0.01 0.04 0.07 0.23 0.39 0.25    0
## treat_3 0.00 0.08 0.14 0.26 0.31 0.20    0
## treat_4 0.00 0.05 0.07 0.22 0.46 0.19    0
## treat_5 0.00 0.02 0.03 0.15 0.46 0.33    0
## treat_6 0.00 0.01 0.06 0.22 0.46 0.24    0
## treat_7 0.00 0.02 0.08 0.27 0.42 0.20    0
psych::alpha(df_scales %>% select(starts_with("idea_")))
## Number of categories should be increased  in order to count frequencies.
## Warning in cor.smooth(r): Matrix was not positive definite, smoothing was done
## Warning in psych::alpha(df_scales %>% select(starts_with("idea_"))): Some items were negatively correlated with the first principal component and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( idea_attachment ) were negatively correlated with the first principal component and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## 
## Reliability analysis   
## Call: psych::alpha(x = df_scales %>% select(starts_with("idea_")))
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.87      0.88    0.88      0.41 7.7 0.019  5.3 0.76     0.48
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.83  0.87  0.91
## Duhachek  0.84  0.87  0.91
## 
##  Reliability if an item is dropped:
##                 raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r med.r
## idea_1               0.85      0.87    0.95      0.39  6.5    0.022 0.089  0.45
## idea_2               0.86      0.87    0.94      0.41  6.8    0.021 0.091  0.48
## idea_3               0.85      0.87    0.95      0.39  6.5    0.021 0.090  0.45
## idea_4               0.85      0.87    0.95      0.39  6.4    0.022 0.089  0.45
## idea_5               0.86      0.88    0.95      0.41  7.0    0.020 0.088  0.45
## idea_6               0.85      0.87    0.94      0.39  6.4    0.022 0.090  0.45
## idea_7               0.86      0.88    0.94      0.41  7.0    0.020 0.096  0.50
## idea_8R              0.87      0.88    0.88      0.42  7.3    0.019 0.087  0.51
## idea_8R_recoded      0.87      0.88    0.88      0.42  7.3    0.019 0.087  0.51
## idea_attachment      0.90      0.91    0.89      0.52 10.7    0.016 0.040  0.58
## idea_inclusion       0.84      0.85    0.86      0.36  5.6    0.023 0.076  0.37
## 
##  Item statistics 
##                  n raw.r std.r r.cor r.drop mean   sd
## idea_1          99 0.776 0.792  0.79  0.716  5.5 1.08
## idea_2          99 0.691 0.712  0.69  0.608  5.3 1.14
## idea_3          99 0.763 0.788  0.79  0.704  5.5 1.02
## idea_4          99 0.781 0.804  0.80  0.729  5.5 0.96
## idea_5          99 0.633 0.677  0.66  0.557  5.5 0.95
## idea_6          99 0.779 0.801  0.80  0.714  5.6 1.17
## idea_7          99 0.649 0.673  0.64  0.567  5.5 1.04
## idea_8R         99 0.682 0.611  0.51  0.561  5.1 1.55
## idea_8R_recoded 99 0.682 0.611  0.51  0.561  5.1 1.55
## idea_attachment 99 0.037 0.042 -0.09 -0.082  3.6 1.00
## idea_inclusion  99 0.993 0.988  0.91  0.991  5.4 0.84
psych::alpha(df_scales %>% select(starts_with("belong_")))
## Warning in cor.smooth(r): Matrix was not positive definite, smoothing was done
## In factor.stats, I could not find the RMSEA upper bound . Sorry about that
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## In smc, smcs < 0 were set to .0
## 
## Reliability analysis   
## Call: psych::alpha(x = df_scales %>% select(starts_with("belong_")))
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.97      0.97    0.92      0.72  30 0.0049  5.5 1.2     0.71
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.95  0.97  0.97
## Duhachek  0.96  0.97  0.98
## 
##  Reliability if an item is dropped:
##                   raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r
## belong_1               0.96      0.97    0.90      0.72  29   0.0051 0.0093
## belong_2R              0.96      0.96    0.92      0.71  28   0.0054 0.0086
## belong_3               0.96      0.97    0.90      0.72  28   0.0053 0.0105
## belong_4R              0.96      0.97    0.92      0.72  28   0.0053 0.0086
## belong_5               0.96      0.97    0.90      0.72  28   0.0053 0.0095
## belong_6R              0.96      0.96    0.92      0.71  27   0.0056 0.0092
## belong_7               0.96      0.97    0.90      0.72  29   0.0052 0.0096
## belong_8R              0.96      0.96    0.92      0.71  27   0.0055 0.0092
## belong_2R_recoded      0.96      0.96    0.92      0.71  28   0.0054 0.0086
## belong_4R_recoded      0.96      0.97    0.92      0.72  28   0.0053 0.0086
## belong_6R_recoded      0.96      0.96    0.92      0.71  27   0.0056 0.0092
## belong_8R_recoded      0.96      0.96    0.92      0.71  27   0.0055 0.0092
##                   med.r
## belong_1           0.72
## belong_2R          0.71
## belong_3           0.72
## belong_4R          0.71
## belong_5           0.71
## belong_6R          0.71
## belong_7           0.72
## belong_8R          0.71
## belong_2R_recoded  0.71
## belong_4R_recoded  0.71
## belong_6R_recoded  0.71
## belong_8R_recoded  0.71
## 
##  Item statistics 
##                    n raw.r std.r r.cor r.drop mean   sd
## belong_1          99  0.81  0.82  0.83   0.77  5.3 1.28
## belong_2R         99  0.87  0.86  0.80   0.84  5.5 1.54
## belong_3          99  0.82  0.84  0.85   0.80  5.7 0.95
## belong_4R         99  0.85  0.85  0.79   0.82  5.8 1.10
## belong_5          99  0.83  0.84  0.85   0.80  5.4 1.27
## belong_6R         99  0.90  0.90  0.84   0.88  5.5 1.44
## belong_7          99  0.82  0.83  0.84   0.78  5.4 1.25
## belong_8R         99  0.89  0.88  0.82   0.86  5.2 1.64
## belong_2R_recoded 99  0.87  0.86  0.80   0.84  5.5 1.54
## belong_4R_recoded 99  0.85  0.85  0.79   0.82  5.8 1.10
## belong_6R_recoded 99  0.90  0.90  0.84   0.88  5.5 1.44
## belong_8R_recoded 99  0.89  0.88  0.82   0.86  5.2 1.64
## 
## Non missing response frequency for each item
##                      1    2    3    4    5    6    7 miss
## belong_1          0.00 0.03 0.09 0.08 0.29 0.33 0.17    0
## belong_2R         0.02 0.03 0.10 0.07 0.13 0.35 0.29    0
## belong_3          0.00 0.00 0.03 0.07 0.27 0.45 0.17    0
## belong_4R         0.00 0.02 0.02 0.07 0.20 0.42 0.26    0
## belong_5          0.01 0.01 0.09 0.08 0.27 0.36 0.17    0
## belong_6R         0.00 0.05 0.10 0.04 0.18 0.37 0.25    0
## belong_7          0.01 0.01 0.08 0.08 0.25 0.39 0.17    0
## belong_8R         0.02 0.05 0.15 0.07 0.17 0.30 0.23    0
## belong_2R_recoded 0.02 0.03 0.10 0.07 0.13 0.35 0.29    0
## belong_4R_recoded 0.00 0.02 0.02 0.07 0.20 0.42 0.26    0
## belong_6R_recoded 0.00 0.05 0.10 0.04 0.18 0.37 0.25    0
## belong_8R_recoded 0.02 0.05 0.15 0.07 0.17 0.30 0.23    0

All alphas are above 0.80. Looks good to me!

Summary stats

df_scales %>%
  summarise(
    across(c(idea_attachment,
             interactional_justice,
             personal_treatment,
             idea_inclusion,
             belonging),
           list(mean = ~mean(.x, na.rm = TRUE),
                sd   = ~sd(.x, na.rm = TRUE)))
  )
## # A tibble: 1 × 10
##   idea_attachment_mean idea_attachment_sd interactional_justice_mean
##                  <dbl>              <dbl>                      <dbl>
## 1                 3.56               1.00                       5.87
## # ℹ 7 more variables: interactional_justice_sd <dbl>,
## #   personal_treatment_mean <dbl>, personal_treatment_sd <dbl>,
## #   idea_inclusion_mean <dbl>, idea_inclusion_sd <dbl>, belonging_mean <dbl>,
## #   belonging_sd <dbl>

Correl matrix

df_scales %>%
  select(idea_attachment,
         interactional_justice,
         personal_treatment,
         idea_inclusion,
         belonging) %>%
  cor(use = "pairwise.complete.obs")
##                       idea_attachment interactional_justice personal_treatment
## idea_attachment            1.00000000            -0.2118755         -0.1284202
## interactional_justice     -0.21187545             1.0000000          0.7377405
## personal_treatment        -0.12842018             0.7377405          1.0000000
## idea_inclusion            -0.08241071             0.6494951          0.6936621
## belonging                 -0.13297661             0.6984000          0.7271349
##                       idea_inclusion  belonging
## idea_attachment          -0.08241071 -0.1329766
## interactional_justice     0.64949507  0.6984000
## personal_treatment        0.69366208  0.7271349
## idea_inclusion            1.00000000  0.6917183
## belonging                 0.69171825  1.0000000

Belonging is really highly correlated with personal treatment (scenarios and colquitt) and idea inclusion scenarios.

Testing conceptual model

Path 1: Personal treatment → Belonging

model1 <- lm(belonging ~ interactional_justice + personal_treatment,
             data = df_scales)

summary(model1)
## 
## Call:
## lm(formula = belonging ~ interactional_justice + personal_treatment, 
##     data = df_scales)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.4557 -0.2195  0.1010  0.4217  1.4919 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            -1.2952     0.5878  -2.203  0.02996 *  
## interactional_justice   0.5097     0.1395   3.655  0.00042 ***
## personal_treatment      0.6679     0.1397   4.781 6.28e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7571 on 96 degrees of freedom
## Multiple R-squared:  0.5863, Adjusted R-squared:  0.5777 
## F-statistic: 68.02 on 2 and 96 DF,  p-value: < 2.2e-16
library(ggplot2)

ggplot(df_scales, aes(x = personal_treatment, y = belonging)) +
  geom_point(alpha = .6) +
  geom_smooth(method = "lm", se = TRUE) +
  labs(
    x = "Personal Treatment",
    y = "Belonging",
    title = "Path 1: Personal Treatment → Belonging"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(df_scales, aes(x = interactional_justice, y = belonging)) +
  geom_point(alpha = .6) +
  geom_smooth(method = "lm", se = TRUE) +
  labs(
    x = "Interactional Justice",
    y = "Belonging",
    title = "Interactional Justice → Belonging"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

Path 2: Felt idea inclusion → Belonging

model2 <- lm(belonging ~ idea_inclusion,
             data = df_scales)

summary(model2)
## 
## Call:
## lm(formula = belonging ~ idea_inclusion, data = df_scales)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9429 -0.3238  0.1165  0.4857  2.0332 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      0.2412     0.5606   0.430    0.668    
## idea_inclusion   0.9642     0.1022   9.434 2.24e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.8457 on 97 degrees of freedom
## Multiple R-squared:  0.4785, Adjusted R-squared:  0.4731 
## F-statistic: 88.99 on 1 and 97 DF,  p-value: 2.242e-15
ggplot(df_scales, aes(x = idea_inclusion, y = belonging)) +
  geom_point(alpha = .6) +
  geom_smooth(method = "lm", se = TRUE) +
  labs(
    x = "Felt Idea Inclusion",
    y = "Belonging",
    title = "Path 2: Idea Inclusion → Belonging"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

Idea attachemnt to belonging

ggplot(df_scales, aes(x = idea_attachment, y = belonging)) +
  geom_point(alpha = .6) +
  geom_smooth(method = "lm", se = TRUE) +
  labs(
    x = "Idea Attachment (Importance)",
    y = "Belonging",
    title = "Extra: Idea Attachment → Belonging"
  ) +
  theme_minimal()
## `geom_smooth()` using formula = 'y ~ x'

Path 3: Both paths (idea importance and personal treatment) → Belonging

model_full <- lm(belonging ~ interactional_justice +
                               personal_treatment +
                               idea_inclusion,
                 data = df_scales)

summary(model_full)
## 
## Call:
## lm(formula = belonging ~ interactional_justice + personal_treatment + 
##     idea_inclusion, data = df_scales)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.59991 -0.17846  0.08155  0.43943  1.21427 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)   
## (Intercept)            -1.6416     0.5719  -2.870  0.00505 **
## interactional_justice   0.3840     0.1389   2.764  0.00686 **
## personal_treatment      0.4718     0.1469   3.212  0.00180 **
## idea_inclusion          0.4042     0.1265   3.194  0.00190 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7233 on 95 degrees of freedom
## Multiple R-squared:  0.6264, Adjusted R-squared:  0.6146 
## F-statistic:  53.1 on 3 and 95 DF,  p-value: < 2.2e-16

Mediation model

library(lavaan)
## This is lavaan 0.6-18
## lavaan is FREE software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
med_model <- '
  # mediator
  idea_attachment ~ a*idea_inclusion

  # outcome
  belonging ~ b*idea_attachment + c_prime*idea_inclusion

  # indirect effect
  indirect := a*b

  # total effect
  total := c_prime + indirect
'

fit_med <- sem(
  med_model,
  data = df_scales,
  se = "bootstrap",
  bootstrap = 1000,
  missing = "fiml"
)

summary(fit_med, standardized = TRUE, fit.measures = TRUE)
## lavaan 0.6-18 ended normally after 1 iteration
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                         7
## 
##   Number of observations                            99
##   Number of missing patterns                         1
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Model Test Baseline Model:
## 
##   Test statistic                                66.233
##   Degrees of freedom                                 3
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000
##   Tucker-Lewis Index (TLI)                       1.000
##                                                       
##   Robust Comparative Fit Index (CFI)             1.000
##   Robust Tucker-Lewis Index (TLI)                1.000
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)               -261.931
##   Loglikelihood unrestricted model (H1)       -261.931
##                                                       
##   Akaike (AIC)                                 537.863
##   Bayesian (BIC)                               556.028
##   Sample-size adjusted Bayesian (SABIC)        533.922
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000
##   90 Percent confidence interval - lower         0.000
##   90 Percent confidence interval - upper         0.000
##   P-value H_0: RMSEA <= 0.050                       NA
##   P-value H_0: RMSEA >= 0.080                       NA
##                                                       
##   Robust RMSEA                                   0.000
##   90 Percent confidence interval - lower         0.000
##   90 Percent confidence interval - upper         0.000
##   P-value H_0: Robust RMSEA <= 0.050                NA
##   P-value H_0: Robust RMSEA >= 0.080                NA
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                            Bootstrap
##   Number of requested bootstrap draws             1000
##   Number of successful bootstrap draws            1000
## 
## Regressions:
##                     Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   idea_attachment ~                                                      
##     id_ncls    (a)    -0.099    0.134   -0.735    0.462   -0.099   -0.082
##   belonging ~                                                            
##     id_ttch    (b)    -0.089    0.112   -0.794    0.427   -0.089   -0.076
##     id_ncls (c_pr)     0.955    0.080   11.955    0.000    0.955    0.685
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .idea_attachmnt    4.091    0.697    5.865    0.000    4.091    4.112
##    .belonging         0.606    0.725    0.835    0.404    0.606    0.523
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .idea_attachmnt    0.983    0.155    6.352    0.000    0.983    0.993
##    .belonging         0.693    0.143    4.858    0.000    0.693    0.516
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     indirect          0.009    0.023    0.383    0.702    0.009    0.006
##     total             0.964    0.079   12.277    0.000    0.964    0.692
parameterEstimates(fit_med, standardized = TRUE, ci = TRUE)
##                lhs op              rhs    label    est    se      z pvalue
## 1  idea_attachment  ~   idea_inclusion        a -0.099 0.134 -0.735  0.462
## 2        belonging  ~  idea_attachment        b -0.089 0.112 -0.794  0.427
## 3        belonging  ~   idea_inclusion  c_prime  0.955 0.080 11.955  0.000
## 4  idea_attachment ~~  idea_attachment           0.983 0.155  6.352  0.000
## 5        belonging ~~        belonging           0.693 0.143  4.858  0.000
## 6   idea_inclusion ~~   idea_inclusion           0.692 0.000     NA     NA
## 7  idea_attachment ~1                            4.091 0.697  5.865  0.000
## 8        belonging ~1                            0.606 0.725  0.835  0.404
## 9   idea_inclusion ~1                            5.422 0.000     NA     NA
## 10        indirect :=              a*b indirect  0.009 0.023  0.383  0.702
## 11           total := c_prime+indirect    total  0.964 0.079 12.277  0.000
##    ci.lower ci.upper std.lv std.all std.nox
## 1    -0.343    0.163 -0.099  -0.082  -0.099
## 2    -0.302    0.157 -0.089  -0.076  -0.076
## 3     0.811    1.130  0.955   0.685   0.824
## 4     0.671    1.266  0.983   0.993   0.993
## 5     0.427    0.972  0.693   0.516   0.516
## 6     0.692    0.692  0.692   1.000   0.692
## 7     2.754    5.367  4.091   4.112   4.112
## 8    -0.901    1.942  0.606   0.523   0.523
## 9     5.422    5.422  5.422   6.520   5.422
## 10   -0.032    0.061  0.009   0.006   0.008
## 11    0.809    1.129  0.964   0.692   0.832

A mediation analysis using bootstrapping revealed that idea attachment did not mediate the relationship between idea inclusion and belonging (indirect effect = 0.009, p = .691).

Instead, idea inclusion exerted a strong direct effect on belonging (β = .69, p < .001), suggesting that belonging is driven primarily by whether individuals feel their ideas are included, rather than by their attachment to those ideas.