TITLE: this is an example of a Monte Carlo simulation study for a
two-level mixture regression for a continuous dependent variable with
between-level categorical latent class indicators
for a between-level categorical latent variable
montecarlo:
names are y x1 x2 w ub1-ub6;
nobservations = 1000;
ncsizes = 3;
csizes = 40 (5) 50 (10) 20 (15);
genclasses = cb(2 b);
classes = cb(2);
generate = ub1-ub6(1);
categorical = ub1-ub6;
between = cb w ub1-ub6;
within = x1 x2;
seed = 3454367;
nrep = 1;
save = ex10.3.dat;
analysis:
type = twolevel mixture;
model population:
%within%
%overall%
x1-x2*1;
[x1-x2*0];
y on x1*2 x2*1;
y*1;
%between%
%overall%
[w@0]; w@1;
cb#1 on w*1;
y on w*.7; y*.5;
[cb#1*0];
[y*1];
%cb#1%
[y*2.4];
[ub1$1-ub3$1*-1 ub4$1-ub6$1*1];
%cb#2%
[ub1$1-ub3$1*1 ub4$1-ub6$1*-1];
model:
%within%
%overall%
y on x1*2 x2*1;
y*1;
%between%
%overall%
cb#1 on w*1;
y on w*.7; y*.5;
[cb#1*0];
[y*1];
%cb#1%
[y*2.4];
[ub1$1-ub3$1*-1 ub4$1-ub6$1*1];
%cb#2%
[ub1$1-ub3$1*1 ub4$1-ub6$1*-1];
output:
tech8 tech9;