Chapter 18, Section 18.4
Analysis of Response Profiles with Multiple Imputation of Missing Data
data tlc;
infile 'tlcmiss.dat';
input id trt y1 y2 y3 y4;
title1 Multiple Imputation of Missing Blood Lead Levels using MCMC Method;
title2 Treatment of Lead Exposed Children (TLC) Trial;
proc mi data=tlc out=miout nimpute=50 seed=57313131;
mcmc initial=em nbiter=5000 niter=500;
var trt y1 y2 y3 y4;
run;
**********************************************************************************************;
* Create long format dataset for longitudinal analyses of 50 imputed datasets *;
**********************************************************************************************;
data milong;
set miout;
y=y1; time=0; output;
y=y2; time=1; output;
y=y3; time=4; output;
y=y4; time=6; output;
drop y1-y4;
***************************************************************************************;
* Run separate analysis of response profiles on each imputed datasets *;
***************************************************************************************;
proc sort;
by _imputation_ descending trt descending time;
proc mixed data=milong method=reml order=data;
class id trt time;
model y = trt time trt*time / s covb ;
repeated / subject=id type=un;
by _imputation_;
ods output solutionF=beta covb=varbeta;
run;
*************************************************************************************;
* Combine results of the 50 analyses of the multiple imputed datasets *;
*************************************************************************************;
title1 Combining Results of Analyses of Multiple Imputation Data Sets;
title2 Treatment of Lead Exposed Children (TLC) Trial;
proc mianalyze parms(classvar=full)=beta;
class trt time;
modeleffects intercept trt time trt*time;
run;
IPW-GEE Estimation of Marginal Logistic Regression Model
data contracep;
infile 'contracep.dat';
input id dose time y prevy r;
proc sort data=contracep;
by id time;
run;
title1 Logistic Regression Model for Probability of Remaining in the Study;
title2 Clinical Trial of Contracepting Women;
proc genmod descending;
class time (param=ref ref="1");
model r = time dose prevy dose*prevy / dist=bin link=logit;
where time ne 0;
output out=predict p=probs;
run;
proc sort data=predict;
by id time;
data wgt (keep=id time cumprobs probs);
set predict;
by id time;
retain cumprobs;
if first.id then cumprobs=probs;
else cumprobs=cumprobs*probs;
data combine;
merge contracep wgt;
by id time;
if (time=0) then ipw=1;
else ipw=1/cumprobs;
title1 IPW-GEE Estimation of Marginal Logistic Regression Model for Odds of Amenorrhea;
title2 Clinical Trial of Contracepting Women;
proc genmod descending data=combine;
weight ipw;
class id;
model y = dose time time*time dose*time dose*time*time / dist=bin link=logit;
repeated subject=id / type=
run;
<Selected Output>