Chapter 12, Section 12.5
Marginal Logistic Regression
Model (to obtain initial estimates)
data amen;
infile 'amenorrhea.dat';
input id trt time y;
ctime=time;
time2=time*time;
**********************************************************************************************;
* Use marginal logistic regression model to
obtain initial parameter estimates *;
**********************************************************************************************;
title1 Marginal Logistic Regression Model for Odds of Amenorrhea;
title2 Clinical Trial of Contracepting Women;
proc genmod descending;
class id ctime;
model y = time time2 trt*time trt*time2 / d=binomial link=logit;
repeated subject=id / withinsubject=ctime logor=fullclust;
run;
<Selected
Output>
Random Effects Logistic
Regression Model
***********************************************************************************;
* Use GEE estimates as initial estimates for
regression parameters *;
***********************************************************************************;
title1 Random Effects Logistic Regression Model for Odds of
Amenorrhea;
title2 Clinical Trial of Contracepting Women;
proc nlmixed qpoints=50;
parms b0=-2.2461 b1=0.7030
b2=-0.0323 b3=.3380 b4=-.0683 s1=0 to 8
by 1;
lp = b0 + b1*time +b2*time2 +
b3*trt*time +b4*trt*time2 + u;
p=(exp(lp))/(1+exp(lp));
model y ~ binary(p);
random u~normal(0, s1) subject=id;
contrast 'Trt X Time Interaction'
1*b3, 1*b4;
run;
<Selected
Output>
Marginal Log-linear
Regression Model (to obtain initial
estimates)
data seizure;
infile 'epilepsy.dat';
input id trt age y0 y1 y2 y3 y4;
y=y0; visit=0; output;
y=y1; visit=1; output;
y=y2; visit=2; output;
y=y3; visit=3; output;
y=y4; visit=4; output;
drop y0-y4;
proc sort;
by id
visit;
data seizure;
set seizure;
if visit=0
then do;
time=0;
ltime=log(8);
end;
else do;
time=1;
ltime=log(2);
end;
title1
Marginal Log-linear Regression Model (to obtain initial estimates);
title2
Clinical Trial of Epileptic Patients;
proc genmod;
class id;
model y=time trt time*trt / d=poisson offset=ltime ;
repeated
subject=id / modelse corrw type=un;
run;
Random Effects Log-Linear
Regression Model
***********************************************************************************;
* Use GEE estimates as initial estimates for
regression parameters *;
***********************************************************************************;
title1 Mixed Effects Log-linear Regression Model (Random
Intercept and Slope);
title2 Clinical Trial of Epileptic Patients;
proc
nlmixed qpoints=50;
parms
beta1=1.1213 beta2=0.1244 beta3=0.0718 beta4=-.1150
s2u1=0 to 1 by 0.2 s2u2=0 to 1 by 0.2
cu12=0.0;
eta = ltime + beta1
+ beta2*time + beta3*trt + beta4*time*trt + u1 + u2*time;
mu=exp(eta);
model y ~ poisson(mu);
random u1 u2 ~ normal([0,0],
[s2u1,cu12,s2u2]) subject=id;
run;
<Selected
Output>
****************************************************************************;
* Remove Subject ID 49,
a potential outlier, from the analysis
*;
****************************************************************************;
data
seizure;
set seizure;
if (id ne 49);
title1 Mixed Effects Log-linear
Regression Model (Random Intercept and Slope);
title2 Analysis Excluding
Patient 49 (Potential Outlier);
title3 Clinical Trial of Epileptic
Patients;
proc nlmixed qpoints=50;
parms beta1=1.1213
beta2=0.1244 beta3=0.0718
beta4=-.1150
s2u1=0 to 1 by
0.2 s2u2=0 to 1 by 0.2 cu12=0.0;
eta = ltime + beta1 + beta2*time + beta3*trt + beta4*time*trt + u1 +
u2*time;
mu=exp(eta);
model y ~ poisson(mu);
random u1 u2 ~ normal([0,0],
[s2u1,cu12,s2u2]) subject=id;
run;
<Selected
Output>