Using categorical data in lavaan (vs. STATA)

463 views
Skip to first unread message

Eran Itskovich

unread,
Mar 13, 2022, 3:52:13 AM3/13/22
to lavaan
Hi everyone,

I'm pretty new to sem and R in genreal, and I would really appreciate your help.

I have a model with only categorical variables. When I used STATA, I understood that I needed to use the 'gsem' command (probit ordinal). However, running my model took a lot of time so I decided to try out lavaan.
If I understand correctly, because all my variables are categorical, I should include the 'ordered = TRUE' option. 
Am I right?  and is it equivalent to using the 'gsem' command in STATA? I understand that both may use different estimation approcaches, but I just want to make sure that I use the right method in lavaan.

Thanks!
Eran

Jasper Bogaert

unread,
Mar 13, 2022, 4:57:27 AM3/13/22
to lavaan
Hi,

If you have categorical endogenous variables, you can indeed just use ordered = TRUE if all the items are categorical. If not all the items are categorical, you can specify those items that are categorical in the ordered option (instead of using TRUE). If you do this, then the WLSMV estimator will be used by default. I found this information in the lavaan tutorial (https://lavaan.ugent.be/tutorial/cat.html):

"If all the (endogenous) variables are to be treated as categorical, you can use ordered = TRUE as a shortcut.

When the ordered= argument is used, lavaan will automatically switch to the WLSMV estimator: it will use diagonally weighted least squares (DWLS) to estimate the model parameters, but it will use the full weight matrix to compute robust standard errors, and a mean- and variance-adjusted test statistic. Other options are unweighted least squares (ULSMV), or pairwise maximum likelihood (PML). Full information maximum likelihood is currently not supported."

It looks equivalent to the gsem command in STATA to me. However, I have not much experience with STATA so I am not 100% sure. I hope we can get confirmation from someone else.

Best wishes,

Jasper Bogaert

PhD student and teaching assistant
Department of Data Analysis (PP01)
Faculty of Psychology and Educational Sciences
Ghent University

Eran Itskovich

unread,
Mar 13, 2022, 2:08:18 PM3/13/22
to lavaan
Thank you Jasper!
Indeed, it would be great if someone could confirm that gsem in STATA is equivalent to the sem in lavaan with the 'ordered' option.

Best,
Eran

Reply all
Reply to author
Forward
0 new messages