Hello,
I'm using multiple imputation to deal with some missing data in a 3-way interaction model. One of the moderators is sex (females =1, males = 2), and I would like to look at the conditional effects within each sex. That is, I would like to see the 2-way interactions for males and females. However, when I change the format and set a different reference group, it shows that reference group has changed in the output (e.g., male row has now has no values for sex variable, only female), but only the intercept values change?
Please let me know how I can clarify or provide more information.
Thank you so much!
Best,
Joe
with sex as one of the predictor variables/moderators.
I want to report the conditional effects (e.g.,
Can anyone tell me why there's no difference in my results when I change reference groups.
Ah, so
epii_gender_DHEAcort represents a three-way effect.
If C is a binary classification variable and X1 and X2 are other variables, then the two-way effects
C*X1 C*x2 and X1*X2
contain all the interaction information. The three-way effect C*X1*X2 is redundant (linearly dependent) and so the parameter estimates will be missing. This is a mathematical fact and has nothing to do with "too much calculations" or multiple imputations.
Yes, what you observe is the correct behavior. If you change the reference category from Male to Female, you should see the Intercept estimate change and you should see an estimate for Female instead of Male.
If this is not what you are seeing, post your code, including the PROC FORMAT code. You should change the reference level on the CLASS statement; there is no need to change the format.
For another example and a discussion (possibly more technical than you require), see the section "If you change the reference levels, you get a different estimate" in the article "Singular parameterizations, generalized inverses, and regression estimates."
Hello @Rick_SAS,
Thank you for your reply. Much appreciated. So, I get why the intercept would change and I'd get an estimate for the new reference group I've set, but I'm not sure why I wouldn't get different estimates (the conditional effects?) for each group (comparing male vs female outputs) for all of the other estimates except the 2-way interactions and the 3-way interaction that include the group variable? Sorry if that's confusing. Still learning (grad student). When I change the reference groups in a non-multiple imputation model, I get different estimates for the intercept, the group variable, and the 2-way interactions that do not include the group variable. Here is the code I'm using just in case you can spot anything obvious I might be doing wrong.
/*FORMAT*/
proc format;
value gender1f2m
1 = 'female'
2 = 'male';
run;
proc format;
value genderref
1 = '2female'
2 = '1male';
run;
/*EPII X GENDER X DHEAcort*/
ods select none;
Proc mixed data = pandemic.auc_mi_imputed_dheacort method=reml covtest ;
class gender1f2m;
model covidanx_z = epii_mc gender1f2m DHEA_cortisol_winsorized_mc
epii_gender epii_DHEAcort gender_DHEAcort epii_gender_DHEAcort
anx_z
diff_s4_wake BlackvsOtherRace1Black0Other incometoneedsw pubc_mean/ solution;
format gender1f2m genderref.;
by _Imputation_ ;
ods output SolutionF=mixparms ;
run;
/*POOLING 2 IMPUTATION ONLY*/
ods select all;
proc print data=mixparms (obs=27);
var _Imputation_ Effect Estimate StdErr ;
title 'REG Model Coefficients and Covaraince Matrices' '(first 2 imputations)';
run;
/*POOLING*/
proc mianalyze parms=mixparms edf=234;
class gender1f2m;
modeleffects intercept epii_mc gender1f2m DHEA_cortisol_winsor
epii_gender epii_DHEAcort gender_DHEAcort epii_gender_DHEAcort
anx_z
diff_s4_wake BlackvsOtherRace1Bla incometoneedsw pubc_mean;
format gender1f2m genderref.;
run;
Thank you very much!
Best,
Joe
It looks to me like you created dummy variables for the interaction terms prior to calling PROC MIXED. Therefore, the interaction terms are not affected by the format that you are using for the gender1f2m variable.
The better syntax is to put the interaction effects directly on the MODEL statement. Then when you change the format, it will also change the dummy variables that correspond to the interaction effects. For example, try a MODEL statement such as
class gender1f2m;
model covidanx_z = epii_mc gender1f2m epii_mc*gender1f2m
...
Hi @Rick_SAS ,
Yeah, that makes sense. I was actually using that method, but for some reason everything came out fine except the 3-way interaction. The 3-way interaction values were all either missing (".") or 0. That's when I created the dummy interaction terms instead. Maybe the 3-way interaction is just too much calculations/pooling for multiple imputation?
Best,
Joe
Ah, so
epii_gender_DHEAcort represents a three-way effect.
If C is a binary classification variable and X1 and X2 are other variables, then the two-way effects
C*X1 C*x2 and X1*X2
contain all the interaction information. The three-way effect C*X1*X2 is redundant (linearly dependent) and so the parameter estimates will be missing. This is a mathematical fact and has nothing to do with "too much calculations" or multiple imputations.
Oh, wow. Okay. Very good to know! I was confused because the 3-way interaction showed up on the non-multiple imputation output and on the multiple imputation output before the final pooling step.
So, since there's no 3-way interaction to report. Do people usually assume the 3-way is significant when a 2-way interaction is significant for one group and not the other? I guess this is probably a separate topic.
Anyways -- thank you for all of your help!
Best,
Joe
Glad the issue is resolved. You can select one of the posts as The Answer to indicate that you have found an answer.
thank you for sharing
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.