Grouping variable in SEM PreviousNext
Mplus Discussion > Structural Equation Modeling >
 amal khanolkar posted on Friday, August 03, 2012 - 8:18 am

I've specified my grouping variable (for smoking) as a follows:

GROUPING IS smoke1 (0 = nonsmoker 1 = smoker);

- However, there are quite a few missing this data on this varaible coded as 9999.

I get the following error message: Can this be ignored or should I deal with it?

Note that there are observations with missing or unknown grouping values.
These cases were deleted. Check that you have specified the GROUPING
option correctly.

- I have specfied that

Thanks & regards,

 Linda K. Muthen posted on Friday, August 03, 2012 - 11:58 am
We can't assign people with missing values on the grouping variable to any group so they are not included in the analysis. I'm not sure how you can change that if you don't know which group they are in.
 Patricia Roberson posted on Tuesday, June 25, 2013 - 1:58 pm

I have reviewed other posts and still have a question about grouping variables and moderation.

I have run a multiple group model. one of the structural paths differed between the four groups as follows: group 1: (beta = .36, p less than .001), group 2 (beta = .40, p less than .001), group 3 (beta = .33, p less than .001), and group 4 (beta = .06, p = .12). Someone asked: "This shows which paths do remain significant and which do not. but it does not tell us whether the significant path DIFFERS from the nonsignificant does it?" I replied that this is correct and you could do a chi-difference test to determine statistical difference. With out this difference test, are the results of this analysis not showing moderation?

Thanks for you time!
 Bengt O. Muthen posted on Tuesday, June 25, 2013 - 6:07 pm
If group is the moderator, there is no moderation if the betas cannot be shown to be significantly different. At least some pairs of betas need to be significantly different.
 Lior Abramson posted on Wednesday, December 02, 2015 - 4:12 am
Is there a way in MPLUS to define a variable and group the data by that variable? As it is now I'm having difficulty because the grouping command must come before the define command.
Thank you
 Linda K. Muthen posted on Wednesday, December 02, 2015 - 6:47 am
You cannot create a grouping variable and use it in the same analysis. You can define it and save the data as a first step.
 Grant Jackson posted on Tuesday, December 27, 2016 - 12:36 pm
I am struggling to make the GROUPING option work. Here is my syntax:

GROUPING IS i_Mperstak_Above (0.000 = Below_Mean 1.000 = At_or_Above_Mean);

This corresponds with the User Guide, and I know that there are no missing data on i_Mperstak_Above, i.e., everyone is either 1.000 or 0.000. I created that variable in SPSS prior to bringing the data into MPlus.

The output I receive is below. Note: The model runs fine when I remove my GROUPING syntax:

The number of observations is 0. Check your data and format statement. Data file: c:\users\grant\box sync\michigan\dissertation files\data\grant jackson\data\all igd st

Note that there are observations with missing or unknown grouping values.
These cases were deleted. Check that you have specified the GROUPING
option correctly.

My ultimate goal is to compare how my structural equation model fits the data for these two groups using a Wald test.

Thanks in advance for your help!
 Linda K. Muthen posted on Tuesday, December 27, 2016 - 5:09 pm
Please send the output, data set, and your license number to
 Whitney C Brown posted on Thursday, June 07, 2018 - 2:27 pm
I am having a similar problem as above, after using my code multiple times
"GROUPING IS change (0 = nonchanger 1 = changer);"

I now get the following error:

Group NONCHANGER has 0 observations.
Data set contains unknown or missing values for GROUPING,
Number of cases with unknown or missing values: 107

This is incorrect and I have checked my data and code multiple times. There is no missingness on this grouping variable. Thank you in advance for your help!
 Bengt O. Muthen posted on Thursday, June 07, 2018 - 6:00 pm
That sounds like you are not reading your data correctly. E.g. check that the number of columns in your data is the same as the number in the NAMES= list. If this doesn't help, send your full output and data to Support along with your license number.
 KL posted on Thursday, March 05, 2020 - 10:02 pm
I was wondering if it is possible to specify more than 1 subgroup at a time using the GROUPING command (e.g, gender, age, and treatment history)? Or would each subgroup have to be analyzed one at a time?
 Bengt O. Muthen posted on Friday, March 06, 2020 - 7:49 am
One grouping variable is needed. So just create a variable that combines the info from gender, age, etc.
Back to top
Add Your Message Here
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Options: Enable HTML code in message
Automatically activate URLs in message