Why all data has to be continuous when using Lavaan for multilevel mediation analysis?

55 views
Skip to first unread message

Haimei Yu

unread,
Jun 16, 2024, 10:40:24 PMJun 16
to lavaan

We are conducting a repeated measure experiment with around 40 participants. X has 2 possible values, coded as 1 and 2, representing 2 conditions (so not continuous numeric variable). Within each condition, we have 40 trials. We have two mediators, and each mediators has a range from 1 to 7. Y also has a range from 1 to 7.

I was able to fit in lavaan multilevel mediation model with sem, but the website also suggests that `

If the data is clustered, one way to handle the clustering is to use a multilevel modeling approach. In the SEM framework, this leads to multilevel SEM. The multilevel capabilities of lavaan are still limited, but you can fit a two-level SEM with random intercepts (note: only when all data is continuous).

What's the logic/reason behind this? Does this mean I should not trust the outcome from the current analysis? If so, is there any other better package I can use? (it seems that "mediation" does not allow multiple mediators).

Thank you so much for any help!!!

My code is attached in the screenshot photo.


Thank you so much for any help and suggestion!!!





Screenshot 2024-06-17 at 10.39.09.png

Terrence Jorgensen

unread,
Jun 20, 2024, 5:15:21 PM (13 days ago) Jun 20
to lavaan

only when all data is continuous).

What's the logic/reason behind this? 

He only means endogenous variables.  Your X is exogenous and does not need to be continuous (by default, fixed.x=TRUE anyway, so no distributional assumption is needed about predictors).  ML-SEM for categorical outcomes requires numerical integration to estimate parameters.  That is notoriously slow in R, so it is not implemented in lavaan (which is written entirely in R, without an C++ or Fortran subroutines for speed).  Mplus can estimate ML-SEM with categorical outcomes. 

Terrence D. Jorgensen    (he, him, his)
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam
http://www.uva.nl/profile/t.d.jorgensen


Haimei Yu

unread,
Jun 25, 2024, 7:40:05 AM (8 days ago) Jun 25
to lav...@googlegroups.com
I see. Thank you so much for your help! 

--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/WMx7vOXmQo8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/8db82b97-0a4f-424e-a9ab-25cc5eba2583n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages