[R] Structural equation modeling in R(lavaan,sem)

yrosseel yrosseel at gmail.com
Mon Mar 28 13:41:43 CEST 2011


On 03/28/2011 04:18 AM, jouba wrote:
>
> Jeremy thanks a lot for your response I have read sem package help
> and I currently reading the help of lavaan I see that there is also
> an other function called lavaan can do the SEM analysis So I wonder
> what is the difference between this function and the sem function

The 'sem()' function (in the lavaan package) is more user-friendly, in 
the sence that it sets a number of reasonable options by default, before 
calling the lower-level 'lavaan()' function (which has the 'feature' of 
doing nothing automatically, but expects that you really know what your 
are doing).

Most users should only use the 'sem()' function (or the 'cfa()' 
function). For non-standard models, the 'lavaan()' function gives more 
control.

> Also I am wondering in the case where we have categorical variables
> and discreet variables??

Currently, the lavaan package (0.4-7) has no support for categorical 
variables.

> calculate the correlation matrix , mainly when we have to calculate
> these between a quantitative and qualitative variables, I wonder if
> polycor package is the best solution for this

It depends. The 'hetcor()' function in the polycor package may provide a 
suitable correlation matrix that can be used with the 'sem' package or 
the 'lavaan' package. However, AFAIK, the polycor does not compute the 
corresponding asymptotic weight matrix which you need for getting proper 
standard errors and test statistics (in a WLS context).

The OpenMx package (http://openmx.psyc.virginia.edu/) has some support 
for categorical (ie binary/ordinal) observed variables (although I'm not 
sure if they can handle the joint analysis of ordinal and continuous 
variables yet).

But none of this is needed _if_ the categorical variables are all 
exogenous (ie predictor variables only) in which case you can still use 
the methods for continuous data.

Yves.

--
Yves Rosseel -- http://www.da.ugent.be
Department of Data Analysis, Ghent University
Henri Dunantlaan 1, B-9000 Gent, Belgium



More information about the R-help mailing list