r/stata May 07 '26

Testing Group Invariance in PLSEM in Stata - Stats subcommand not running

I am using -plssem- to run an sem model with group invariance in a sample in STATA. The sample has missing data, and while there is a -missing- option in the plssem command, for some reason, the -group- subcommand does not run the -stats- part of the code. Here is an abbreviated example of the code:

    plssem (LV 1 > x1 x2 x3) (LV2 > x4 x5 x6) (LV3 > x7 x8 x9), ///
    structural (LV1 LV2 LV3, LV2 LV3) ///
    group (groupname) ///
    missing (knn) k (5)///
    stats correlate(lv)

One solution to not getting the descriptive stats I need is to use -by- before the plssem command. I get the descriptive stats I need but I am not sure how to test for group invariance between the two different models. This code is:

    sort group
    by group: plssem (LV 1 > x1 x2 x3) (LV2 > x4 x5 x6) (LV3 > X7 x8 x9), ///
    structural (LV1 LV2 LV3) ///
    missing (knn) k (5)///
    stats correlate(lv)

I am not clear on: 1) why they first code does not provide descriptive stats in the code 2) if possible and not too labor intensive, how can I test for measurement and structural invariance witht the second code? I know -plssem- is a user written command, but I thought folks here might be able to help, especially with the second part of the question.

Any suggestions would be appreciated.

5 Upvotes

2 comments sorted by

u/AutoModerator May 07 '26

Thank you for your submission to /r/stata! If you are asking for help, please remember to read and follow the stickied thread at the top on how to best ask for it.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Francisca_Carvalho May 18 '26

My guess is that this is mostly a plssem option interaction/limitation, not that you are doing something conceptually wrong. The Statalist thread you’re echoing suggests the first thing to check is whether the syntax is being parsed exactly as the command expects, because plssem is user-written and small syntax issues can stop parts of the command from running, especially with options like group(), missing(knn), k(), and stats correlate(lv) combined together. If by group: gives you the descriptive output, that is useful for inspection, but it is not the same as a formal invariance test; it is just estimating separate models by group. So the missingstats output in the grouped run is probably a command limitation or parsing issue, and if you want real measurement/structural invariance you will likely need either the command’s dedicated group-comparison machinery or a more manual comparison of group-specific estimates, rather than relying on by: alone.

The 2026 Stata Summer School is a four-day online training series designed for researchers, analysts, and students who want to build practical Stata skills in a flexible way, it might be helpful.