Dear all,
I am still new to Lavaan and mediation analysis.
I am running a simple mediation analysis with four variables:
1) outcome which is binary. Coded (0/1) as factor in R
2) predictor which is continuous (ranges from a negative value to a positive value)
3) mediator which is continuous (ranges from a positive value to a positive value)
4) covariate which is binary. Coded (1/2) as factor in R
My model is specified as following:
model <- '# direct effect
outcome ~ c*predictor + covariate
# mediator
mediator ~ a*predictor + covariate
outcome ~ b*mediator
# indirect effect (a*b)
ab := a*b
# total effect
total := c + (a*b)'
model_fit <- sem(model, data = analyses_dataset,
ordered = c("outcome")) #lavaan results
after running summary(model_fit) I get the following result:
Regressions:
Estimate Std.Err z-value P(>|z|)
outcome ~
predictor (c) 0.000 2363.387 0.000 1.000
covariate 0.657 0.075 8.740 0.000
mediator ~
predictor (a) 0.000 3508.628 0.000 1.000
covariate 0.447 0.099 4.498 0.000
outcome ~
mediator (b) 0.067 0.009 7.165 0.000
Intercepts:
Estimate Std.Err z-value P(>|z|)
.outcome 0.000
.mediator 21.942 0.235 93.382 0.000
Thresholds:
Estimate Std.Err z-value P(>|z|)
outcome|t1 3.570 0.264 13.510 0.000
Variances:
Estimate Std.Err z-value P(>|z|)
.outcome 0.958
.mediator 9.540 0.187 51.027 0.000
Scales y*:
Estimate Std.Err z-value P(>|z|)
outcome 1.000
Defined Parameters:
Estimate Std.Err z-value P(>|z|)
ab 0.000 233.903 0.000 1.000
total 0.000 2370.228 0.000 1.000
According to this there is no mediation effect but I find these results suspicious (especially the estimate of AB = 0) even more so if I run the model again but now with bootstrapping:
model_bootstrap_fit <- sem(model, data = analyses_dataset,
ordered = c("outcome"), se = "bootstrap", bootstrap = 100, estimator = "DWLS")
Regressions:
Estimate Std.Err z-value P(>|z|)
outcome ~
predictor (c) 0.000 0.000 8.182 0.000
covariate 0.657 0.077 8.559 0.000
mediator ~
predictor (a) 0.000 0.000 15.298 0.000
covariate 0.447 0.109 4.099 0.000
outcome ~
mediator (b) 0.067 0.008 8.201 0.000
Intercepts:
Estimate Std.Err z-value P(>|z|)
.outcome 0.000
.mediator 21.942 0.223 98.454 0.000
Thresholds:
Estimate Std.Err z-value P(>|z|)
outcome|t1 3.570 0.244 14.653 0.000
Variances:
Estimate Std.Err z-value P(>|z|)
.outcome 0.958
.mediator 9.540 0.304 31.363 0.000
Scales y*:
Estimate Std.Err z-value P(>|z|)
outcome 1.000
Defined Parameters:
Estimate Std.Err z-value P(>|z|)
ab 0.000 0.000 4.846 0.000
total 0.000 0.000 9.048 0.000
Suddenly the results is now significant...I don't understand what is happening exactly. Perhaps someone can shed light on this.
Kind regards,
Andy