Search code examples
rr-lavaansem

How to not allow error terms to correlate in SEM with lavaan


I am currently working on running a structural equation modelling analysis with a dataset and I am running into a few problems. Before running the full sem, I intended to run a CFA to replicate the psychometric testing done with this measure I am using. This measure has 24 items, which make up 5 subscales (latent variables), which in turn load onto an "total" higher order factor. In the literature they describe that "In all models, the items were constrained to load on one factor only, error terms were not allowed to correlate, and the variance of the factors was fixed to 1".

I've constraint items to load onto one factor, and set the variance of those factors to 1, but I am having trouble specifying in my model that the error terms are not allowed to correlate. Do they mean the error term of the items are not allowed to correlate? Is there an easy way to do this in lavaan or do I have to literally go "y1~~ 0y2","y1~~0y3".. and so on for every item?

Thank you in advance for the help.


Solution

  • By default the error terms do not correlate, the authors intended to mention that they did not use that kind of modification indices. It is usual to correlate items' residuals inside the same factor. Here is an example of a hierarchical model with three first-order factors, with factors variance fixed to one, and with no error terms correlated:

    library(lavaan)
    #> This is lavaan 0.6-7
    #> lavaan is BETA software! Please report any bugs.
    #> 
    HS.model3 <- ' visual  =~ x1 + x2 + x3
                   textual =~ x4 + x5 + x6
                   speed   =~ x7 + x8 + x9
                         higher =~ visual + textual + speed'
    
    fit6 <- cfa(HS.model3, data = HolzingerSwineford1939, std.lv=T)
    summary(fit6)
    #> lavaan 0.6-7 ended normally after 36 iterations
    #> 
    #>   Estimator                                         ML
    #>   Optimization method                           NLMINB
    #>   Number of free parameters                         21
    #>                                                       
    #>   Number of observations                           301
    #>                                                       
    #> Model Test User Model:
    #>                                                       
    #>   Test statistic                                85.306
    #>   Degrees of freedom                                24
    #>   P-value (Chi-square)                           0.000
    #> 
    #> Parameter Estimates:
    #> 
    #>   Standard errors                             Standard
    #>   Information                                 Expected
    #>   Information saturated (h1) model          Structured
    #> 
    #> Latent Variables:
    #>                    Estimate  Std.Err  z-value  P(>|z|)
    #>   visual =~                                           
    #>     x1                0.439    0.194    2.257    0.024
    #>     x2                0.243    0.108    2.253    0.024
    #>     x3                0.320    0.138    2.326    0.020
    #>   textual =~                                          
    #>     x4                0.842    0.064   13.251    0.000
    #>     x5                0.937    0.071   13.293    0.000
    #>     x6                0.780    0.060   13.084    0.000
    #>   speed =~                                            
    #>     x7                0.522    0.066    7.908    0.000
    #>     x8                0.616    0.067    9.129    0.000
    #>     x9                0.564    0.064    8.808    0.000
    #>   higher =~                                           
    #>     visual            1.791    0.990    1.809    0.070
    #>     textual           0.617    0.129    4.798    0.000
    #>     speed             0.640    0.143    4.489    0.000
    #> 
    #> Variances:
    #>                    Estimate  Std.Err  z-value  P(>|z|)
    #>    .x1                0.549    0.114    4.833    0.000
    #>    .x2                1.134    0.102   11.146    0.000
    #>    .x3                0.844    0.091    9.317    0.000
    #>    .x4                0.371    0.048    7.779    0.000
    #>    .x5                0.446    0.058    7.642    0.000
    #>    .x6                0.356    0.043    8.277    0.000
    #>    .x7                0.799    0.081    9.823    0.000
    #>    .x8                0.488    0.074    6.573    0.000
    #>    .x9                0.566    0.071    8.003    0.000
    #>    .visual            1.000                           #fixed...
    #>    .textual           1.000                           #fixed...
    #>    .speed             1.000                           #fixed...
    #>     higher            1.000
    

    Created on 2021-03-08 by the reprex package (v0.3.0)

    As you can observe, no correlations, first-order and second-order factor with fixed variances to 1 (i.e. std.lv=T).