TITLE: this is an example of a Monte Carlo simulation study for a two-level
mediation model with random slopes
MONTECARLO:
NAMES ARE y m x;
WITHIN = x;
NOBSERVATIONS = 1000;
NCSIZES = 1;
CSIZES = 100 (10);
NREP = 100;
ANALYSIS: TYPE = TWOLEVEL RANDOM;
MODEL POPULATION:
%WITHIN%
x@1;
c | y ON x;
b | y ON m;
a | m ON x;
m*1; y*1;
%BETWEEN%
y WITH m*0.1 b*0.1 a*0.1 c*0.1;
m WITH b*0.1 a*0.1 c*0.1;
a WITH b*0.1 (cab);
a WITH c*0.1;
b WITH c*0.1;
y*1 m*1 a*1 b*1 c*1;
[a*0.4] (ma);
[b*0.5] (mb);
[c*0.6];
MODEL:
%WITHIN%
c | y ON x;
b | y ON m;
a | m ON x;
m*1; y*1;
%BETWEEN%
y WITH m*0.1 b*0.1 a*0.1 c*0.1;
m WITH b*0.1 a*0.1 c*0.1;
a WITH b*0.1 (cab);
a WITH c*0.1;
b WITH c*0.1;
y*1 m*1 a*1 b*1 c*1;
[a*0.4] (ma);
[b*0.5] (mb);
[c*0.6];
MODEL CONSTRAINT:
NEW(m*0.3);
m=ma*mb+cab;