模型比較

在 R 中使用 lavaan 的結構方程模型

Erin Buchanan

Professor

建立兩個模型

twofactor.model <- 'visual =~ x1 + x2 + x3 
                        speed =~ x7 + x8 + x9'
twofactor.model1 <- 'visual =~ x1 + x2 + x3 
                        speed =~ x7 + x8 + x9
                        x7 ~~ x8'
twofactor.fit <- cfa(model = twofactor.model,
                     data = HolzingerSwineford1939)
twofactor.fit1 <- cfa(model = twofactor.model1,
                     data = HolzingerSwineford1939)
在 R 中使用 lavaan 的結構方程模型

卡方比較

anova(twofactor.fit, twofactor.fit1)
Chi Square Difference Test

               Df    AIC    BIC  Chisq Chisq diff Df diff    Pr(>Chisq)    
twofactor.fit1  7 5150.5 5202.4 14.753                                     
twofactor.fit   8 5181.2 5229.4 47.413     32.661       1 0.00000001097 ***

Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 . 0.1 ' ' 1
  • 以相減得到的卡方差(模型 {{2}})
  • 若要在 p < .05 顯著,需至少增加 3.84({{3}})
  • 僅適用於變數相同的模型({{4}})
在 R 中使用 lavaan 的結構方程模型

配適指標比較

  • 比較非巢式模型的配適指標({{1}})
  • fitmeasures() 取得更多配適指標({{2}})
fitmeasures(twofactor.fit)
                aic                 bic              ntotal 
           5181.168            5229.361             301.000 
               bic2               rmsea      rmsea.ci.lower 
           5188.132               0.128               0.094 
     rmsea.ci.upper        rmsea.pvalue                 rmr 
              0.164               0.000               0.096
                                _ _ _
在 R 中使用 lavaan 的結構方程模型

配適指標比較

fitmeasures(twofactor.fit, c("aic", "ecvi"))
     aic     ecvi 
5181.168    0.244 
fitmeasures(twofactor.fit1, c("aic", "ecvi"))
     aic     ecvi 
5150.508    0.142 
在 R 中使用 lavaan 的結構方程模型

一起來練習吧!

在 R 中使用 lavaan 的結構方程模型

Preparing Video For Download...