我想按性别测试度量等效性,但出现错误。
我有以下相关矩阵:
(如何在控制台中获得一个输出,为我提供一个与 sds 的可重现的协方差/相关矩阵)?
> cor(sub1, use="pairwise.complete.obs")
V24 V25 V52 V53 V54 V37
V24 1.000000000 0.697521674 0.01568641 0.018252279 0.007213654 0.04335144
V25 0.697521674 1.000000000 -0.01564264 0.004665397 -0.015039173 0.04004168
V52 0.015686412 -0.015642643 1.00000000 0.546989009 0.340628957 -0.05174745
V53 0.018252279 0.004665397 0.54698901 1.000000000 0.438693604 -0.07044378
V54 0.007213654 -0.015039173 0.34062896 0.438693604 1.000000000 -0.08113154
V37 0.043351436 0.040041675 -0.05174745 -0.070443778 -0.081131539 1.00000000
V38 0.098512813 0.066579287 -0.05594164 -0.091231815 -0.024566416 0.37069002
V39 0.001098530 0.026309212 -0.06166382 -0.059972262 -0.076980805 0.43970024
V40 0.049227113 0.043209425 -0.04630234 -0.061524717 -0.011688956 0.23091762
SEX -0.041446974 -0.015998972 0.07623627 0.026067738 0.043030238 -0.03215834
V38 V39 V40 SEX
V24 0.09851281 0.00109853 0.04922711 -0.04144697
V25 0.06657929 0.02630921 0.04320942 -0.01599897
V52 -0.05594164 -0.06166382 -0.04630234 0.07623627
V53 -0.09123182 -0.05997226 -0.06152472 0.02606774
V54 -0.02456642 -0.07698080 -0.01168896 0.04303024
V37 0.37069002 0.43970024 0.23091762 -0.03215834
V38 1.00000000 0.17530099 0.48481632 0.13427571
V39 0.17530099 1.00000000 0.23179996 0.01046066
V40 0.48481632 0.23179996 1.00000000 0.24838303
SEX 0.13427571 0.01046066 0.24838303 1.00000000
model3.2 <- 'union =~ V24 + V25
loyality =~ V52 + V53 + V54
experience =~ V37 + V38 + V39 + V40
union ~ loyality + experience
experience ~~ loyality
V37 ~~ V39
V37 ~~ V38
experience ~ SEX
loyality ~ SEX'
现在我想评估一下男性和女性对工会的看法是否存在差异。
我既尝试了测量不变性的命令,也尝试了手动操作。
在这两种情况下,我都会收到一个错误:
> measurementInvariance(model3.2, data = sub1, group = "SEX")
Error in lav_model_estimate(lavmodel = lavmodel, lavsamplestats = lavsamplestats, :
lavaan ERROR: initial model-implied matrix (Sigma) is not positive definite;
check your model and/or starting parameters in group 1.
In addition: Warning messages:
1: In lav_samplestats_icov(COV = cov[[g]], ridge = ridge, x.idx = x.idx[[g]], :
lavaan WARNING sample covariance matrix in group: 1 is not positive-definite
2: In lav_samplestats_icov(COV = cov[[g]], ridge = ridge, x.idx = x.idx[[g]], :
lavaan WARNING sample covariance matrix in group: 2 is not positive-definite
> fit3.2b <- cfa(fit3.2 , data=sub1, group="SEX")
Error in Sigma.hat[[g]] : subscript out of bounds
In addition: Warning messages:
1: In lav_samplestats_icov(COV = cov[[g]], ridge = ridge, x.idx = x.idx[[g]], :
lavaan WARNING sample covariance matrix in group: 1 is not positive-definite
2: In lav_samplestats_icov(COV = cov[[g]], ridge = ridge, x.idx = x.idx[[g]], :
lavaan WARNING sample covariance matrix in group: 2 is not positive-definite
我读过这是由于我的误差协方差引起的负协方差。但是尽管删除了错误协方差V37 ~~ V
,但V37 ~~ V38
我得到了同样的错误。
问题:
如何评估测量不变性?