Chapter 8, Section 8.8
Linear Mixed Effects Model
(Random Intercept and Slope for Age)
data fev;
infile 'fev1.dat';
input id ht age baseht baseage
logfev1;
if (id ne 197);
***********************************************;
* Removing outlier:
Subject ID = 197 *;
***********************************************;
loght=log(ht);
logbht=log(baseht);
title1 Mixed Effects Model for log(FEV1) with Random Intercept
and Slope for Age;
title2 Six Cities Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model logfev1 = age loght baseage
logbht / s chisq;
random intercept age / subject=id
type=un g gcorr v vcorr=35;
run;
<Selected
Output>
Linear Mixed Effects Model
(Random Intercept and Slope for Log Height)
title1 Mixed Effects Model for log(FEV1) with Random Intercept
and Slope for Log Height;
title2 Six Cities Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model logfev1 = age loght baseage
logbht / s chisq;
random intercept loght / subject=id
type=un g gcorr v vcorr=35;
run;
<Selected
Output>
Linear Mixed Effects Model
(Random Intercept and Slopes for Age and Log Height)
title1 Mixed Effects Model for log(FEV1) with Random Intercept
and Slopes for Age and Log Height;
title2 Six Cities Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model logfev1 = age loght baseage
logbht / s chisq;
random intercept age loght /
subject=id type=un g gcorr v vcorr=5;
run;
<Selected
Output>
Linear Mixed Effects Model
(Random Intercept and Slopes)
data fat;
infile 'fat.dat';
input id age agemen time pbf;
time_0=max(time,0);
title1 Mixed Effects Model for Percent Body Fat with Random Intercept and
Slopes before and after Menarche;
title2 MIT Growth and Development Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model pbf = time time_0 / s chisq;
random intercept time time_0 /
subject=id type=un g gcorr;
run;
<Selected
Output>
Linear Mixed Effects Model
(Hybrid Model with Exponential Serial Correlation)
title1 Mixed Effects Model for Percent Body Fat with Random
Intercept;
title2 Hybrid Model with Exponential Serial Correlation;
title3 MIT Growth and Development Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model pbf = time time_0 / s chisq;
repeated / subject=id
type=sp(exp)(time) local;
random intercept / subject=id
type=un g;
run;
<Selected
Output>
Linear Mixed Effects Model
(Hybrid Model with Gaussian Serial Correlation)
title1 Mixed Effects Model for Percent Body Fat with Random
Intercept;
title2 Hybrid Model with Gaussian Serial Correlation;
title3 MIT Growth and Development Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model pbf = time time_0 / s chisq;
repeated / subject=id
type=sp(gau)(time) local;
random intercept / subject=id type=un g;
run;
<Selected
Output>
Linear Mixed Effects Model
(Random Intercept and Slopes)
data cd4;
infile 'cd4.dat';
input id group age sex week logcd4;
****************************************************************;
* Create new variable
combining groups 1, 2, and 3 *;
****************************************************************;
trt=0;
if (group=4) then trt=1;
week_16=max(week - 16, 0);
w16=week_16 - week;
title1 Mixed Effects Model for log CD4;
title2 AIDS Clinical Trial Group (ACTG) 193A Study;
proc mixed method=reml noclprint=10 covtest;
class id;
model logcd4 = week week_16
trt*week trt*week_16 / s chisq;
random intercept week week_16 / subject=id type=un g gcorr;
run;
<Selected
Output>
title1 Mixed Effects Model for log CD4 adjusting for Age and
Gender;
title2 AIDS Clinical Trial Group (ACTG) 193A Study;
ods output solutionr=bluptable;
proc mixed method=reml noclprint=10 covtest;
class id;
model logcd4 = age sex week week_16
trt*w16 / s chisq outpred=yhat;
random intercept week week_16 / subject=id type=un g gcorr solution;
run;
Linear Mixed Effects Model
(Random Intercept and Slopes): Predicted Means
******************************************;
* Print first 60
observations only *;
******************************************;
proc print data=yhat (obs=60);
var id trt week logcd4 pred;
run;
Linear Mixed Effects Model
(Random Intercept and Slopes): Empirical BLUPs
******************************************;
* Print first 60
observations only *;
******************************************;
proc print data=bluptable (obs=60);
run;
<Selected
Output>