BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nath
Fluorite | Level 6

Dear SAS users,

I would like to perfom a multilevel multinomial logistic regression analysis on a dataset with missing values. I have a problem with proc mianalyze. My outcome  has 3 levels ("area_tert": 1, 2, 3). While for each imputed data set, I obtain estimates for each covariate at each outcome level, when I combine the estimates, i.e. using proc mianalyze, I only obtain one estimate for each covariate, and not at each outcome level (2 and 3) and don't understand these pooled estimates!

Could you please help me?

Many thanks!

Below is my syntax:

title "analysis per imputed dataset ";

proc glimmix data=imputed method=RSPL noclprint ;

class id;

model area_tert (order=freq ref='1')=age gender Education / link=glogit dist=multinomial solution;

nloptions tech=newrap;

random Intercept / subject=id group=area_tert;

by _imputation_;

ods output ParameterEstimates=gparms FitStatistics=gfitstats CovParms=randomeffect;

run;

title "combined results - fixed effects";

proc mianalyze parms=gparms;

modeleffects Intercept age gender Education;

stderr Intercept age gender Education;*/

run;

title "combined results - random effect";

proc mianalyze data=Randomeffect;

modeleffects estimate ;

stderr stderr;

run;

Best regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Nath
Fluorite | Level 6

I received a response from SAS support (thanks!). The main idea is to sort the different levels of the depend variable.

I share with you the script sent by SAS support to solve the problem.

Best regards,

 

/*Sample data set that assumes the imputation has already been done*/

data test;

   seed=2534565;

do _imputation_=1 to 2;

do subj=1 to 60;

do a=1 to 3;

do rep=1 to 3;

ind1=ranuni(seed)*subj;

int=-1+rannor(31221)*_imputation_;

      logit=int + .05*ind1-.67*a;

      p=exp(-logit)/(1+exp(-logit));

      if ranuni(seed)>p then y=1;

      else if ranuni(314)>.5 then y=2;

     else y=3;

      output;

   end;

   end;

   end;

   end;

run;ods trace on;

proc glimmix data=test;

class y a subj;

model y=ind1 a/link=glogit dist=multi solution;

by _Imputation_;

random intercept /subject=subj solution group=y;

ods output parameterestimates=parms solutionr=rand_parms;

run;

 

/*Fixed effects*/

/*Need to sort by the different levels of the response variable so that MIANALYZE will*/

/*give the output for each logit function*/

proc sort data=parms;

by y _imputation_;

run;

 

proc mianalyze parms=parms;

class a;

modeleffects intercept a ind1;

by y;

run;

 

/*Fixed effects*/

/*Need to sort by the different levels of the response variable so that MIANALYZE will*/

/*give the output for each logit function*/

proc print data=rand_parms;

run;

 

proc sort data=rand_parms;

by subject group _imputation_;

run;

 

proc mianalyze parms=rand_parms(rename=(stderrpred=stderr));

modeleffects intercept;

by subject group;

run;

View solution in original post

3 REPLIES 3
SteveDenham
Jade | Level 19

Go straight to Tech Support with this one.  PROC MIANALYZE is notorious (at least here in the SAS Statistical Procedures community) for not playing well with the output of the mixed models procedures, as the necessary matrices don't seem to conform to the types that are needed in MIANALYZE.  If you get a good answer from TS, please, please, please share it here (or write an SGF paper on it) so that we can get some resolution.

Steve Denham

Nath
Fluorite | Level 6

Thanks for your suggestion.
I have contacted Tech Support.
If I get an explanation, I will share it here.
Best regards.

Nath
Fluorite | Level 6

I received a response from SAS support (thanks!). The main idea is to sort the different levels of the depend variable.

I share with you the script sent by SAS support to solve the problem.

Best regards,

 

/*Sample data set that assumes the imputation has already been done*/

data test;

   seed=2534565;

do _imputation_=1 to 2;

do subj=1 to 60;

do a=1 to 3;

do rep=1 to 3;

ind1=ranuni(seed)*subj;

int=-1+rannor(31221)*_imputation_;

      logit=int + .05*ind1-.67*a;

      p=exp(-logit)/(1+exp(-logit));

      if ranuni(seed)>p then y=1;

      else if ranuni(314)>.5 then y=2;

     else y=3;

      output;

   end;

   end;

   end;

   end;

run;ods trace on;

proc glimmix data=test;

class y a subj;

model y=ind1 a/link=glogit dist=multi solution;

by _Imputation_;

random intercept /subject=subj solution group=y;

ods output parameterestimates=parms solutionr=rand_parms;

run;

 

/*Fixed effects*/

/*Need to sort by the different levels of the response variable so that MIANALYZE will*/

/*give the output for each logit function*/

proc sort data=parms;

by y _imputation_;

run;

 

proc mianalyze parms=parms;

class a;

modeleffects intercept a ind1;

by y;

run;

 

/*Fixed effects*/

/*Need to sort by the different levels of the response variable so that MIANALYZE will*/

/*give the output for each logit function*/

proc print data=rand_parms;

run;

 

proc sort data=rand_parms;

by subject group _imputation_;

run;

 

proc mianalyze parms=rand_parms(rename=(stderrpred=stderr));

modeleffects intercept;

by subject group;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 3885 views
  • 2 likes
  • 2 in conversation