TITLE: The basic RI-CLPM, 5 waves. DATA: FILE = RICLPM.dat; VARIABLE: NAMES = x1-x5 y1-y5; ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0; ! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1; wx3 wy3 ON wx2 wy2; wx4 wy4 ON wx3 wy3; wx5 wy5 ON wx4 wy4; ! Estimate covariance between random intercepts RIx WITH RIy; ! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
TITLE: The basic RI-CLPM, 5 waves. Constrain the grand means, (residual) variances, and lagged effects over time. DATA: FILE = RICLPM.dat; VARIABLE: NAMES = x1-x5 y1-y5; ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0; ! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1 (a b c d); wx3 wy3 ON wx2 wy2 (a b c d); wx4 wy4 ON wx3 wy3 (a b c d); wx5 wy5 ON wx4 wy4 (a b c d); ! Estimate covariance between random intercepts RIx WITH RIy; ! Estimate covariance between within-person components at the first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) and constrain these and residual variances to be ! invariant over time wx2 WITH wy2 (cov); wx2 (vx); wy2 (vy); wx3 WITH wy3 (cov); wx3 (vx); wy3 (vy); wx4 WITH wy4 (cov); wx4 (vx); wy4 (vy); wx5 WITH wy5 (cov); wx5 (vx); wy5 (vy);
! Constrain grand means to be invariant over time [x1 x2 x3 x4 x5] (mx); [y1 y2 y3 y4 y5] (my); OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
! Create within-components with freely estimated factor loadings wx1 BY x1*; wx2 BY x2*; wx3 BY x3*; wx4 BY x4*; wx5 BY x5*; wy1 BY y1*; wy2 BY y2*; wy3 BY y3*; wy4 BY y4*; wy5 BY y5*;
其次,我们将第一波的组内成分的方差设置为 1,并标记它们之间的协方差(现在也是相关性):
1 2 3 4 5
! Set variances of within-components at first wave to 1 wx1@1 wy1@1;
! Estimate correlation between within-components at first wave wx1 WITH wy1 (cor1);
第三,我们为每个组内成分之间的残差方差和协方差提供唯一的标签:
1 2 3 4
wx2 WITH wy2 (rcov2); wx2 (rvx2); wy2 (rvy2); wx3 WITH wy3 (rcov3); wx3 (rvx3); wy3 (rvy3); wx4 WITH wy4 (rcov4); wx4 (rvx4); wy4 (rvy4); wx5 WITH wy5 (rcov5); wx5 (rvx5); wy5 (rvy5);
最后,我们计算每个波中 组内成分本身 之间的相关性,然后约束残差方差以确保每个组内成分的总方差等于 1。 这在 MODEL CONSTRAINT 命令中完成:
TITLE: RI-CLPM, 5 waves, including a time-invariant predictor for the observed variables. DATA: FILE = RICLPM-Z.dat; VARIABLE: NAMES = x1-x5 y1-y5 z2 z1; USEVARIABLES = x1-y5 z1; ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Estimate covariance between random intercepts RIx WITH RIy; ! Create within-person centered variables 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;
! Constrain measurement error variances to 0 x1-y5@0;
! Regression of observed variables on z1 (unconstrained) x1-x5 ON z1 (s1); y1-y5 ON z1 (s2);
! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1; wx3 wy3 ON wx2 wy2; wx4 wy4 ON wx3 wy3; wx5 wy5 ON wx4 wy4;
! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
TITLE: RI-CLPM, 5 waves, including a time-invariant predictor for the random intercepts. DATA: FILE = RICLPM-Z.dat; VARIABLE: NAMES = x1-x5 y1-y5 z2 z1; USEVARIABLES = x1-y5 z1; ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Estimate covariance between random intercepts RIx WITH RIy; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0; ! Regression of random intercepts on z1 RIx RIy ON z1; ! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1; wx3 wy3 ON wx2 wy2; wx4 wy4 ON wx3 wy3; wx5 wy5 ON wx4 wy4; ! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
TITLE: RI-CLPM, 5 waves. Time-invariant predictor z1 for observed variables (constrained). Between components predicting time-invariant outcome z2. DATA: FILE = RICLPM-Z.dat; VARIABLE: NAMES = x1-x5 y1-y5 z2 z1; ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Estimate covariance between random intercepts RIx WITH RIy; ! Regres distal outcome on random intercepts z2 ON RIx RIy; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0; ! Regression of observed variables on z1 (constrained) x1-x5 ON z1 (s1); y1-y5 ON z1 (s2); ! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1; wx3 wy3 ON wx2 wy2; wx4 wy4 ON wx3 wy3; wx5 wy5 ON wx4 wy4; ! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
TITLE: RI-CLPM, 5 waves Time-invariant predictor z1 for observed variables (constrained). Within components predicting time-invariant outcome z2. DATA: FILE = RICLPM-Z.dat; VARIABLE: NAMES = x1-x5 y1-y5 z2 z1; ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between-components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1;
! Estimate covariance between random intercepts RIx WITH RIy; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0;
! Regres distal outcome on within components z2 ON wx1-wx5 wy1-wy5; ! Regression of observed variables on z1 (constrained) x1-x5 ON z1 (s1); y1-y5 ON z1 (s2);
! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1; wx3 wy3 ON wx2 wy2; wx4 wy4 ON wx3 wy3; wx5 wy5 ON wx4 wy4; ! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
:::
扩展 2:多组
使用下面的选项卡导航到基本多组模型的模型规范,或者具有约束滞后参数(以及跨组截距)的模型。
要指定多组 RI-CLPM,我们需要覆盖 Mplus 将施加的一些默认设置,这些默认设置与多组因子分析相关联。 这样做的原因是,当我们结合多组使用 BY 语句时,Mplus 会自动施加与强因子不变性相关联的默认设置 [@meredith_measurement_1993]。 这些默认设置是:
TITLE: Multiple group RI-CLPM, 5 waves. Overruling the Mplus multiple group factor analysis defaults. DATA: FILE = RICLPM-MG.dat; VARIABLE: NAMES = x1-x5 y1-y5 GROUP; GROUPING = GROUP (1=G1 2=G2); ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0; ! Estimate lagged effects between within-person centered variables wx2 wy2 ON wx1 wy1; wx3 wy3 ON wx2 wy2; wx4 wy4 ON wx3 wy3; wx5 wy5 ON wx4 wy4; ! Estimate covariance between random intercepts RIx WITH RIy; ! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; MODEL G2: ! Overrule multiple group factor analysis default of equal intercepts ! across groups [x1-y5]; ! Overrule multiple group factor analysis default of free latent means ! in second group [wx1-wy5@0]; [RIx@0 RIy@0]; OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
TITLE: Multiple group RI-CLPM, 5 waves, with equal lagged parameters across groups. Overruling the Mplus multiple group factor analysis defaults. DATA: FILE = RICLPM-MG.dat; VARIABLE: NAMES = x1-x5 y1-y5 GROUP; GROUPING = GROUP (1=G1 2=G2); ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero MODEL: ! Create between components (random intercepts) RIx BY x1@1 x2@1 x3@1 x4@1 x5@1; RIy BY y1@1 y2@1 y3@1 y4@1 y5@1; ! Create within-person centered variables 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; ! Constrain measurement error variances to 0 x1-y5@0; ! Estimate lagged effects between within-person centered variables ! (constrained across groups) wx2 wy2 ON wx1 wy1 (a1 b1 c1 d1); wx3 wy3 ON wx2 wy2 (a2 b2 c2 d2); wx4 wy4 ON wx3 wy3 (a3 b3 c3 d3); wx5 wy5 ON wx4 wy4 (a4 b4 c4 d4); ! Estimate covariance between random intercepts RIx WITH RIy; ! Estimate covariance between within-person components at first wave wx1 WITH wy1; ! Estimate covariances between residuals of within-person components ! (i.e., innovations) wx2 WITH wy2; wx3 WITH wy3; wx4 WITH wy4; wx5 WITH wy5; MODEL G2: ! Overrule multiple group factor analysis default of equal intercepts ! across groups [x1-y5]; ! Overrule multiple group factor analysis default of free latent means ! in second group [wx1-wy5@0]; [RIx@0 RIy@0];
! Estimate lagged effects between within-person centered variables ! (constrained across groups) wx2 wy2 ON wx1 wy1 (a1 b1 c1 d1); wx3 wy3 ON wx2 wy2 (a2 b2 c2 d2); wx4 wy4 ON wx3 wy3 (a3 b3 c3 d3); wx5 wy5 ON wx4 wy4 (a4 b4 c4 d4); OUTPUT: TECH1 STDYX SAMPSTAT CINTERVAL;
当我们有三个指标 $X$,在五个波中测量时,我们指定三个随机截距来捕获每个指标的特质部分,即 RIX1 BY x11@1 x21@1 ...;、RIX2 BY x12@1 x22@1 ...; 和 RIX3 BY x13@1 x23@1 ...;。 此外,我们指定五个组内成分来捕获每个波的状态部分,使用 WFX1 BY x11 x12 x13; WFX2 BY x21 x22 x23; ...。
在潜在的组内级别,我们使用 WFX2 ON WFY1 WFX1; WFX3 ON WFY2 WFX2; ... 在 Mplus 中指定动态模型。 此外,我们允许第一波的组内因子及其在后续波中的残差在每个波中是相关的,WFX1 WITH WFY1; WFX2 WITH WFY2; ...。 允许通过 RIX1-RIY3 WITH RIX1-RIY3; 自由地将六个随机截距彼此相关联。
```default TITLE: Multiple indicator RI-CLPM, 5 waves, with 3 indicators for each variable at each wave (30 observed variables) and with random intercepts for each indicator separately.
ANALYSIS: MODEL = NOCOV; ! Sets all default covariances to zero
MODEL: !!!!!!!!!!!!!!!! ! BETWEEN PART ! !!!!!!!!!!!!!!!!
! Create between factors (random intercepts) for each indicator separately
RIX1 BY x11@1 x21@1 x31@1 x41@1 x51@1;
RIX2 BY x12@1 x22@1 x32@1 x42@1 x52@1;
RIX3 BY x13@1 x23@1 x33@1 x43@1 x53@1;
RIY1 BY y11@1 y21@1 y31@1 y41@1 y51@1;
RIY2 BY y12@1 y22@1 y32@1 y42@1 y52@1;
RIY3 BY y13@1 y23@1 y33@1 y43@1 y53@1;
! Add covariances between all RIs
RIX1-RIY3 WITH RIX1-RIY3;
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! WITHIN PART: MEASUREMENT MODEL !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Due to having a random intercept per indicator, the measurement model
! is only on the within part of the measurements
! Factor models for X at 5 waves
WFX1 BY x11-x13;
WFX2 BY x21-x23;
WFX3 BY x31-x33;
WFX4 BY x41-x43;
WFX5 BY x51-x53;
! Factor models for Y at 5 waves
WFY1 BY y11-y13;
WFY2 BY y21-y23;
WFY3 BY y31-y33;
WFY4 BY y41-y43;
WFY5 BY y51-y53;
!!!!!!!!!!!!!!!!!!!!!!!!!
! WITHIN PART: DYNAMICS !
!!!!!!!!!!!!!!!!!!!!!!!!!
! Specify lagged effects between within-person centered latent variables
WFX2 WFY2 ON WFX1 WFY1;
WFX3 WFY3 ON WFX2 WFY2;
WFX4 WFY