可以使用lavaan(SEM / CFA)进行因子分析,如factanal(EFA)

机器算法验证 r 因子分析 结构方程建模 熔岩
2022-03-22 01:30:33

我知道这lavaan是为了做 SEM/CFA 而 R 函数factanal做 EFA。EFA 和 CFA 看起来非常相似,所以我想知道为什么我似乎无法指定在我看来与lavaan我可以适应的相同模型的情况factanal

我是否误解了 CFA 和 EFA 之间的统计关系,或者我只是误用了lavaan语法?

例如,使用经典的 Holzinger-Swineford 数据,我们可以在前 6 个观测值中寻找两个因子。 lavaan抛出这个错误,

> library(lavaan)
> model <- 'f1 =~ x1 + x2 + x3 + x4 + x5 + x6
+           f2 =~ x1 + x2 + x3 + x4 + x5 + x6
+ '
> fit  <- cfa(model, data = HolzingerSwineford1939)
Warning message:
In lav_model_vcov(lavmodel = lavmodel, lavsamplestats = lavsamplestats,  :
  lavaan WARNING: could not compute standard errors!
  lavaan NOTE: this may be a symptom that the model is not identified.

factanal没关系:

> 
> factanal(~x1+x2+x3+x4+x5+x6, factors = 2, data = HolzingerSwineford1939)

Call:
factanal(x = ~x1 + x2 + x3 + x4 + x5 + x6, factors = 2, data = HolzingerSwineford1939)

Uniquenesses:
   x1    x2    x3    x4    x5    x6 
0.574 0.787 0.441 0.284 0.232 0.304 

Loadings:
   Factor1 Factor2
x1 0.293   0.584  
x2 0.106   0.449  
x3         0.747  
x4 0.824   0.191  
x5 0.873          
x6 0.802   0.231  

               Factor1 Factor2
SS loadings      2.183   1.196
Proportion Var   0.364   0.199
Cumulative Var   0.364   0.563

Test of the hypothesis that 2 factors are sufficient.
The chi square statistic is 2.07 on 4 degrees of freedom.
The p-value is 0.722 

我如何指定一个像factanal在做的模型lavaan

1个回答

可以在 CFA 框架中进行 EFA。这有时被称为“E/CFA”。可以在以下位置找到一个很好的讨论:

布朗,TA(2006 年)。应用研究的验证性因素分析纽约:吉尔福德出版社。

为此,您需要为每个因素都有一个“锚项目”,没有交叉加载。查看 的结果,将item 设置为第一个因素的锚项和第二个因素的锚项是factanal有意义的。您还需要将潜在因子的方差限制为 1。由于标准化变量,您需要在此处执行相同操作。同时,为了使事情更具可比性,我会使用 EFA 的倾斜旋转方法(因为 E/CFA 模型将允许相关因素)。因此,将所有这些放在一起,您可以进行比较:x5x3factanal

model <- 'f1 =~ x1 + x2 + 0*x3 + x4 + x5 + x6
          f2 =~ x1 + x2 + x3 + x4 + 0*x5 + x6'

fit  <- cfa(model, data=HolzingerSwineford1939, std.lv=T, std.ov=T)
summary(fit)

factanal(~x1+x2+x3+x4+x5+x6, factors=2, data=HolzingerSwineford1939, rotation="promax")

结果如下:

lavaan (0.5-18) converged normally after  26 iterations

  Number of observations                           301

  Estimator                                         ML
  Minimum Function Test Statistic                2.109
  Degrees of freedom                                 4
  P-value (Chi-square)                           0.716

Parameter estimates:

  Information                                 Expected
  Standard Errors                             Standard

                   Estimate  Std.err  Z-value  P(>|z|)
Latent variables:
  f1 =~
    x1                0.275    0.061    4.499    0.000
    x2                0.092    0.063    1.469    0.142
    x3                0.000
    x4                0.822    0.050   16.550    0.000
    x5                0.875    0.049   17.964    0.000
    x6                0.798    0.050   16.013    0.000
  f2 =~
    x1                0.559    0.074    7.520    0.000
    x2                0.441    0.071    6.183    0.000
    x3                0.746    0.086    8.644    0.000
    x4                0.120    0.052    2.321    0.020
    x5                0.000
    x6                0.161    0.052    3.085    0.002

Covariances:
  f1 ~~
    f2                0.119    0.088    1.348    0.178

Variances:
    x1                0.572    0.072
    x2                0.784    0.074
    x3                0.440    0.112
    x4                0.283    0.035
    x5                0.231    0.037
    x6                0.303    0.035
    f1                1.000
    f2                1.000

> 
> factanal(~x1+x2+x3+x4+x5 + x6, factors = 2, data = HolzingerSwineford1939, rotation="promax")

Call:
factanal(x = ~x1 + x2 + x3 + x4 + x5 + x6, factors = 2, data = HolzingerSwineford1939,     rotation = "promax")

Uniquenesses:
   x1    x2    x3    x4    x5    x6 
0.574 0.787 0.441 0.284 0.232 0.304 

Loadings:
   Factor1 Factor2
x1  0.180   0.557 
x2          0.457 
x3 -0.147   0.797 
x4  0.842         
x5  0.922  -0.126 
x6  0.809         

               Factor1 Factor2
SS loadings      2.268   1.173
Proportion Var   0.378   0.196
Cumulative Var   0.378   0.574

Factor Correlations:
        Factor1 Factor2
Factor1   1.000   0.417
Factor2   0.417   1.000

Test of the hypothesis that 2 factors are sufficient.
The chi square statistic is 2.07 on 4 degrees of freedom.
The p-value is 0.722

根据 Brown (2006) 的说法,两种方法的卡方统计量应该相同。对于书中显示的示例,情况确实如此(但作者使用 Mplus 进行 EFA 和 E/CFA 分析)。在此特定示例中,这些值很接近(2.109 和 2.07),但并不相同。lavaan这里的工作方式和工作方式似乎存在一些细微差别factanal,但最终的重点是,确实可以使用 CFA 软件进行探索性因素分析。