Chapter 10 Lavaan Lab 7: Two-factor SR Model

10.1 Data Prep

Again, we use cfaInClassData.csv in this lab

Let’s read this dataset in:

cfaData<- read.csv("cfaInclassData.csv", header = T)

Load up the lavaan library:

library(lavaan)

10.2 PART I: Two-Factor SR, Fixed Loading

10.2.1 Fixed Loading, AKA Marker Variable method.

Let’s write up the model syntax for the structural regression (SR) model with two factors:

srSyntax <- "
    #Factor Specification   
    posAffect =~ glad + cheerful + happy  
    satisfaction =~ satisfied + content + comfortable 
    
    #Structural Regression!
    satisfaction ~ posAffect
"

Here we named the fitted object ‘srRun’ to see our output:

srRun = lavaan::sem(model = srSyntax, 
                    data = cfaData, 
                    fixed.x=FALSE)

Get a summary using summary() function, add standardized=T to request standardized parameter estimates:

summary(srRun, standardized = T)
## lavaan 0.6-12 ended normally after 22 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        13
## 
##   Number of observations                          1000
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 2.957
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.937
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   posAffect =~                                                          
##     glad              1.000                               0.694    0.706
##     cheerful          1.112    0.057   19.458    0.000    0.772    0.785
##     happy             1.067    0.055   19.294    0.000    0.740    0.758
##   satisfaction =~                                                       
##     satisfied         1.000                               0.773    0.767
##     content           1.068    0.052   20.525    0.000    0.826    0.762
##     comfortable       0.918    0.045   20.336    0.000    0.709    0.746
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   satisfaction ~                                                        
##     posAffect         0.544    0.047   11.490    0.000    0.488    0.488
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .glad              0.484    0.029   16.647    0.000    0.484    0.501
##    .cheerful          0.371    0.029   13.004    0.000    0.371    0.384
##    .happy             0.405    0.028   14.389    0.000    0.405    0.425
##    .satisfied         0.419    0.029   14.326    0.000    0.419    0.412
##    .content           0.491    0.034   14.542    0.000    0.491    0.419
##    .comfortable       0.400    0.026   15.315    0.000    0.400    0.443
##     posAffect         0.482    0.042   11.439    0.000    1.000    1.000
##    .satisfaction      0.455    0.038   11.869    0.000    0.762    0.762

The above syntax reproduces the SR analysis from the class slides.

  • CFA part under “Latent Variables” remains unchanged
  • “Covariances” section no longer exists
  • satisfaction is also removed under “Variances”

Instead, in the Regressions section:

Regressions:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
  satisfaction ~                                                        
    posAffect         0.544    0.047   11.490    0.000    0.488    0.488

returns the regression slope of posAffect (b = 0.544). One-unit change in posAffect is leading to one-unit change in satisfaction.

Variances:
                   Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
   .satisfaction      0.455    0.038   11.869    0.000    0.762    0.762

returns the disturbance variance of satisfaction (sigma_(d_2)^2, not psi_2!)

10.3 PART II: Two-Factor SR, Fixed Factor Variance

10.3.1 Fixed Factor Method

Here we named the fitted object ‘srRun2’.

We add std.lv=T to fix all latent factor variances to 1:

srRun2 = lavaan::sem(model = srSyntax, 
            data = cfaData, 
            fixed.x=FALSE,
            std.lv=T)
summary(srRun2, standardized = T)
## lavaan 0.6-12 ended normally after 17 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        13
## 
##   Number of observations                          1000
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 2.957
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.937
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   posAffect =~                                                          
##     glad              0.694    0.030   22.878    0.000    0.694    0.706
##     cheerful          0.772    0.030   25.798    0.000    0.772    0.785
##     happy             0.740    0.030   24.806    0.000    0.740    0.758
##   satisfaction =~                                                       
##     satisfied         0.675    0.028   23.737    0.000    0.773    0.767
##     content           0.721    0.031   23.611    0.000    0.826    0.762
##     comfortable       0.619    0.027   23.124    0.000    0.709    0.746
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   satisfaction ~                                                        
##     posAffect         0.559    0.049   11.501    0.000    0.488    0.488
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .glad              0.484    0.029   16.647    0.000    0.484    0.501
##    .cheerful          0.371    0.029   13.004    0.000    0.371    0.384
##    .happy             0.405    0.028   14.389    0.000    0.405    0.425
##    .satisfied         0.419    0.029   14.326    0.000    0.419    0.412
##    .content           0.491    0.034   14.542    0.000    0.491    0.419
##    .comfortable       0.400    0.026   15.315    0.000    0.400    0.443
##     posAffect         1.000                               1.000    1.000
##    .satisfaction      1.000                               0.762    0.762

This doesn’t work as expected, why?

Therefore, for SR models, we should always go with fixed loading scaling approach.

10.4 PART III: Exercise (what fun!): 3-Factor SR Model

Suppose that in a 3-factor SR model:

  • Positive Affect is measured by Happy and Cheerful
  • Satisfaction is measured by Satisfied and Content
  • Pleasure is measured by Glad and Comfortable
  • Satisfaction is predicted by both Positive Affect and Pleasure

Can you use cfaData to fit such a model?