3

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?

John Conde
  • 217,595
  • 99
  • 455
  • 496
Maher Said
  • 170
  • 2
  • 15
  • I think this question should be migrated to [Cross Validated](http://stats.stackexchange.com/) – Jaap Apr 13 '14 at 13:30
  • Have a look at pg9/10 of Lavaan: an R package for structural equation modeling and more Version 0.3-1 [ http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CC4QFjAA&url=http%3A%2F%2Fwww.unt.edu%2Frss%2Fclass%2FJon%2FMiscDocs%2Flavaan1.pdf&ei=FJNKU5DpJMyg7AaM-oGADw&usg=AFQjCNHZM8gAcmHf68gz2LNBndImlUB3Wg] – user20650 Apr 13 '14 at 13:42

1 Answers1

3

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.

lebatsnok
  • 6,329
  • 2
  • 21
  • 22
  • Thank you for your reply regarding the covariance, exactly what I needed. But regarding your comment, "Note that the fist loadings on each latent factor are, by default, fixed to 0...", I'm not sure that's right; if you are using the sem() or cfa() functions, the loadings would be estimated for each of x1, x2, x3, x4, etc... Correct me if I'm wrong though. – Maher Said Apr 17 '14 at 17:37
  • 1
    Yes, and no. I made a stupid mistake (now corrected!) - the first loading is not fixed to *0*, it's fixed to *1*. Look at http://lavaan.ugent.be/tutorial/syntax2.html, the first paragraph. The loading for x1 is (by default) not estimated, it is fixed to 1 - if you don't want this, you need the `NA*x1` trick. – lebatsnok Apr 20 '14 at 21:27
  • I think the difference in our approaches is the many pre-loaded arguments that come along with the sem() shell of lavaan() which allows for such loadings to be calculated automatically even without the NA. But again, when I noticed your "(by default)" it made sense to me. – Maher Said Apr 21 '14 at 20:48