Mplus数据分析:随机截距交叉之后的做法和如何加协变量,写给粉丝
observed and latent exogenous variables are correlated, and residuals of observed and latent outcome variables (which do not predict anything) in a path model are correlated.
因素间部分,就是随机截距,用BY来设置,写出RIx BY x1@1 x2@1 ...这样的形式,其中@1表示固定为1的意思,这个是做随机效应交叉滞后的默认操作 因素内部分的内在波动,也是用BY来设定,写出wx1 BY x1; wx2 BY x2; ....这样的形式,同时需要将误差方差固定为0 交叉滞后部分,写出wx2 ON wx1 wy1; wx3 ON wx2 wy2; ....这样的形式 内外共变部分,因素内写出wx1 WITH wy1; wx2 WITH wy2;....这样的形式;因素外写出RIx WITH RIy的形式。
MODEL: ! 随机截距
RIx BY x1@1 x2@1 x3@1 x4@1 x5@1;
RIy BY y1@1 y2@1 y3@1 y4@1 y5@1;
! 因素内
wx1 BY x1@1;
wx2 BY x2@1;
wx3 BY x3@1;
wx4 BY x4@1;
wx5 BY x5@1;
wy1 BY y1@1;
wy2 BY y2@1;
wy3 BY y3@1;
wy4 BY y4@1;
wy5 BY y5@1;
! 误差方差为0
x1-y5@0;
! 交叉滞后
wx2 wy2 ON wx1 wy1;
wx3 wy3 ON wx2 wy2;
wx4 wy4 ON wx3 wy3;
wx5 wy5 ON wx4 wy4;
! 随机截距相关
RIx WITH RIy;
!组内相关
wx1 WITH wy1;
wx2 WITH wy2;
wx3 WITH wy3;
wx4 WITH wy4;
wx5 WITH wy5;
加协变量
MODEL: ! 随机截距
RIx BY x1@1 x2@1 x3@1 x4@1 x5@1;
RIy BY y1@1 y2@1 y3@1 y4@1 y5@1;
RIx WITH RIy;
wx1 BY x1@1;
wx2 BY x2@1;
wx3 BY x3@1;
wx4 BY x4@1;
wx5 BY x5@1;
wy1 BY y1@1;
wy2 BY y2@1;
wy3 BY y3@1;
wy4 BY y4@1;
wy5 BY y5@1;
x1-y5@0;
! 协变量添加
x1-x5 ON z1 (s1);
y1-y5 ON z1 (s2);
wx2 wy2 ON wx1 wy1;
wx3 wy3 ON wx2 wy2;
wx4 wy4 ON wx3 wy3;
wx5 wy5 ON wx4 wy4;
wx1 WITH wy1;
wx2 WITH wy2;
wx3 WITH wy3;
wx4 WITH wy4;
wx5 WITH wy5;
MODEL:
RIx BY x1@1 x2@1 x3@1 x4@1 x5@1;
RIy BY y1@1 y2@1 y3@1 y4@1 y5@1;
RIx WITH RIy;
wx1 BY x1@1;
wx2 BY x2@1;
wx3 BY x3@1;
wx4 BY x4@1;
wx5 BY x5@1;
wy1 BY y1@1;
wy2 BY y2@1;
wy3 BY y3@1;
wy4 BY y4@1;
wy5 BY y5@1;
x1-y5@0;
! 协变量添加语法
RIx RIy ON z1;
wx2 wy2 ON wx1 wy1;
wx3 wy3 ON wx2 wy2;
wx4 wy4 ON wx3 wy3;
wx5 wy5 ON wx4 wy4;
wx1 WITH wy1;
wx2 WITH wy2;
wx3 WITH wy3;
wx4 WITH wy4;
wx5 WITH wy5;
多组比较建模
Multigroup models test separate models in two or more discrete groups. Equality constraints across groups are used to conduct nested tests using likelihood ratio comparisons between a model with certain parameters constrained to be equal and a model with those same parameters freely estimated (allowed to differ) across the groups. For example, one can investigate whether means, predictive paths, or loadings differ across two nationalities.
VARIABLE: NAMES = x1-x5 y1-y5 GROUP;
GROUPING = GROUP (1=G1 2=G2);
MODEL: ! 随机截距部分
RIx BY x1@1 x2@1 x3@1 x4@1 x5@1;
RIy BY y1@1 y2@1 y3@1 y4@1 y5@1;
! 测量误差
wx1 BY x1@1;
wx2 BY x2@1;
wx3 BY x3@1;
wx4 BY x4@1;
wx5 BY x5@1;
wy1 BY y1@1;
wy2 BY y2@1;
wy3 BY y3@1;
wy4 BY y4@1;
wy5 BY y5@1;
x1-y5@0;
! 交叉滞后系数
wx2 wy2 ON wx1 wy1;
wx3 wy3 ON wx2 wy2;
wx4 wy4 ON wx3 wy3;
wx5 wy5 ON wx4 wy4;
! 随机截距共变
RIx WITH RIy(a);
! 同一波次的相关
wx1 WITH wy1;
wx2 WITH wy2;
wx3 WITH wy3;
wx4 WITH wy4;
wx5 WITH wy5;
MODEL G2:
RIx WITH RIy(b);
model test:
a = b;