I've run a Multigroup CFA model with the package 'lavaan' in R and found that when running the strict invariance model the two groups were not invariant (not equal). This suggest that at least on one item the range is not the same for the two groups i'm comparing (boy, girl). To find out which item is the problem maker i asked for the modification indices. but to my surprise the modindices()
function didn't show any variances since there wasn't anything like x1 ~~ x1
in the dataframe modindices()
created. It did give the modification indices for the covariances like x1 ~~ x2
. Anyone any idea what i'm doing wrong (i used the latest version of lavaan)?
overall_model <- '
emotie =~ e1 + e2 + e4 + e14 + e17 + e22 + e25
sociaal_1 =~ s1.5 + s1.16 + s1.24
sociaal_2 =~ s2.3 + s2.8 + s2.12 + s2.20
thuis =~ t6 + t7 + t15 + t18 + t19
lichaam =~ l9 + l10 + l11 + l13 + l21 + l23
'
strict_fit <- cfa(model = overall_model,
data = df,
meanstructure = TRUE,
group = "gender",
group.equal = c("loadings", "intercepts", "residuals"))
subset(modindices(strict_fit), op == "~~")
When i print out the (complete) modindices dataframe (with all possible "op" options, i also don't see all row numbers, it seems that it omits a lot of the paths from my model:
lhs op rhs block mi epc sepc.lv sepc.all
1 emotie =~ e1 1 0.216 -0.070 -0.864 -0.042
8 sociaal_1 =~ s1.5 1 0.435 0.144 1.842 0.081
11 sociaal_2 =~ s2.3 1 0.004 0.016 0.143 0.007
15 thuis =~ t6 1 2.372 0.224 2.558 0.141
20 lichaam =~ l9 1 2.091 0.316 3.572 0.136
96 emotie =~ e1 2 0.297 0.083 1.348 0.058
103 sociaal_1 =~ s1.5 2 0.388 -0.136 -2.070 -0.086
106 sociaal_2 =~ s2.3 2 0.005 -0.019 -0.167 -0.009
110 thuis =~ t6 2 2.526 -0.231 -4.060 -0.180
115 lichaam =~ l9 2 2.295 -0.331 -5.842 -0.197