BookmarkSubscribeRSS Feed
jtsfyu
Calcite | Level 5

Hello,

 

I used the blimp application to do multiple imputations for my missing data and was able to successfully run my 2-level hierarchical models using the imputed data. I can get pulled fixed effects, but I cannot figure out how to get my pulled Error Variance/Level-2 Intercept and my pulled model fit. Below is the program for one of my final models and my PROC MIANALYZE step. Thank you in advance for your help!!!

 

PROC GLIMMIX DATA=dissert.centered METHOD=LAPLACE NOCLPRINT; 
CLASS cdscode ethn_new (ref=FIRST) sex (ref=FIRST);
MODEL m_health (EVENT=LAST)= p_ed sex ethn_new grade_new_c cumAA_c RJLevel YearsImp_c PeerRJ WhS/CL DIST=BINARY LINK=LOGIT SOLUTION
ODDSRATIO (DIFF=FIRST LABEL); 
RANDOM INTERCEPT / SUBJECT=cdscode S CL TYPE=VC; 
by _imputation_;
ods output ParameterEstimates=lgsparm1;
COVTEST /WALD;
RUN;

 

PROC MIANALYZE parms = lgsparm1;
CLASS ethn_new sex;
modeleffects Intercept p_ed sex ethn_new grade_new_c cumAA_c RJLevel YearsImp_c PeerRJ WhS;
RUN;

 

3 REPLIES 3
SAS_Rob
SAS Employee

Below is a sample program that shows how to combine the results from Proc GLIMMIX in MIANALYZE. 

data test;
seed=621435234;
do id=1 to 30;
rc=rannor(seed); /* random effect on intercept for id */
rb=rannor(seed)*.7; /* random effect on slope for id */
do rep=1 to 20;
x1=ranuni(seed);
x2=ranuni(seed);
logit=-2 + (2+rb)*x1 + rc+.08*x2;
p=exp(logit)/(1+exp(logit));
if ranuni(seed)< p then y=1; else y=0;
output;
end;
end;
run;

data test;set test;
if ranuni(312)>.5 then x2=.;*create missing values;
run;
proc mi data=test out=out1 seed=10;
var y x1 x2;
run;
ods trace on;
proc glimmix data=out1;
by _imputation_;
class id;
model y=x1 x2/d=binomial solution or(label);;
random intercept/subject=id solution;
ods output parameterestimates=parms solutionr=rand(rename=(stderrpred=stderr));
run;

 


/*Combining Random Effects*/
proc sort data=rand;
by effect subject _imputation_;
run;

proc mianalyze parms=rand;
by subject;
modeleffects intercept;
run;

jtsfyu
Calcite | Level 5

Thanks, SAS_Rob!

 

When I use the /*Combining Random Effects*/ code you provided, I just get 20 separate estimates for 20 imputation sets. I am looking for a way to have one pulled level 2 variance. 

 

I am able to do that for the fixed effects by using this program--at the end of the analysis, I have the combined effects for the 20 models.

 

PROC GLIMMIX DATA=dissert.centered METHOD=LAPLACE NOCLPRINT;
CLASS cdscode ethn_r (ref=FIRST) sex (ref=FIRST)sex;
MODEL m_health (EVENT=LAST)= ethn_r sex grade_new_c /CL DIST=BINARY LINK=LOGIT SOLUTION
ODDSRATIO (DIFF=FIRST LABEL);
RANDOM INTERCEPT / SUBJECT=cdscode S CL TYPE=VC;
by _imputation_;
nloptions gconv=0;
ods output ParameterEstimates=lgsparm35;
COVTEST /WALD;
RUN;

 

proc mianalyze parms = lgsparm35;
CLASS ethn_r sex;
modeleffects Intercept ethn_r sex grade_new_c;
run;

 

Thanks for your help!

 

Jelena 

 

SAS_Rob
SAS Employee

Because you use the SUBJECT= option on the RANDOM statement, you will get an estimate for each of the subjects.  That is why you get multiple estimates and you have to use the BY statement in MIANALYZE.

 

In other words, there is not one overall estimate, but instead one overall estimate for each subject.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2043 views
  • 0 likes
  • 2 in conversation