TITLE: this is an example of a two-level
regression analysis for a continuous
dependent variable with a random slope
and an observed covariate
part b
DATA: FILE = ex9.2a.dat;
VARIABLE: NAMES = y x w xm clus;
WITHIN = x;
BETWEEN = w xm;
CLUSTER = clus;
DEFINE: CENTER x (GROUPMEAN);
ANALYSIS: TYPE = TWOLEVEL RANDOM;
MODEL: %WITHIN%
s | y ON x;
%BETWEEN%
y ON w xm;
[s] (gam0);
s ON w (gam1)
xm;
y WITH s;
MODEL CONSTRAINT:
PLOT(ylow yhigh);
LOOP(level1,-3,3,0.01);
ylow = (gam0+gam1*(-1))*level1;
yhigh = (gam0+gam1*1)*level1;
PLOT: TYPE = PLOT2;