yrosseel / lavaan

an R package for structural equation modeling and more
http://lavaan.org
427 stars 98 forks source link

Question about selection order of model fitting #368

Closed XiaPoppy closed 1 month ago

XiaPoppy commented 2 months ago

Hi, I am using sem() to fit a Gaussian linear SEM. e.g.: I have 6 variables with the given causality:

x3 ~ x1+x2 x5 ~ x3+x4 x6 ~ x5

Now I want to ask, does the function sem() fit the model with the topologic order as I gave, or it doesn't check the topologic order among variables and only do linear regression model one by one? Actually I am wondering the mathematic background behind the function.

Looking forward to your reply.

Best, Danyang

yrosseel commented 1 month ago

This is more a questions for the lavaan discussion group, or even SEMNET.

In SEM, these three equations are estimated simultaneously. There is no 'ordering' of any kind. You can change the ordering of the three equations, and the result will be the same. If the system of equations is recursive (i.e., no feedback loops or correlated errors), you can just fit every equation separately using OLS. If the system is not recursive, an iterative ML algorithm (or two-stage LS) is needed.

You can find the mathematical background in any good book on SEM. Start with Bollen (1989), Structural Equations with Latent Variables, Wiley.