Model Comparison

Structural Equation Modeling with lavaan in R

Erin Buchanan

Professor

Create Two Models

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)
Structural Equation Modeling with lavaan in R

Chi-Square Comparison

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
  • Chi-square difference created by subtracting models
  • Must increase by at least 3.84 to be significant at p < .05
  • Only useful for models with the same variables
Structural Equation Modeling with lavaan in R

Fit Index Comparison

  • Compare fit indices for non-nested models
  • Get more fit indices with fitmeasures()
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
                                _ _ _
Structural Equation Modeling with lavaan in R

Fit Index Comparison

fitmeasures(twofactor.fit, c("aic", "ecvi"))
     aic     ecvi 
5181.168    0.244 
fitmeasures(twofactor.fit1, c("aic", "ecvi"))
     aic     ecvi 
5150.508    0.142 
Structural Equation Modeling with lavaan in R

Let's practice!

Structural Equation Modeling with lavaan in R

Preparing Video For Download...