Hello all.
I am running a multigroup Local SAM and would like to compare a constrained vs. free structural model to see if the two countries differ:
model <- '
# Measurement model
X1 =~ X1_1 + X1_2 + X1_3
X2 =~ X2_1 + X2_2 + X2_3
M1 =~ M1_1 + M1_2 + M1_3
M2 =~ M2_1 + M2_2 + M2_3
Y1 =~ Y1_1 + Y1_2 + Y1_3
Y2 =~ Y2_1 + Y2_2 + Y2_3
# Structural model (equal across the 2 region groups)
Y1 ~ c(a1, a1)*M1 + M2 + c(c1, c1)*X1 + X2 +age+gender
Y2 ~ M1 + c(a2, a2)*M2 + X1 + c(c2, c2)*X2 +
age+gender
M1 ~ c(b1,b1)*X1 + X2 +
age+gender
M2 ~ X1 + c(b2,b2)*X2 +
age+gender
X1 ~
age+gender
X2 ~
age+gender
# Covariances
X1 ~~ X2
M1 ~~ M2
Y1 ~~ Y2
# Indirect effects
ind1 := a1*b1
ind2 := a2*b2
# Total effects
t1:=c1 + a1*b1
t2 := c2 + a2*b2
'
I fit this:
sam<-sam(model, data = data, cmd = "sem",
missing="fiml", mm.args=list(estimator="MLR"),
struc.args=list(estimator="ML"),
se="twostep", group="country",
meanstructure=TRUE,
std.lv = T,
sam.method = "local", fixed.x=F, output="lavaan")
However, this produces:
Error in information + crossprod(H) : non-conformable arraysThe same setup works when I free the paths across groups (e.g. a1_1, a1_2) or use sam.method ="global".
I also used group.equal = "loadings" but there are no fit indices to compare the free vs constrained models.
Or LSAM (or to a certain extent GSAM) is not supposed to be run like traditional multigroup SEM?
Thanks so much for your help.