Specifying Mediation in SimSem using the Lavaan Syntax

24 views
Skip to first unread message

Kyle Hickerson

unread,
Nov 16, 2025, 4:25:44 AM (5 days ago) Nov 16
to lavaan
Hello,

I have been working on a large ri-clpm simsem simulation involving indirect effects. Everything runs fine, and the power, bias and coverage estimates existed before adding the indirect effects component. When I added the estimates of the indirect effects, no power, bias or coverage results are exported. I am assuming I am notating it incorrectly in the population model, but is there any way to get those estimates for the indirect effects? I have included an online example that mimics the issue below. Apologies in advance if I have missed something obvious in this process. I know it is possible to conduct mediation in SimSem using the matrix style but I would prefer if at all possible to get those estimates using my existing lavaan syntax. 

- Kyle

simModel <- "

M ~ 0.5*X
Y ~ 0.5*M + 0.5*X

X ~~ 1*X
M ~~ 0.5*M
Y ~~ 0.5*Y
"

fitModel <- "

M ~ a*X
Y ~ b*M + X

M ~~ M
Y ~~ Y

i := a* b
"

simOutput_1 <- sim(
  nRep = 100,
  model = fitModel,
  n = 50, generate = simModel,
  lavaanfun = "lavaan",
  se = "standard"
)
summary(simOutput_1)
Reply all
Reply to author
Forward
0 new messages