我在 R 中使用包“lavaan”运行了多组 CFA 模型,发现在运行严格不变模型时,两组不是不变的(不相等)。这表明至少在一个项目上,我正在比较的两组(男孩、女孩)的范围不同。为了找出哪个项目是问题制造者,我要求修改索引。但令我惊讶的是,该modindices()
函数没有显示任何差异,因为在创建的数据框中没有任何类似x1 ~~ x1
的东西modindices()
。它确实给出了协方差的修改指数,例如x1 ~~ x2
. 有人知道我做错了什么(我使用了最新版本的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 == "~~")
当我打印出(完整的)modindices 数据框(带有所有可能的“op”选项时,我也没有看到所有行号,它似乎省略了我模型中的很多路径:
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