TITLE: this is an example of a two-level
regression analysis for a continuous
dependent variable with a random slope and an observed covariate
DATA: FILE = ex9.2a.dat;
VARIABLE: NAMES = y x w xm clus;
WITHIN = x;
BETWEEN = w xm;
CLUSTER = clus;
! CENTERING = GRANDMEAN (x);
DEFINE: CENTER x (GRANDMEAN);
ANALYSIS: TYPE = TWOLEVEL RANDOM;
MODEL:
%WITHIN%
s | y ON x;
%BETWEEN%
y s ON w xm;
y WITH s;