In lavaan
in R
, when using the sem()
function, the covariance values are automatically populated. However, I want to force one of the covariance values to be zero while using the sem()
function, i.e. without moving to the manual lavaan()
function.
How can that be done?
See http://lavaan.ugent.be/tutorial/syntax2.html
I'm just copying from there, the following code is self-explanatory
# three-factor model
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ NA*x7 + x8 + x9
# orthogonal factors
visual ~~ 0*speed
textual ~~ 0*speed
# fix variance of speed factor
speed ~~ 1*speed
Note that the fist loadings on each latent factor are, by default, fixed to 1 - if you want to estimate them, you would use something like NA*x7 as above. And fixing a covariance to zero is done with something like visual ~~ 0*speed
-- if you don't include this line, the covariances between latent variables are automatically included in the model.
The lavaan homepage is a very good source on lavaan.