Note: “focalman” and “focalwoman” indicate the which columns the focal man and focal woman are in.
Demographics
Raw
table(vig_raw1$part_gend)/nrow(vig_raw1); paste0("Mean: ", mean(vig_raw1$Age, na.rm = TRUE)); paste0("SD: ", sd(vig_raw1$Age, na.rm = TRUE))
##
## Female Male
## 0.60 0.38
## [1] "Mean: 36.0883233532934"
## [1] "SD: 10.959909834093"
Clean
Passed Manipulation Check
## manip_check_label
## cond_f 0 1
## dei_nobacklash 26 200
## control 7 213
## dei_backlash 29 192
(mccheck <- as.data.frame(with(vig_raw1, table(cond_f, manip_check_label))) %>%
pivot_wider(names_from = "manip_check_label", values_from = "Freq")%>%
rename("Fail" = 2, "Pass" = 3))
## [1] "Passed: 605"
## Nonsense
## 0 1
## 7 661
table(vig_clean1_wide$part_gend)/nrow(vig_clean1_wide); paste0("Mean: ", mean(vig_clean1_wide$Age, na.rm = TRUE)); paste0("SD: ", sd(vig_clean1_wide$Age, na.rm = TRUE))
##
## Female Male
## 0.60 0.39
## [1] "Mean: 36.2624584717608"
## [1] "SD: 10.9813433952543"
Items
Ranking
vig_measures %>% ungroup() %>% dplyr::summarize(mean = mean(rank, na.rm = TRUE), sd = sd(rank, na.rm = TRUE))
VQ
##
## Pearson's product-moment correlation
##
## data: vq_1 and vq_2
## t = 73, df = 2406, p-value <0.0000000000000002
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.82 0.84
## sample estimates:
## cor
## 0.83
VS
##
## Pearson's product-moment correlation
##
## data: vs_1 and vs_2
## t = 59, df = 2405, p-value <0.0000000000000002
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.75 0.78
## sample estimates:
## cor
## 0.77
Analyses
Ranking
Regression
## Call:
## clm2(location = rank_rf ~ cond_f * gendertarget_f + (1 | person_num) +
## (1 | pid), data = v1clean)
##
## Location coefficients:
## Estimate Std. Error z value Pr(>|z|)
## cond_fcontrol 0.769 0.128 6.008 0.0000000019
## cond_fdei_backlash 0.146 0.130 1.120 0.26255
## gendertarget_fWoman trgt 1.751 0.132 13.249 < 0.0000000000000002
## cond_fcontrol:gendertarget_fWoman trgt -1.500 0.181 -8.287 < 0.0000000000000002
## cond_fdei_backlash:gendertarget_fWoman trgt -0.276 0.183 -1.507 0.13177
##
## No scale coefficients
##
## Threshold coefficients:
## Estimate Std. Error z value
## 1|2 -0.326 0.094 -3.475
## 2|3 0.897 0.096 9.351
## 3|4 2.110 0.103 20.416
##
## log-likelihood: -3175.94
## AIC: 6367.88
## Condition number of Hessian: 125.03
## (8 observations deleted due to missingness)
Full posthoc tests
Estimated marginal means
Graph
Voice Solicitation
Regression
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: vs ~ cond_f * gendertarget_f + (1 | person) + (1 | pid)
## Data: v1clean
##
## REML criterion at convergence: 8717
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.293 -0.505 0.046 0.576 3.065
##
## Random effects:
## Groups Name Variance Std.Dev.
## pid (Intercept) 1.17912 1.0859
## person (Intercept) 0.00315 0.0562
## Residual 1.52931 1.2367
## Number of obs: 2408, groups: pid, 602; person, 4
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.20305 0.10698 31.49055 39.29 < 0.0000000000000002 ***
## cond_fcontrol 0.29226 0.13781 910.09738 2.12 0.034 *
## cond_fdei_backlash 0.00268 0.14139 910.09738 0.02 0.985
## gendertarget_fWoman trgt 0.97843 0.10449 7.34384 9.36 0.00002426 ***
## cond_fcontrol:gendertarget_fWoman trgt -0.61692 0.12224 1801.00128 -5.05 0.00000049 ***
## cond_fdei_backlash:gendertarget_fWoman trgt -0.20499 0.12541 1801.00128 -1.63 0.102
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cnd_fc cnd_f_ gnd_Wt c_:_Wt
## cond_fcntrl -0.669
## cnd_fd_bckl -0.652 0.506
## gndrtrgt_Wt -0.488 0.270 0.263
## cnd_fcn:_Wt 0.297 -0.444 -0.225 -0.608
## cnd_fd_:_Wt 0.289 -0.225 -0.444 -0.592 0.506
Full posthoc tests
Estimated marginal means
Graph
Voice Quality
Regresison
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: vq ~ cond_f * gendertarget_f + (1 | person) + (1 | pid)
## Data: v1clean
##
## REML criterion at convergence: 8281
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.618 -0.526 0.056 0.557 3.105
##
## Random effects:
## Groups Name Variance Std.Dev.
## pid (Intercept) 0.82124 0.9062
## person (Intercept) 0.00251 0.0501
## Residual 1.32805 1.1524
## Number of obs: 2408, groups: pid, 602; person, 4
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.1904 0.0938 27.2672 44.68 < 0.0000000000000002 ***
## cond_fcontrol 0.3190 0.1205 966.8850 2.65 0.0082 **
## cond_fdei_backlash 0.1274 0.1236 966.8850 1.03 0.3031
## gendertarget_fWoman trgt 0.9911 0.0962 7.6908 10.30 0.000009034 ***
## cond_fcontrol:gendertarget_fWoman trgt -0.6437 0.1139 1801.0004 -5.65 0.000000019 ***
## cond_fdei_backlash:gendertarget_fWoman trgt -0.2997 0.1169 1801.0004 -2.56 0.0104 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cnd_fc cnd_f_ gnd_Wt c_:_Wt
## cond_fcntrl -0.667
## cnd_fd_bckl -0.651 0.506
## gndrtrgt_Wt -0.513 0.291 0.284
## cnd_fcn:_Wt 0.316 -0.473 -0.239 -0.615
## cnd_fd_:_Wt 0.308 -0.239 -0.473 -0.600 0.506
Full posthoc tests
Estimated marginal means
Graph
Interest
## Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
## Formula: interest ~ cond_f * gendertarget_f + (1 | person) + (1 | pid)
## Data: v1clean
##
## REML criterion at convergence: 8251
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.764 -0.507 -0.007 0.548 3.389
##
## Random effects:
## Groups Name Variance Std.Dev.
## pid (Intercept) 0.857 0.926
## person (Intercept) 0.000 0.000
## Residual 1.297 1.139
## Number of obs: 2408, groups: pid, 602; person, 4
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 4.1701 0.0874 949.0684 47.70 < 0.0000000000000002 ***
## cond_fcontrol 0.4074 0.1213 949.0684 3.36 0.00081 ***
## cond_fdei_backlash -0.1701 0.1244 949.0684 -1.37 0.17209
## gendertarget_fWoman trgt 1.0914 0.0811 1803.0000 13.45 < 0.0000000000000002 ***
## cond_fcontrol:gendertarget_fWoman trgt -0.8566 0.1126 1803.0000 -7.61 0.000000000000044 ***
## cond_fdei_backlash:gendertarget_fWoman trgt -0.2242 0.1155 1803.0000 -1.94 0.05238 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cnd_fc cnd_f_ gnd_Wt c_:_Wt
## cond_fcntrl -0.721
## cnd_fd_bckl -0.703 0.506
## gndrtrgt_Wt -0.464 0.334 0.326
## cnd_fcn:_Wt 0.334 -0.464 -0.235 -0.721
## cnd_fd_:_Wt 0.326 -0.235 -0.464 -0.703 0.506
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
Full posthoc tests
Estimated marginal means
Graph
Mediation
Ranking DV
DEI - Voice Quality
library(lavaan)
deivq_mediationdat <- data.frame(
X = deidata$gendertarget_num,
M = scale(deidata$vq, scale = F),
Y = scale(deidata$rank_r, scale = F),
pid = deidata$pid
)
med_mod_deivq <-
'
# Direct Effect
Y ~ c*X
# Mediator
M~a*X
Y~b*M
# Indirect effect
ab:= a*b
# Total effect
total:= c+ (a*b)
'
sem_med_deivq <- lavaan::sem(med_mod_deivq, cluster = "pid", data = deivq_mediationdat)
## Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING:
## The variance-covariance matrix of the estimated parameters (vcov)
## does not appear to be positive definite! The smallest eigenvalue
## (= 4.834619e-19) is close to zero. This may be a symptom that the
## model is not identified.
## lavaan 0.6.17 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Used Total
## Number of observations 1548 1556
## Number of clusters [pid] 387
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Y ~
## X (c) 0.733 0.065 11.298 0.000
## M ~
## X (a) 0.848 0.080 10.627 0.000
## Y ~
## M (b) 0.269 0.018 14.953 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Y -0.367 0.037 -9.991 0.000
## .M -0.424 0.069 -6.145 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Y 0.871 0.027 32.573 0.000
## .M 2.046 0.104 19.721 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## ab 0.228 0.024 9.567 0.000
## total 0.961 0.067 14.349 0.000
as.data.frame(lavaan::parameterEstimates(sem_med_deivq, ci = TRUE, level = 0.95)) %>%
filter(lhs == "ab") %>%
dplyr::select(est, ci.lower, ci.upper)
Control- Voice Quality
library(lavaan)
tradvq_mediationdat <- data.frame(
X = deitraddata$gendertarget_num,
M = scale(deitraddata$vq, scale = F),
Y = scale(deitraddata$rank_r, scale = F),
pid = deitraddata$pid
)
med_mod_tradvq <-
'
# Direct Effect
Y ~ c*X
# Mediator
M~a*X
Y~b*M
# Indirect effect
ab:= a*b
# Total effect
total:= c+ (a*b)
'
sem_med_tradvq <- lavaan::sem(med_mod_tradvq, cluster = "pid", data = tradvq_mediationdat)
## Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING:
## The variance-covariance matrix of the estimated parameters (vcov)
## does not appear to be positive definite! The smallest eigenvalue
## (= -1.674842e-18) is smaller than zero. This may be a symptom that
## the model is not identified.
## lavaan 0.6.17 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 852
## Number of clusters [pid] 213
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Y ~
## X (c) 0.042 0.080 0.521 0.603
## M ~
## X (a) 0.347 0.097 3.599 0.000
## Y ~
## M (b) 0.299 0.024 12.257 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Y -0.021 0.046 -0.458 0.647
## .M -0.174 0.096 -1.802 0.072
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Y 1.036 0.028 37.024 0.000
## .M 2.338 0.156 15.020 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## ab 0.104 0.030 3.464 0.001
## total 0.146 0.096 1.519 0.129
as.data.frame(lavaan::parameterEstimates(sem_med_tradvq, ci = TRUE, level = 0.95)) %>%
filter(lhs == "ab") %>%
dplyr::select(est, ci.lower, ci.upper)
DEI - Interest
library(lavaan)
deiinterest_mediationdat <- data.frame(
X = deidata$gendertarget_num,
M = scale(deidata$interest, scale = F),
Y = scale(deidata$rank_r, scale = F),
pid = deidata$pid
)
med_mod_deiinterest <-
'
# Direct Effect
Y ~ c*X
# Mediator
M~a*X
Y~b*M
# Indirect effect
ab:= a*b
# Total effect
total:= c+ (a*b)
'
sem_med_deiinterest <- lavaan::sem(med_mod_deiinterest, cluster = "pid", data = deiinterest_mediationdat)
## Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING:
## The variance-covariance matrix of the estimated parameters (vcov)
## does not appear to be positive definite! The smallest eigenvalue
## (= 2.449642e-19) is close to zero. This may be a symptom that the
## model is not identified.
## lavaan 0.6.17 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Used Total
## Number of observations 1548 1556
## Number of clusters [pid] 387
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Y ~
## X (c) 0.780 0.069 11.365 0.000
## M ~
## X (a) 0.988 0.081 12.267 0.000
## Y ~
## M (b) 0.184 0.016 11.201 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Y -0.390 0.036 -10.880 0.000
## .M -0.495 0.071 -6.926 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Y 0.946 0.030 31.761 0.000
## .M 2.146 0.107 19.980 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## ab 0.182 0.021 8.697 0.000
## total 0.961 0.067 14.349 0.000
as.data.frame(lavaan::parameterEstimates(sem_med_deiinterest, ci = TRUE, level = 0.95)) %>%
filter(lhs == "ab") %>%
dplyr::select(est, ci.lower, ci.upper)
Control - Interest
library(lavaan)
tradinterest_mediationdat <- data.frame(
X = deitraddata$gendertarget_num,
M = scale(deitraddata$interest, scale = F),
Y = scale(deitraddata$rank_r, scale = F),
pid = deitraddata$pid
)
med_mod_tradinterest <-
'
# Direct Effect
Y ~ c*X
# Mediator
M~a*X
Y~b*M
# Indirect effect
ab:= a*b
# Total effect
total:= c+ (a*b)
'
sem_med_tradinterest <- lavaan::sem(med_mod_tradinterest, cluster = "pid", data = tradinterest_mediationdat)
## Warning in lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats, : lavaan WARNING:
## The variance-covariance matrix of the estimated parameters (vcov)
## does not appear to be positive definite! The smallest eigenvalue
## (= -3.237828e-18) is smaller than zero. This may be a symptom that
## the model is not identified.
## lavaan 0.6.17 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 852
## Number of clusters [pid] 213
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 0.000 0.000
## Degrees of freedom 0 0
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Y ~
## X (c) 0.102 0.090 1.131 0.258
## M ~
## X (a) 0.235 0.083 2.816 0.005
## Y ~
## M (b) 0.185 0.022 8.343 0.000
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|)
## .Y -0.051 0.046 -1.108 0.268
## .M -0.117 0.089 -1.312 0.190
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Y 1.170 0.019 63.128 0.000
## .M 2.198 0.156 14.083 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## ab 0.043 0.016 2.712 0.007
## total 0.146 0.096 1.519 0.129
as.data.frame(lavaan::parameterEstimates(sem_med_tradinterest, ci = TRUE, level = 0.95)) %>%
filter(lhs == "ab") %>%
dplyr::select(est, ci.lower, ci.upper)
Parallel Mediation just within the DEI condition
dei_mediationdat2 <- data.frame(
X = deidata$gendertarget_num,
M1 = scale(deidata$vq, scale = F),
M2 = scale(deidata$interest, scale = F),
Y = scale(deidata$rank_r, scale = F),
pid = deidata$pid
)
multipleMediation <- '
Y ~ b1 * M1 + b2 * M2 + c * X
M1 ~ a1 * X
M2 ~ a2 * X
indirect1 := a1 * b1
indirect2 := a2 * b2
total := c + (a1 * b1) + (a2 * b2)
M1 ~~ M2
'
fit <- sem(model = multipleMediation, data = dei_mediationdat2)
summary(fit)
## lavaan 0.6.17 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Used Total
## Number of observations 1548 1556
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Y ~
## M1 (b1) 0.241 0.020 11.844 0.000
## M2 (b2) 0.048 0.020 2.407 0.016
## X (c) 0.710 0.050 14.114 0.000
## M1 ~
## X (a1) 0.848 0.073 11.656 0.000
## M2 ~
## X (a2) 0.988 0.074 13.273 0.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## .M1 ~~
## .M2 1.214 0.062 19.728 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Y 0.868 0.031 27.821 0.000
## .M1 2.046 0.074 27.821 0.000
## .M2 2.146 0.077 27.821 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## indirect1 0.204 0.025 8.308 0.000
## indirect2 0.047 0.020 2.368 0.018
## total 0.961 0.051 18.733 0.000
as.data.frame(parameterestimates(fit)) %>%
dplyr::filter(lhs == "indirect1" | lhs == "indirect2" | lhs == "total") %>%
dplyr::select(label, est, se, ci.lower, ci.upper)
Moderated mediation
modmed <- '
M ~ a1*X + a2*W + a3*X:W
Y ~ cdash1*X + cdash2*W + cdash3*X:W + b1*M
#Mean of centered W (for use in simple slopes)
#This is making a coefficient labeled "W" which equals the intercept because of the "1"
#(Y~1) gives you the intercept, which is the mean for our W variable
W ~ W.mean*1
#Variance of centered W (for use in simple slopes)
#This is making a coefficient labeled "W.var" which equals the variance because of the "~~"
#Two tildes separating the same variable gives you the variance
W ~~ W.var*W
#Indirect effects conditional on moderator (a1 + a3*ModValue)*b1
indirect.SDbelow := (a1 + a3*(W.mean-sqrt(W.var)))*b1
indirect.effect := (a1 + a3*(W.mean))*b1
indirect.SDabove := (a1 + a3*(W.mean+sqrt(W.var)))*b1
#Direct effects conditional on moderator (cdash1 + cdash3*ModValue)
#We have to do it this way because you cannot call the mean and sd functions in lavaan package
direct.SDbelow := cdash1 + cdash3*(W.mean-sqrt(W.var))
direct.SDabove := cdash1 + cdash3*(W.mean+sqrt(W.var))
#Total effects conditional on moderator
total.SDbelow := direct.SDbelow + indirect.SDbelow
total.SDabove := direct.SDabove + indirect.SDabove
#Proportion mediated conditional on moderator
#To match the output of "mediate" package
prop.mediated.SDbelow := indirect.SDbelow / total.SDbelow
prop.mediated.SDabove := indirect.SDabove / total.SDabove
#Index of moderated mediation
#An alternative way of testing if conditional indirect effects are significantly different from each other
index.mod.med := a3*b1
'
VQ as mediator
v1clean <- v1clean %>%
mutate(
gendertarget_num = case_when(
gendertarget == "Man trgt" ~ 0,
gendertarget == "Woman trgt" ~ 1
))
modmed_vq_rank <- data.frame(
X = v1clean$gendertarget_num,
M = scale(v1clean$vq, scale = F),
W = v1clean$cond_num,
Y = scale(v1clean$rank_r, scale = F),
pid = v1clean$pid
)
Mod.Med.SEM_vqrank <- sem(model = modmed,
data = modmed_vq_rank,
bootstrap = 100, cluster = "pid")
summary(Mod.Med.SEM_vqrank,
fit.measures = FALSE,
standardize = TRUE,
rsquare = TRUE)
## lavaan 0.6.17 ended normally after 9 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 13
##
## Used Total
## Number of observations 2400 2408
## Number of clusters [pid] 600
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 1663.553 367729695380.215
## Degrees of freedom 2 2
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.000
## Yuan-Bentler correction (Mplus variant)
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## M ~
## X (a1) 0.677 0.063 10.810 0.000 0.677 0.224
## W (a2) 0.103 0.069 1.491 0.136 0.103 0.056
## X:W (a3) -0.182 0.076 -2.398 0.016 -0.182 -0.070
## Y ~
## X (cds1) 0.493 0.050 9.779 0.000 0.493 0.216
## W (cds2) 0.158 0.033 4.716 0.000 0.158 0.114
## X:W (cds3) -0.322 0.057 -5.625 0.000 -0.322 -0.164
## M (b1) 0.285 0.014 19.662 0.000 0.285 0.378
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.mn) 0.037 0.033 1.095 0.274 0.037 0.045
## .M -0.339 0.056 -6.031 0.000 -0.339 -0.224
## .Y -0.246 0.029 -8.591 0.000 -0.246 -0.216
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.vr) 0.672 0.019 34.921 0.000 0.672 1.000
## .M 2.158 0.087 24.887 0.000 2.158 0.943
## .Y 0.939 0.019 48.366 0.000 0.939 0.724
##
## R-Square:
## Estimate
## M 0.057
## Y 0.276
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## indirect.SDblw 0.233 0.027 8.568 0.000 0.233 0.110
## indirect.effct 0.191 0.019 9.959 0.000 0.191 0.083
## indirect.SDabv 0.148 0.025 5.983 0.000 0.148 0.057
## direct.SDbelow 0.745 0.069 10.780 0.000 0.745 0.373
## direct.SDabove 0.217 0.070 3.078 0.002 0.217 0.045
## total.SDbelow 0.978 0.077 12.709 0.000 0.978 0.483
## total.SDabove 0.365 0.083 4.387 0.000 0.365 0.102
## prp.mdtd.SDblw 0.238 0.026 9.312 0.000 0.238 0.227
## prop.mdtd.SDbv 0.406 0.073 5.575 0.000 0.406 0.560
## index.mod.med -0.052 0.022 -2.405 0.016 -0.052 -0.026
parameterEstimates(Mod.Med.SEM_vqrank,
boot.ci.type = "bca.simple",
level = .95, ci = TRUE,
standardized = FALSE)[19:28, c(1, 3:5, 9:10)] #We index the matrix to only display columns we are interested in
Interest as mediator
modmed_interest_rank <- data.frame(
X = v1clean$gendertarget_num,
M = scale(v1clean$interest, scale = F),
W = v1clean$cond_num,
Y = scale(v1clean$rank_r, scale = F),
pid = v1clean$pid
)
Mod.Med.SEM_interestrank <- sem(model = modmed,
data = modmed_interest_rank,
bootstrap = 100, cluster = "pid")
summary(Mod.Med.SEM_interestrank,
fit.measures = FALSE,
standardize = TRUE,
rsquare = TRUE)
## lavaan 0.6.17 ended normally after 9 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 13
##
## Used Total
## Number of observations 2400 2408
## Number of clusters [pid] 600
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 1663.553 354286774991.401
## Degrees of freedom 2 2
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.000
## Yuan-Bentler correction (Mplus variant)
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## M ~
## X (a1) 0.733 0.061 11.971 0.000 0.733 0.237
## W (a2) 0.293 0.067 4.371 0.000 0.293 0.155
## X:W (a3) -0.331 0.073 -4.545 0.000 -0.331 -0.124
## Y ~
## X (cds1) 0.546 0.054 10.053 0.000 0.546 0.240
## W (cds2) 0.131 0.034 3.907 0.000 0.131 0.094
## X:W (cds3) -0.311 0.064 -4.868 0.000 -0.311 -0.158
## M (b1) 0.190 0.013 14.348 0.000 0.190 0.259
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.mn) 0.037 0.033 1.095 0.274 0.037 0.045
## .M -0.372 0.056 -6.624 0.000 -0.372 -0.240
## .Y -0.272 0.028 -9.608 0.000 -0.272 -0.239
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.vr) 0.672 0.019 34.921 0.000 0.672 1.000
## .M 2.171 0.088 24.625 0.000 2.171 0.906
## .Y 1.035 0.020 51.331 0.000 1.035 0.798
##
## R-Square:
## Estimate
## M 0.094
## Y 0.202
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## indirect.SDblw 0.189 0.021 8.854 0.000 0.189 0.092
## indirect.effct 0.137 0.015 9.407 0.000 0.137 0.060
## indirect.SDabv 0.086 0.016 5.459 0.000 0.086 0.028
## direct.SDbelow 0.790 0.075 10.587 0.000 0.790 0.391
## direct.SDabove 0.280 0.078 3.596 0.000 0.280 0.074
## total.SDbelow 0.978 0.077 12.709 0.000 0.978 0.483
## total.SDabove 0.365 0.083 4.387 0.000 0.365 0.102
## prp.mdtd.SDblw 0.193 0.023 8.299 0.000 0.193 0.190
## prop.mdtd.SDbv 0.234 0.052 4.498 0.000 0.234 0.272
## index.mod.med -0.063 0.014 -4.402 0.000 -0.063 -0.032
parameterEstimates(Mod.Med.SEM_interestrank,
boot.ci.type = "bca.simple",
level = .95, ci = TRUE,
standardized = FALSE)[19:28, c(1, 3:5, 9:10)] #We index the matrix to only display columns we are interested in
Mediation with Voice Solicitation as DV
Parallel Mediation
dei_mediationdat2 <- data.frame(
X = deidata$gendertarget_num,
M1 = scale(deidata$vq, scale = F),
M2 = scale(deidata$interest, scale = F),
Y = scale(deidata$vs, scale = F),
pid = deidata$pid
)
multipleMediation <- '
Y ~ b1 * M1 + b2 * M2 + c * X
M1 ~ a1 * X
M2 ~ a2 * X
indirect1 := a1 * b1
indirect2 := a2 * b2
total := c + (a1 * b1) + (a2 * b2)
M1 ~~ M2
'
fit <- sem(model = multipleMediation, data = dei_mediationdat2)
summary(fit)
## lavaan 0.6.17 ended normally after 14 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Number of observations 1556
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|)
## Y ~
## M1 (b1) 0.678 0.024 28.127 0.000
## M2 (b2) 0.253 0.024 10.742 0.000
## X (c) 0.058 0.060 0.965 0.335
## M1 ~
## X (a1) 0.843 0.072 11.637 0.000
## M2 ~
## X (a2) 0.981 0.074 13.219 0.000
##
## Covariances:
## Estimate Std.Err z-value P(>|z|)
## .M1 ~~
## .M2 1.208 0.061 19.734 0.000
##
## Variances:
## Estimate Std.Err z-value P(>|z|)
## .Y 1.230 0.044 27.893 0.000
## .M1 2.042 0.073 27.893 0.000
## .M2 2.141 0.077 27.893 0.000
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|)
## indirect1 0.572 0.053 10.753 0.000
## indirect2 0.248 0.030 8.336 0.000
## total 0.877 0.084 10.491 0.000
as.data.frame(parameterestimates(fit)) %>%
dplyr::filter(lhs == "indirect1" | lhs == "indirect2" | lhs == "total") %>%
dplyr::select(label, est, se, ci.lower, ci.upper)
Moderated mediation
modmed <- '
M ~ a1*X + a2*W + a3*X:W
Y ~ cdash1*X + cdash2*W + cdash3*X:W + b1*M
#Mean of centered W (for use in simple slopes)
#This is making a coefficient labeled "W" which equals the intercept because of the "1"
#(Y~1) gives you the intercept, which is the mean for our W variable
W ~ W.mean*1
#Variance of centered W (for use in simple slopes)
#This is making a coefficient labeled "W.var" which equals the variance because of the "~~"
#Two tildes separating the same variable gives you the variance
W ~~ W.var*W
#Indirect effects conditional on moderator (a1 + a3*ModValue)*b1
indirect.SDbelow := (a1 + a3*(W.mean-sqrt(W.var)))*b1
indirect.effect := (a1 + a3*(W.mean))*b1
indirect.SDabove := (a1 + a3*(W.mean+sqrt(W.var)))*b1
#Direct effects conditional on moderator (cdash1 + cdash3*ModValue)
#We have to do it this way because you cannot call the mean and sd functions in lavaan package
direct.SDbelow := cdash1 + cdash3*(W.mean-sqrt(W.var))
direct.SDabove := cdash1 + cdash3*(W.mean+sqrt(W.var))
#Total effects conditional on moderator
total.SDbelow := direct.SDbelow + indirect.SDbelow
total.SDabove := direct.SDabove + indirect.SDabove
#Proportion mediated conditional on moderator
#To match the output of "mediate" package
prop.mediated.SDbelow := indirect.SDbelow / total.SDbelow
prop.mediated.SDabove := indirect.SDabove / total.SDabove
#Index of moderated mediation
#An alternative way of testing if conditional indirect effects are significantly different from each other
index.mod.med := a3*b1
'
VQ as mediator
modmed_vq_vs <- data.frame(
X = v1clean$gendertarget_num,
M = scale(v1clean$vq, scale = F),
W = v1clean$cond_num,
Y = scale(v1clean$vs, scale = F),
pid = v1clean$pid
)
Mod.Med.SEM_vsrank <- sem(model = modmed,
data = modmed_vq_vs,
bootstrap = 100, cluster = "pid")
summary(Mod.Med.SEM_vsrank,
fit.measures = FALSE,
standardize = TRUE,
rsquare = TRUE)
## lavaan 0.6.17 ended normally after 9 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 13
##
## Number of observations 2408
## Number of clusters [pid] 602
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 1669.098 392987625742.857
## Degrees of freedom 2 2
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.000
## Yuan-Bentler correction (Mplus variant)
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## M ~
## X (a1) 0.674 0.062 10.804 0.000 0.674 0.223
## W (a2) 0.100 0.069 1.447 0.148 0.100 0.054
## X:W (a3) -0.180 0.076 -2.384 0.017 -0.180 -0.069
## Y ~
## X (cds1) 0.151 0.042 3.609 0.000 0.151 0.045
## W (cds2) 0.066 0.053 1.234 0.217 0.066 0.032
## X:W (cds3) -0.066 0.046 -1.421 0.155 -0.066 -0.023
## M (b1) 0.817 0.022 36.901 0.000 0.817 0.730
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.mn) 0.035 0.033 1.044 0.297 0.035 0.043
## .M -0.337 0.056 -6.017 0.000 -0.337 -0.223
## .Y -0.077 0.043 -1.772 0.076 -0.077 -0.045
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.vr) 0.672 0.019 34.954 0.000 0.672 1.000
## .M 2.155 0.086 24.932 0.000 2.155 0.944
## .Y 1.271 0.073 17.492 0.000 1.271 0.444
##
## R-Square:
## Estimate
## M 0.056
## Y 0.556
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## indirect.SDblw 0.666 0.078 8.532 0.000 0.666 0.211
## indirect.effct 0.546 0.054 10.131 0.000 0.546 0.161
## indirect.SDabv 0.425 0.070 6.102 0.000 0.425 0.110
## direct.SDbelow 0.203 0.058 3.489 0.000 0.203 0.066
## direct.SDabove 0.095 0.055 1.737 0.082 0.095 0.021
## total.SDbelow 0.869 0.102 8.498 0.000 0.869 0.277
## total.SDabove 0.520 0.088 5.893 0.000 0.520 0.131
## prp.mdtd.SDblw 0.767 0.053 14.387 0.000 0.767 0.761
## prop.mdtd.SDbv 0.817 0.090 9.124 0.000 0.817 0.839
## index.mod.med -0.147 0.062 -2.376 0.018 -0.147 -0.050
parameterEstimates(Mod.Med.SEM_vsrank,
boot.ci.type = "bca.simple",
level = .95, ci = TRUE,
standardized = FALSE)[c(19:28),c(4:10)] #We index the matrix to only display columns we are interested in
Interest as mediator
modmed_interest_vs <- data.frame(
X = v1clean$gendertarget_num,
M = scale(v1clean$interest, scale = F),
W = v1clean$cond_num,
Y = scale(v1clean$vs, scale = F),
pid = v1clean$pid
)
Mod.Med.SEM_interestvs <- sem(model = modmed,
data = modmed_interest_vs,
bootstrap = 100, cluster = "pid")
summary(Mod.Med.SEM_interestvs,
fit.measures = FALSE,
standardize = TRUE,
rsquare = TRUE)
## lavaan 0.6.17 ended normally after 9 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 13
##
## Number of observations 2408
## Number of clusters [pid] 602
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 1669.098 327375084528.047
## Degrees of freedom 2 2
## P-value (Chi-square) 0.000 0.000
## Scaling correction factor 0.000
## Yuan-Bentler correction (Mplus variant)
##
## Parameter Estimates:
##
## Standard errors Robust.cluster
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## M ~
## X (a1) 0.728 0.061 11.917 0.000 0.728 0.236
## W (a2) 0.291 0.067 4.339 0.000 0.291 0.154
## X:W (a3) -0.325 0.073 -4.476 0.000 -0.325 -0.122
## Y ~
## X (cds1) 0.257 0.056 4.577 0.000 0.257 0.076
## W (cds2) -0.030 0.069 -0.443 0.658 -0.030 -0.015
## X:W (cds3) -0.014 0.065 -0.218 0.828 -0.014 -0.005
## M (b1) 0.611 0.029 20.802 0.000 0.611 0.558
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.mn) 0.035 0.033 1.044 0.297 0.035 0.043
## .M -0.369 0.056 -6.588 0.000 -0.369 -0.238
## .Y -0.127 0.054 -2.373 0.018 -0.127 -0.075
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## W (W.vr) 0.672 0.019 34.954 0.000 0.672 1.000
## .M 2.168 0.088 24.651 0.000 2.168 0.908
## .Y 1.901 0.093 20.494 0.000 1.901 0.664
##
## R-Square:
## Estimate
## M 0.092
## Y 0.336
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## indirect.SDblw 0.601 0.065 9.264 0.000 0.601 0.197
## indirect.effct 0.438 0.044 9.984 0.000 0.438 0.129
## indirect.SDabv 0.275 0.049 5.602 0.000 0.275 0.060
## direct.SDbelow 0.268 0.082 3.277 0.001 0.268 0.081
## direct.SDabove 0.245 0.072 3.422 0.001 0.245 0.071
## total.SDbelow 0.869 0.102 8.498 0.000 0.869 0.277
## total.SDabove 0.520 0.088 5.893 0.000 0.520 0.131
## prp.mdtd.SDblw 0.692 0.070 9.886 0.000 0.692 0.709
## prop.mdtd.SDbv 0.529 0.084 6.298 0.000 0.529 0.460
## index.mod.med -0.199 0.045 -4.381 0.000 -0.199 -0.068
parameterEstimates(Mod.Med.SEM_interestvs,
boot.ci.type = "bca.simple",
level = .95, ci = TRUE,
standardized = FALSE)[c(19:28),c(4:10)] #We index the matrix to only display columns we are interested in