3.6. A Hybrid Model
In chapter 2, we saw how linear models with fixed and random effects could be combined into a single model by decomposing the time-varying predictors into within-person and between-person components, and by including both components in a random effects model. We can do the same for the logistic regression model, but, unfortunately, things don't work out quite so neatly.
As before, the first step is to calculate person-specific means and deviations from those means for the time-varying predictors:
PROC SORT DATA=teenyrs5; BY id; PROC MEANS DATA=teenyrs5 NWAY NOPRINT; CLASS id; VAR mother spouse inschool hours; OUTPUT OUT=means MEAN=mmother mspouse mschool mhours; RUN;
The CLASS statement tells PROC MEANS to calculate the means ...