I want to test a multi-stage path model (e.g., A predicts B, B predicts C, C predicts D) where all of my variables are individual observations nested within groups. So far I've been doing this through multiple unique multilevel analysis in R.

I would prefer to use a technique like SEM that lets me test multiple paths at the same time (A -> B -> C -> D) and still properly handle the 2-levels (individuals in groups).

I understand that MPLUS can handle this. Is there an R package I can use?

up vote 19 down vote accepted

It seems that OpenMx (based on Mx but it's now an R package) can do what you are looking for: "Multi Level Analysis"

  • 6
    (+1) It's merely a fork of Mx but it is quite good as free software for SEM. Another promising project is lavaan (which tries to provide Mplus compliant output, whenever possible). – chl May 19 '11 at 21:43
  • @chi Thank you for the suggestion, I'll check out lavaan, too. – Steven L. Johnson May 23 '11 at 14:44

You can do multilevel SEM in any package that supports multiple group analysis using Muthen's MUML method.

You model 2 groups, the first with the within-covariance matrix and the second with the between covariance matrix as data. Then you restrict the relevant parameters to be equal across groups (which depends on the model).

So yes, you can do multilevel SEM in lavaan and OpenMx.

See http://smr.sagepub.com/content/22/3/376.short

If your model is complicated, I would recommend xxM, a package for R by Paras Mehta. http://xxm.times.uh.edu/

Mehta, P. D. (2013). n-level structural equation modeling. In Y. Petscher, C. Schatschneider & D. L. Compton (Eds.), Applied quantitative analysis in the social sciences (pp. 329-362). New York: Routledge.

  • What would be the advantages of this model? – Andy Mar 2 '15 at 15:43
  • @Andy: I haven't used this package, but it appears to support a wide variety of models and situations as well as has no limit on number of levels. However, the package requires explicit specification of various matrices, which introduces excessive wordiness and is cumbersome. Another issues are that 1) it seems that xxM currently only supports Windows; 2) the package is not on CRAN; 3) the package seems to be free, but not an open source software (IMHO, big negative!). (to be cont'd) – Aleksandr Blekh Mar 2 '15 at 16:18
  • @Andy: Here's the User's Guide, which is handy, since otherwise you have to register to download the document. – Aleksandr Blekh Mar 2 '15 at 16:19
  • Thanks! I thought this information would make a more complete answer. – Andy Mar 2 '15 at 16:26

In regards to the ability to pull this off in any SEM program....yes, you don't always need specialized SEM software, but you might have a hell of a data wrangling job if you don't use SEM software that is specialized for this task. FYI: I don't find openmx to be intuitive.

Here's a reference for pulling this off in most any software, which wasn't referenced previously.

Try searching for "structural equation modeling" on http://rseek.org. You'll find several helpful links, including links to several possible packages.

You might also check out the Task View for the social sciences, there's a section for structural equation modeling maybe a third of the way down. See http://cran.r-project.org/web/views/SocialSciences.html.

One package in particular you might find helpful is John Fox's sem package. http://cran.r-project.org/web/packages/sem/index.html

  • AFAIK none of these packages can estimate multilevel path/structural equation models. – Bernd Weiss May 20 '11 at 2:06
  • Didn't realize that. Glad you spoke up about OpenMx. – Aaron May 20 '11 at 2:07
  • (I'll keep the answer, because especially with Bernd's comment, it may be useful to others asking this same question.) – Aaron May 20 '11 at 13:17
  • Thanks for the suggestions. I tried the first and third before posting my question and as @Bernd pointed out, there's nothing (obvious) there that has both multilevel and SEM. – Steven L. Johnson May 23 '11 at 14:43

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.