The lavaan tutorial on multiple groups has a good introduction to multiple groups, but doesn’t clearly specify one confusing aspect - estimating direct and indirect effects in multiple groups.
Specifically, say you have the following simple mediation model:
'm ~ a*x
y ~ b*m + c*x
# indirect effect
ab := a*b
# total effect
abc := ab + c'
The indirect effect is a*b
and the total effect is ab
+ c
. Running this with the group
argument to
sem()
will in the best case return an error; though in some
cases I see it run while producing identical estimates between groups.
Instead, you need to specify different parameters per model:
'm ~ c(a1, a2)*x
y ~ c(b1, b2)*m + c(c1, c2)*x
# group 1
ab1 := a1*b1
abc1 := ab1 + c1
# group 2
ab2 := a2*b2
abc2 := ab2 + c2'
Home |
Back to blog
This work is licensed under
CC BY-NC 4.0