在R

时间:2018-01-16 23:36:16

标签: r r-lavaan

我使用包裹' lavaan'运行多组CFA模型。在R中发现,当运行严格不变性模型时,两组不是不变的(不相等)。这表明至少在一个项目上,我比较(男孩,女孩)这两个组的范围是不一样的。要找出哪个项目是问题制定者,我要求修改索引。但令我惊讶的是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数据框(包含所有可能的&#34; op&#34;选项时,我也看不到所有行号,似乎它省略了很多路径来自我的模特:

           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

1 个答案:

答案 0 :(得分:0)

找到解决方案:在free.remove = FALSE内添加modindices(),您将获得所有可能的行/修改索引。

相关问题