title: this is an example of 3-level regression
montecarlo:
names are y x w z;
nobservations = 7500;
nreps = 1;
CSIZES = 50[30(5)];
ncsize = 1[1];
within = x;
between =(level2) w (level3) z;
cutpoints = w(0);
save = ex9.20.dat;
ANALYSIS: TYPE = threelevel random;
model population:
%within%
x@1;
s1 | y on x;
y*1;
%between level2%
w@1;
s2 | y on w*.4;
y*.6;
s12 | s1 on w;
s1*.4;
y with s1*.3;
%between level3%
z@1;
y on z*.6;
y*.4;
[y*.5];
s1 on z*.2;
s1*.4;
[s1*.4];
s2 on z*.3;
s2*.4;
[s2*.7];
s12 on z*.2;
s12*.5;
[s12*.4];
y with s1*.2;
y with s2*.1;
y with s12*0;
s1 with s2*.2;
model:
%within%
s1 | y on x;
y*1;
%between level2%
s2 | y on w*.4;
y*.6;
s12 | s1 on w;
s1*.4;
y with s1*.3;
%between level3%
y on z*.6;
y*.4;
[y*.5];
s1 on z*.2;
s1*.4;
[s1*.4];
s2 on z*.3;
s2*.4;
[s2*.7];
s12 on z*.2;
s12*.5;
[s12*.4];
y with s1*.2;
y with s2*.1;
y with s12*0;
s1 with s2*.2;
s1 with s12*0;
s2 with s12*0;
output:
tech9;