INPUT INSTRUCTIONS
TITLE: 2-1-1 mediation random slope (MSEM)
DATA: FILE IS 2-1-1.dat;
VARIABLE:
NAMES ARE ID x m y;
USEVARIABLES ARE ID x m y;
BETWEEN IS x;
CLUSTER IS ID;
ANALYSIS:
TYPE IS TWOLEVEL RANDOM;
MODEL:
%WITHIN%
m y; ! estimate Level-1 (residual) variances for m and y
sb | y ON m; ! regress y on m
%BETWEEN%
x m y; ! estimate Level-2 (residual) variances for x, m, and y
m ON x(a); ! regress m on x, call the slope "a"
y ON m(bb); ! regress y on m, call the slope "bb"; bb = contextual effect, not the Between
y ON x; ! regress y on x
sb WITH x m y; ! estimate Level-2 covariances of sb with x, m, and y
[sb](bw); ! estimate the mean of sb, call it "bw"
MODEL CONSTRAINT: ! section for computing indirect effect
NEW(b indb); ! name the Between b path and the indirect effect
b=bb+bw; ! compute Between b path
indb=a*b; ! compute the Between indirect effect
OUTPUT:
TECH1 TECH8 CINTERVAL;
*** WARNING in MODEL command
In the MODEL command, the following variable is a y-variable on the BETWEEN
level and an x-variable on the WITHIN level. This variable will be treated
as a y-variable on both levels: M
*** ERROR
One or more between-level variables have variation within a cluster for
one or more clusters. Check your data and format statement.
Between Cluster ID with variation in this variable
Variable (only one cluster ID will be listed)
X 3054
已经非常仔细的检查了我的第二水平数据,在每一个cluster里面都相等啊
ID y m x
3054 18 24 66
3054 16 32 66
3054 20 38 66