Skip to content
Prev 309881 / 398506 Next

structural equations using sem package

Dear Soon Yi,

Yes, if a variable in the model doesn't appear in the data (either a data set, given by the data argument, or a covariance or moment matrix given by the S argument to sem), sem will assume that the variable is a latent variable.

On the other hand, the models you've specified have puzzling features. In the first model, you fix the error variances for med and endo to 1. Normally, these would be free parameters. Setting the error variance for latent in the second model to 1 is a normalizing constraint to set the scale of the variable, but I believe that the model is underidentified.

A few additional comments: (1) You don't have to formulate the model as a character matrix; you can use specifyModel() instead. Similarly, readMoments() makes it easier to input the covariance matrix. (2) It's generally easier to specify the model in equation form, rather than path form, using specifyEquations(). (3) If you use specifyModel() or specifyEquations(), it's not necessary (though also not wrong) to specify error variances for endogenous variables; if omitted, these will be supplied by default (but as free parameters). 

For a number of examples, see ?sem and the document at <http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/appendix/Appendix-SEMs.pdf>. 

I hope this helps,
 John

------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
	
On Sun, 4 Nov 2012 19:27:12 +0000 (GMT)
Soon Yi <soon.yi at ymail.com> wrote: