Where to learn more

McArdle, J. (2009). Latent variable modeling of differences and changes with longitudinal data. Annual Review of Psychology, 60, 577-605.

Serang, S., Grimm, K. J., & Zhang, Z. (2019). On the correspondence between the latent growth curve and latent change score models. Structural Equation Modeling: A Multidisciplinary Journal, 26(4), 623-635.

Dual Change Score Model

Shape of the curve driven by \(\beta\)

\(\beta\) Equilibrium Implication Typical trajectory
\(\beta>0\) Exists but unstable Proportional change, exponential growth or decay away from a equilibrium point (\(-s/b\)) Moves away from equilibrium, monotone, no oscillation
\(\beta=0\) None (unless \(s=0\)) Constant change, linear growth or decay Straight line
\(-1<\beta<0\) Stable \(y^* = -s/b\) Proportional change, exponential monotone decay toward an equilibrium point Monotone decay toward equilibrium
\(-2<\beta<-1\) Stable Converges to equilibrium, oscillates around (\(-s/b\)) Damped oscillation toward equilibrium
\(\beta<-2\) Unstable Diverges with oscillation Growing flips around equilibrium

Equilibrium value for y is \(y^* = -s/\beta\) and if \(y\) ever reached this value the change would be 0 and \(y\) would remain at this value. Related to an asymptote. Unstable equilibrium means that if \(y\) is perturbed away from this value it will move further away. Stable means that if \(y\) is perturbed away from this value it will move back toward it.

Baseline–Change Association

In a Dual Chnge Score Model (DCSM), the baseline-change association has a dual nature: a between-person component (\(\text{Cov}(y_0, s)\)) and a within-person component (\(\beta\)). The random effects covariance \(\text{Cov}(y_0, s)\) parameter captures the correlation between the baseline level (\(y_0\)) and constant change component (\(s\)). Although they are both random effects, this effect is at the “between-person” level in a multilevel framework. The covariance \(\text{Cov}(y_0, s)\) tells us whether individuals who start higher also tend to have faster/slower long-run slopes. This is the between-person piece, describing population heterogeneity.

The dynamic feedback parameter (\(\beta\)) captures the structural regression of a person’s current level on their own subsequent change. It is interpreted as a within-person dynamic: does being higher now predict more or less change next time? Unlike the LGCM, where such dynamics are absorbed into the intercept–slope covariance, the DCSM models them explicitly. The recursion multiplier means that even though \(\beta\) is fixed across individuals, the effect of \(\beta\) on change varies as a function of the individual’s prior level of y.

In contrast, unconditional linear growth curve model (LGCM), the correlation between baseline and change is captured in one model parameter: the covariance between intercept and slope (\(\text{Cov}(i,s)\)). This is a between-persons effect.

However in practice, the constant change component and the proportional change parameter in the DCSM are often highly correlated, sometimes nearly collinear. This means the dual nature of baseline–change correlation is not always empirically separable. More time points, smaller proportional change values, and constant change means near zero reduce the problem; few time points and extreme constant change means exacerbate it (Jacobucci R et al. Structural Equation Modeling: A Multidisciplinary Journal. 2019:26(6);924-930).

LDSM.EXE

LDSM.EXE is a Windows program that generates Mplus code for latent difference score models (LDSM), including dual change score models (DCSM).

!*********************************************!
!This M+ latent difference score model scripts!
!are generated by LDSM generator.             !
!*********************************************!
MODEL:
!For the variable y
!Observed variables and latent level
ly1 by y1 @1;
ly2 by y2 @1;
ly3 by y3 @1;
!Autoregressive part
ly2 on ly1 @1;
ly3 on ly2 @1;
!Difference score on latent level
dy1 by ly2 @1;
dy2 by ly3 @1;
!Auto-proportion of difference score on level
dy1 on ly1 * (1);
dy2 on ly2 * (1);
!Model relationship between slope and ds
sy by dy1 @1;
sy by dy2 @1;
y0 by ly1 @1;
!Set the means and variance to be 0
[y1@0]; [ly1@0]; [dy1@0]; ly1@0; dy1@0;
[y2@0]; [ly2@0]; [dy2@0]; ly2@0; dy2@0;
[y3@0]; [ly3@0];ly3@0;
!Estimate means and variances for intercept and slope
[y0 sy];
y0 sy;
!Set all item-level residuals to be equal
y1* (2);
y2* (2);
y3* (2);

DCSM of MSQTOT in EPESE

  • MSQTOT assessed at baseline, +3 years, and +6 years
  • Scores on 0-6 scale, higher score is more correct answers
Mplus VERSION 8.11 (Mac)
MUTHEN & MUTHEN
09/08/2025   7:02 AM

INPUT INSTRUCTIONS

  TITLE:    DCSM, MSQ sum scores from EPESE
            Input from LDSM.EXE
            y1, y2, and y3 are MSQTOT at wave 1, 4, and 7

  DATA:     FILE = ex0201.dat;

  VARIABLE: NAMES = y1 y2 y3 ; ! msqtot1 msqtot4 msqtot7 age black ;
            MISSING  = ALL (-9999) ;

  OUTPUT:   TECH1 ;
            TECH4 ;

  SAVEDATA: SAVE = FSCORES ;
            FILE = ex0399.dat ;

  MODEL:
            !For the variable y
            !Observed variables and latent level
               ly1 by y1 @1;
               ly2 by y2 @1;
               ly3 by y3 @1;
            !Autoregressive part
               ly2 on ly1 @1;
               ly3 on ly2 @1;
            !Difference score on latent level
               dy1 by ly2 @1;
               dy2 by ly3 @1;
            !Auto-proportion of difference score on level
               dy1 on ly1 * (1);
               dy2 on ly2 * (1);
            !Model relationship between slope and ds
               sy by dy1 @1;
               sy by dy2 @1;
               y0 by ly1 @1;
            ! Set the means and variance to be 0
               [y1@0]; [ly1@0]; [dy1@0]; ly1@0; dy1@0;
               [y2@0]; [ly2@0]; [dy2@0]; ly2@0; dy2@0;
               [y3@0]; [ly3@0];ly3@0;
            !Estimate means and variances for intercept and slope
               [y0 sy];
               y0 sy;
            !Set all residuals to be equal
               y1* (2);
               y2* (2);
               y3* (2);



*** WARNING
  Data set contains cases with missing on all variables.
  These cases were not included in the analysis.
  Number of cases with missing on all variables:  397
   1 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS



DCSM, MSQ sum scores from EPESE
Input from LDSM.EXE
y1, y2, and y3 are MSQTOT at wave 1, 4, and 7

SUMMARY OF ANALYSIS

Number of groups                                                 1
Number of observations                                       14059

Number of dependent variables                                    3
Number of independent variables                                  0
Number of continuous latent variables                            7

Observed dependent variables

  Continuous
   Y1          Y2          Y3

Continuous latent variables
   LY1         LY2         LY3         DY1         DY2         SY
   Y0


Estimator                                                       ML
Information matrix                                        OBSERVED
Maximum number of iterations                                  1000
Convergence criterion                                    0.500D-04
Maximum number of steepest descent iterations                   20
Maximum number of iterations for H1                           2000
Convergence criterion for H1                             0.100D-03

Input data file(s)
  ex0201.dat

Input data format  FREE


SUMMARY OF DATA

     Number of missing data patterns             7


COVARIANCE COVERAGE OF DATA

Minimum covariance coverage value   0.100

     PROPORTION OF DATA PRESENT

           Covariance Coverage
              Y1            Y2            Y3
              ________      ________      ________
 Y1             0.974
 Y2             0.752         0.775
 Y3             0.565         0.561         0.581



UNIVARIATE SAMPLE STATISTICS

     UNIVARIATE HIGHER-ORDER MOMENT DESCRIPTIVE STATISTICS

         Variable/         Mean/     Skewness/   Minimum/ % with                Percentiles
        Sample Size      Variance    Kurtosis    Maximum  Min/Max      20%/60%    40%/80%    Median

     Y1                    4.768      -1.152       0.000    0.70%       4.000      5.000      5.000
           13698.000       1.621       1.156       6.000   34.84%       5.000      6.000
     Y2                    4.732      -1.233       0.000    1.17%       4.000      5.000      5.000
           10899.000       1.822       1.268       6.000   35.05%       5.000      6.000
     Y3                    4.569      -1.160       0.000    2.00%       4.000      5.000      5.000
            8169.000       2.033       1.060       6.000   30.31%       5.000      6.000


THE MODEL ESTIMATION TERMINATED NORMALLY



MODEL FIT INFORMATION

Number of Free Parameters                        7

Loglikelihood

          H0 Value                      -52686.644
          H1 Value                      -52661.224

Information Criteria

          Akaike (AIC)                  105387.289
          Bayesian (BIC)                105440.146
          Sample-Size Adjusted BIC      105417.901
            (n* = (n + 2) / 24)

Chi-Square Test of Model Fit

          Value                             50.840
          Degrees of Freedom                     2
          P-Value                           0.0000

RMSEA (Root Mean Square Error Of Approximation)

          Estimate                           0.042
          90 Percent C.I.                    0.032  0.052
          Probability RMSEA <= .05           0.906

CFI/TLI

          CFI                                0.993
          TLI                                0.989

Chi-Square Test of Model Fit for the Baseline Model

          Value                           6609.379
          Degrees of Freedom                     3
          P-Value                           0.0000

SRMR (Standardized Root Mean Square Residual)

          Value                              0.034



MODEL RESULTS

                                                    Two-Tailed
                    Estimate       S.E.  Est./S.E.    P-Value

 LY1      BY
    Y1                 1.000      0.000    999.000    999.000

 LY2      BY
    Y2                 1.000      0.000    999.000    999.000

 LY3      BY
    Y3                 1.000      0.000    999.000    999.000

 DY1      BY
    LY2                1.000      0.000    999.000    999.000

 DY2      BY
    LY3                1.000      0.000    999.000    999.000

 SY       BY
    DY1                1.000      0.000    999.000    999.000
    DY2                1.000      0.000    999.000    999.000

 Y0       BY
    LY1                1.000      0.000    999.000    999.000

 LY2      ON
    LY1                1.000      0.000    999.000    999.000

 LY3      ON
    LY2                1.000      0.000    999.000    999.000

 DY1      ON
    LY1                0.617      0.144      4.274      0.000

 DY2      ON
    LY2                0.617      0.144      4.274      0.000

 Y0       WITH
    SY                -0.497      0.134     -3.716      0.000

 Means
    SY                -3.103      0.682     -4.552      0.000
    Y0                 4.782      0.011    448.388      0.000

 Intercepts
    Y1                 0.000      0.000    999.000    999.000
    Y2                 0.000      0.000    999.000    999.000
    Y3                 0.000      0.000    999.000    999.000
    LY1                0.000      0.000    999.000    999.000
    LY2                0.000      0.000    999.000    999.000
    LY3                0.000      0.000    999.000    999.000
    DY1                0.000      0.000    999.000    999.000
    DY2                0.000      0.000    999.000    999.000

 Variances
    SY                 0.328      0.139      2.353      0.019
    Y0                 0.902      0.021     43.107      0.000

 Residual Variances
    Y1                 0.759      0.011     66.171      0.000
    Y2                 0.759      0.011     66.171      0.000
    Y3                 0.759      0.011     66.171      0.000
    LY1                0.000      0.000    999.000    999.000
    LY2                0.000      0.000    999.000    999.000
    LY3                0.000      0.000    999.000    999.000
    DY1                0.000      0.000    999.000    999.000
    DY2                0.000      0.000    999.000    999.000


QUALITY OF NUMERICAL RESULTS

     Condition Number for the Information Matrix              0.370E-05
       (ratio of smallest to largest eigenvalue)


TECHNICAL 1 OUTPUT

     PARAMETER SPECIFICATION

           NU
              Y1            Y2            Y3
              ________      ________      ________
                  0             0             0

           LAMBDA
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 Y1                 0             0             0             0             0
 Y2                 0             0             0             0             0
 Y3                 0             0             0             0             0

           LAMBDA
              SY            Y0
              ________      ________
 Y1                 0             0
 Y2                 0             0
 Y3                 0             0

           THETA
              Y1            Y2            Y3
              ________      ________      ________
 Y1                 1
 Y2                 0             1
 Y3                 0             0             1

           ALPHA
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
                  0             0             0             0             0

           ALPHA
              SY            Y0
              ________      ________
                  2             3

           BETA
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1                0             0             0             0             0
 LY2                0             0             0             0             0
 LY3                0             0             0             0             0
 DY1                4             0             0             0             0
 DY2                0             4             0             0             0
 SY                 0             0             0             0             0
 Y0                 0             0             0             0             0

           BETA
              SY            Y0
              ________      ________
 LY1                0             0
 LY2                0             0
 LY3                0             0
 DY1                0             0
 DY2                0             0
 SY                 0             0
 Y0                 0             0

           PSI
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1                0
 LY2                0             0
 LY3                0             0             0
 DY1                0             0             0             0
 DY2                0             0             0             0             0
 SY                 0             0             0             0             0
 Y0                 0             0             0             0             0

           PSI
              SY            Y0
              ________      ________
 SY                 5
 Y0                 6             7

     STARTING VALUES

           NU
              Y1            Y2            Y3
              ________      ________      ________
                0.000         0.000         0.000

           LAMBDA
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 Y1             1.000         0.000         0.000         0.000         0.000
 Y2             0.000         1.000         0.000         0.000         0.000
 Y3             0.000         0.000         1.000         0.000         0.000

           LAMBDA
              SY            Y0
              ________      ________
 Y1             0.000         0.000
 Y2             0.000         0.000
 Y3             0.000         0.000

           THETA
              Y1            Y2            Y3
              ________      ________      ________
 Y1             0.810
 Y2             0.000         0.911
 Y3             0.000         0.000         1.016

           ALPHA
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
                0.000         0.000         0.000         0.000         0.000

           ALPHA
              SY            Y0
              ________      ________
                0.000         0.000

           BETA
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.000         0.000         0.000         0.000         0.000
 LY2            1.000         0.000         0.000         1.000         0.000
 LY3            0.000         1.000         0.000         0.000         1.000
 DY1            0.000         0.000         0.000         0.000         0.000
 DY2            0.000         0.000         0.000         0.000         0.000
 SY             0.000         0.000         0.000         0.000         0.000
 Y0             0.000         0.000         0.000         0.000         0.000

           BETA
              SY            Y0
              ________      ________
 LY1            0.000         1.000
 LY2            0.000         0.000
 LY3            0.000         0.000
 DY1            1.000         0.000
 DY2            1.000         0.000
 SY             0.000         0.000
 Y0             0.000         0.000

           PSI
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.000
 LY2            0.000         0.000
 LY3            0.000         0.000         0.000
 DY1            0.000         0.000         0.000         0.000
 DY2            0.000         0.000         0.000         0.000         0.000
 SY             0.000         0.000         0.000         0.000         0.000
 Y0             0.000         0.000         0.000         0.000         0.000

           PSI
              SY            Y0
              ________      ________
 SY             0.050
 Y0             0.000         0.050


TECHNICAL 4 OUTPUT

     ESTIMATES DERIVED FROM THE MODEL

           ESTIMATED MEANS FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
                4.782         4.631         4.386        -0.151        -0.245

           ESTIMATED MEANS FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
               -3.103         4.782

           S.E. FOR ESTIMATED MEANS FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
                0.011         0.012         0.016         0.010         0.013

           S.E. FOR ESTIMATED MEANS FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
                0.682         0.011

           EST./S.E. FOR ESTIMATED MEANS FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
              448.388       394.210       275.395       -15.793       -18.578

           EST./S.E. FOR ESTIMATED MEANS FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
               -4.552       448.388

           TWO-TAILED P-VALUE FOR ESTIMATED MEANS FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
                0.000         0.000         0.000         0.000         0.000

           TWO-TAILED P-VALUE FOR ESTIMATED MEANS FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
                0.000         0.000

           ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.902
 LY2            0.962         1.080
 LY3            1.059         1.271         1.615
 DY1            0.060         0.118         0.213         0.058
 DY2            0.097         0.191         0.344         0.094         0.153
 SY            -0.497        -0.475        -0.441         0.021         0.035
 Y0             0.902         0.962         1.059         0.060         0.097

           ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             0.328
 Y0            -0.497         0.902

           S.E. FOR ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.021
 LY2            0.018         0.022
 LY3            0.023         0.027         0.041
 DY1            0.009         0.012         0.018         0.010
 DY2            0.016         0.012         0.022         0.010         0.017
 SY             0.134         0.148         0.171         0.018         0.027
 Y0             0.021         0.018         0.023         0.009         0.016

           S.E. FOR ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             0.139
 Y0             0.134         0.021

           EST./S.E. FOR ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1           43.107
 LY2           53.199        50.236
 LY3           46.331        47.044        39.626
 DY1            6.657        10.152        11.839         6.089
 DY2            6.153        15.811        15.494         9.333         9.154
 SY            -3.716        -3.203        -2.583         1.166         1.275
 Y0            43.107        53.199        46.331         6.657         6.153

           EST./S.E. FOR ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             2.353
 Y0            -3.716        43.107

           TWO-TAILED P-VALUE FOR ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.000
 LY2            0.000         0.000
 LY3            0.000         0.000         0.000
 DY1            0.000         0.000         0.000         0.000
 DY2            0.000         0.000         0.000         0.000         0.000
 SY             0.000         0.001         0.010         0.244         0.202
 Y0             0.000         0.000         0.000         0.000         0.000

           TWO-TAILED P-VALUE FOR ESTIMATED COVARIANCE MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             0.019
 Y0             0.000         0.000

           ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            1.000
 LY2            0.974         1.000
 LY3            0.877         0.963         1.000
 DY1            0.261         0.471         0.693         1.000
 DY2            0.261         0.471         0.693         1.000         1.000
 SY            -0.913        -0.799        -0.605         0.155         0.155
 Y0             1.000         0.974         0.877         0.261         0.261

           ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             1.000
 Y0            -0.913         1.000

           S.E. FOR ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.000
 LY2            0.005         0.000
 LY3            0.015         0.005         0.000
 DY1            0.050         0.035         0.019         0.000
 DY2            0.050         0.035         0.019         0.000         0.000
 SY             0.051         0.086         0.112         0.147         0.147
 Y0             0.000         0.005         0.015         0.050         0.050

           S.E. FOR ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             0.000
 Y0             0.051         0.000

           EST./S.E. FOR ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1          999.000
 LY2          214.409       999.000
 LY3           57.189       189.614       999.000
 DY1            5.209        13.417        36.841       999.000
 DY2            5.209        13.417        36.841   ***********       999.000
 SY           -17.849        -9.308        -5.423         1.052         1.052
 Y0       ***********       214.409        57.189         5.209         5.209

           EST./S.E. FOR ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY           999.000
 Y0           -17.849       999.000

           TWO-TAILED P-VALUE FOR ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              LY1           LY2           LY3           DY1           DY2
              ________      ________      ________      ________      ________
 LY1            0.000
 LY2            0.000         0.000
 LY3            0.000         0.000         0.000
 DY1            0.000         0.000         0.000         0.000
 DY2            0.000         0.000         0.000         0.000         0.000
 SY             0.000         0.000         0.000         0.293         0.293
 Y0             0.000         0.000         0.000         0.000         0.000

           TWO-TAILED P-VALUE FOR ESTIMATED CORRELATION MATRIX FOR THE LATENT VARIABLES
              SY            Y0
              ________      ________
 SY             0.000
 Y0             0.000         0.000


SAMPLE STATISTICS FOR ESTIMATED FACTOR SCORES

     SAMPLE STATISTICS

           Means
              LY1           LY1_SE        LY2           LY2_SE        LY3
              ________      ________      ________      ________      ________
                4.782         0.513         4.631         0.530         4.386

           Means
              LY3_SE        DY1           DY1_SE        DY2           DY2_SE
              ________      ________      ________      ________      ________
                0.704        -0.151         0.210        -0.245         0.340

           Means
              SY            SY_SE         Y0            Y0_SE
              ________      ________      ________      ________
               -3.103         0.398         4.782         0.513

           Covariances
              LY1           LY1_SE        LY2           LY2_SE        LY3
              ________      ________      ________      ________      ________
 LY1            0.634
 LY1_SE        -0.011         0.005
 LY2            0.704        -0.012         0.788
 LY2_SE        -0.019         0.008        -0.021         0.012
 LY3            0.817        -0.014         0.923        -0.023         1.095
 LY3_SE        -0.028         0.011        -0.031         0.017        -0.035
 DY1            0.070        -0.001         0.084        -0.002         0.106
 DY1_SE        -0.003         0.001        -0.004         0.002        -0.004
 DY2            0.113        -0.002         0.135        -0.003         0.172
 DY2_SE        -0.005         0.002        -0.006         0.003        -0.007
 SY            -0.321         0.006        -0.351         0.010        -0.398
 SY_SE         -0.002         0.001        -0.002         0.001        -0.002
 Y0             0.634        -0.011         0.704        -0.019         0.817
 Y0_SE         -0.011         0.005        -0.012         0.008        -0.014

           Covariances
              LY3_SE        DY1           DY1_SE        DY2           DY2_SE
              ________      ________      ________      ________      ________
 LY3_SE         0.024
 DY1           -0.002         0.014
 DY1_SE         0.003         0.000         0.000
 DY2           -0.004         0.022        -0.001         0.036
 DY2_SE         0.004        -0.001         0.001        -0.001         0.001
 SY             0.015        -0.029         0.002        -0.047         0.003
 SY_SE          0.002         0.000         0.000         0.000         0.000
 Y0            -0.028         0.070        -0.003         0.113        -0.005
 Y0_SE          0.011        -0.001         0.001        -0.002         0.002

           Covariances
              SY            SY_SE         Y0            Y0_SE
              ________      ________      ________      ________
 SY             0.169
 SY_SE          0.001         0.000
 Y0            -0.321        -0.002         0.634
 Y0_SE          0.006         0.001        -0.011         0.005

           Correlations
              LY1           LY1_SE        LY2           LY2_SE        LY3
              ________      ________      ________      ________      ________
 LY1            1.000
 LY1_SE        -0.202         1.000
 LY2            0.996        -0.196         1.000
 LY2_SE        -0.218         0.987        -0.212         1.000
 LY3            0.981        -0.187         0.994        -0.202         1.000
 LY3_SE        -0.226         0.958        -0.220         0.992        -0.211
 DY1            0.746        -0.111         0.802        -0.125         0.862
 DY1_SE        -0.233         0.884        -0.228         0.946        -0.220
 DY2            0.746        -0.111         0.802        -0.125         0.862
 DY2_SE        -0.233         0.884        -0.228         0.946        -0.220
 SY            -0.982         0.210        -0.961         0.224        -0.925
 SY_SE         -0.141         0.888        -0.135         0.808        -0.127
 Y0             1.000        -0.202         0.996        -0.218         0.981
 Y0_SE         -0.202         1.000        -0.196         0.987        -0.187

           Correlations
              LY3_SE        DY1           DY1_SE        DY2           DY2_SE
              ________      ________      ________      ________      ________
 LY3_SE         1.000
 DY1           -0.134         1.000
 DY1_SE         0.978        -0.145         1.000
 DY2           -0.134         1.000        -0.145         1.000
 DY2_SE         0.978        -0.145         1.000        -0.145         1.000
 SY             0.232        -0.605         0.236        -0.605         0.236
 SY_SE          0.731        -0.069         0.612        -0.069         0.612
 Y0            -0.226         0.746        -0.233         0.746        -0.233
 Y0_SE          0.958        -0.111         0.884        -0.111         0.884

           Correlations
              SY            SY_SE         Y0            Y0_SE
              ________      ________      ________      ________
 SY             1.000
 SY_SE          0.148         1.000
 Y0            -0.982        -0.141         1.000
 Y0_SE          0.210         0.888        -0.202         1.000


SAVEDATA INFORMATION


  Save file
    ex0399.dat

  Order and format of variables

    Y1             F10.3
    Y2             F10.3
    Y3             F10.3
    LY1            F10.3
    LY1_SE         F10.3
    LY2            F10.3
    LY2_SE         F10.3
    LY3            F10.3
    LY3_SE         F10.3
    DY1            F10.3
    DY1_SE         F10.3
    DY2            F10.3
    DY2_SE         F10.3
    SY             F10.3
    SY_SE          F10.3
    Y0             F10.3
    Y0_SE          F10.3

  Save file format
    17F10.3

  Save file record length    10000

  Save missing symbol        *

     Beginning Time:  07:02:05
        Ending Time:  07:02:05
       Elapsed Time:  00:00:00



MUTHEN & MUTHEN
3463 Stoner Ave.
Los Angeles, CA  90066

Tel: (310) 391-9971
Fax: (310) 391-8971
Web: www.StatModel.com
Support: Support@StatModel.com

Copyright (c) 1998-2024 Muthen & Muthen

Scroll down to see the entire Mplus output

Using R to explore the output and results

  • MplusAutomation package commands to extract information about the model and results
  • Load the savedata file and plot the estimated latent trajectories

Load the data in the SAVEDATA file

I have a program to do this on my GitHub (rnj0nes/RNJmisc::runmplus_load_savedata.R)

This program will read the OUT file, find the name and contents of the SAVEDATA file, and read that file into R.

Also contents.r is a program to provide a summary of a data frame, and eme.r will be discussed in the Appendix.

library(dplyr)
library(tidyr)
library(ggplot2)
# RNJMisc programs
f1 <- "runmplus_load_savedata.R"
f2 <- "contents.r"
f3 <- "eme.r"
rnjmisc_url <- "https://raw.githubusercontent.com/rnj0nes/RNJmisc/master/"
devtools::source_url(paste0(rnjmisc_url, f1))
devtools::source_url(paste0(rnjmisc_url, f2))
devtools::source_url(paste0(rnjmisc_url, f3))
# Read SAVEDATA from LDSM
res <- runmplus_load_savedata("ex0399.out")
df <- res$data 

contents of df (the SAVEDATA file)

Variable N Mean SD Min Max
y1 13698 4.768 1.273 0.000 6.000
y2 10899 4.732 1.350 0.000 6.000
y3 8169 4.569 1.426 0.000 6.000
ly1 14059 4.782 0.796 1.474 5.765
ly1_se 14059 0.513 0.071 0.461 0.656
ly2 14059 4.631 0.888 0.992 5.749
ly2_se 14059 0.529 0.109 0.445 0.723
ly3 14059 4.386 1.046 0.213 5.723
ly3_se 14059 0.705 0.156 0.580 0.970
dy1 14059 -0.151 0.118 -0.674 0.107
dy1_se 14059 0.210 0.018 0.195 0.237
dy2 14059 -0.245 0.190 -1.090 0.173
dy2_se 14059 0.340 0.029 0.316 0.384
sy 14059 -3.103 0.411 -3.574 -1.392
sy_se 14059 0.398 0.017 0.389 0.496
y0 14059 4.782 0.796 1.474 5.765
y0_se 14059 0.513 0.071 0.461 0.656

y1-y3 are the observed MSQTOT scores at waves 1, 4, and 7. Everything else is a latent variable or factor score estimate, or a derivation of a factor score (the standard errors, XXX_se). Notice the sample sizes show missing data by death and attrition for the observed variables, but not for the latent variables (which are estimated for all persons).

The ly variables are the estimated true scores at each time point. Their _se variables are estimates of the standard errors of measurement for these factor scores, and are analogous to the standard deviations of the posterior distribution of the factor scores given the model and the data, where the factor score estimates are the means of these posterior distributions.

The dy variables are estimated latent difference scores, y0 is the estimated intercept, and sy is the estimated slope factor score.

Plots

We will make two plots. The first is a spaghetti plot of the estimated true scores (ly1, ly2, ly3) over time, with the mean curve overlaid. The second plot is a histogram of the person × occasion residuals (the differences between the observed scores and the estimated true scores).

Both of these will require data in “long” format, so we will reshape the data frame.

# Reshape wide to long
# df$ly1, ly2, and ly3 are the expected values 
df_long <- df %>%
   select(y1:y3, ly1, ly2, ly3) %>% 
   mutate(id = row_number()) %>%         # step 1: row identifier
   pivot_longer(
      cols = c(y1:y3, ly1:ly3),          # step 2: reshape
      names_to = c(".value", "obs"),     # split into 'y'/'ly' and 'obs'
      names_pattern = "([a-z]+)([0-9]+)"
   ) %>%
   arrange(id, obs)
head(df_long)
# A tibble: 6 × 4
     id obs       y    ly
  <int> <chr> <dbl> <dbl>
1     1 1         4  4.36
2     1 2        NA  4.18
3     1 3        NA  3.89
4     2 1         4  4.64
5     2 2         5  4.51
6     2 3        NA  4.31

With the reshaped data we can easily compute correlations and R-squared values.

vars <- c("y", "ly")
cor_matrix <- cor(df_long[vars], use = "pairwise.complete.obs")
print(format(round(cor_matrix, 2), nsmall = 2, trim = TRUE))
   y      ly    
y  "1.00" "0.89"
ly "0.89" "1.00"
r_sq <- cor_matrix["y", "ly"]^2
cat("R-squared:", round(r_sq, 2), "\n")
R-squared: 0.78 

In the spaghetti plot we will overlay the mean curve from the data (in red) and the expected mean curve implied by the estimated parameters of the model (in blue). We can compute the expected means from the estimated parameters in the Mplus output. This provides a check on my understanding of the model, as these two curves should overlap exactly. In this code I use model parameters copied from the Mplus output, but it would have been better to extract them using MplusAutomation functions. I will demonstrate that in an appendix.

# ensure obs is numeric (pivot_longer often makes it character)
df_long <- df_long %>% mutate(obs = as.integer(obs))

# Extract from Mplus output 
mean_y0    <- 4.782  # mean of "y0" from Mplus output
beta       <- 0.617  # beta from Mplus output (Dy on Ly)
mean_sy    <- -3.103 # mean of "sy" from Mplus output
# Three different ways to compute the implied means all are equal
# implied_y1 <- mean_y0 # mean of "Y0" from Mplus output
# implied_y2 <- implied_y1 + beta*implied_y1 + mean_sy
# another way  
# implied_y3 <- implied_y2 * (1 + beta) + mean_sy
# closed form showing proportional (~exponential) and linear change
implied_y1 <- (1 + beta)^(1-1) * (mean_y0 + mean_sy/beta) - (mean_sy/beta)
implied_y2 <- (1 + beta)^(2-1) * (mean_y0 + mean_sy/beta) - (mean_sy/beta)
implied_y3 <- (1 + beta)^(3-1) * (mean_y0 + mean_sy/beta) - (mean_sy/beta)

# expected means data
expected_df <- tibble::tibble(
   obs = c(1L, 2L, 3L),
   mu  = c(implied_y1, implied_y2 , implied_y3)
)

# mean curve by obs
mean_curve <- df_long %>%
   group_by(obs) %>%
   summarize(ly_bar = mean(ly, na.rm = TRUE), .groups = "drop")

Scroll down to see the entire code chunk

Code for the spaghetti plot using ggplot2.

spagplot <- ggplot(df_long, aes(x = obs, y = ly, group = id)) +
   geom_line(alpha = 0.01, linewidth = 0.3) + # spaghetti
   geom_point(alpha = 0.01, size = 0.6) +     # optional points
   
   # data mean curve (red)
   geom_line(
      data = mean_curve,
      aes(x = obs, y = ly_bar, group = 1),
      linewidth = 3.1, color = "red", inherit.aes = FALSE
   ) +
   
   # expected mean curve (blue)
   geom_line(
      data = expected_df,
      aes(x = obs, y = mu, group = 1),
      linewidth = 1.1, color = "blue", inherit.aes = FALSE
   ) +
   geom_point(
      data = expected_df,
      aes(x = obs, y = mu),
      size = 0.6 , color = "blue", inherit.aes = FALSE
   ) +
   
   scale_x_continuous(breaks = sort(unique(df_long$obs))) +
   labs(x = "obs", y = "ly", title = "Spaghetti plot of ly by obs") +
   theme_minimal()

Scroll down to see the entire code chunk

Each line is one persons estimated trajectory of the “true score” (ly) over time. The thick red line is the mean of the estimated true scores at each time point. The blue line is the expected mean trajectory implied by the estimated parameters of the model. The fact that these overlap exactly provides a check on my understanding of the model. The observed and model-implied means are identical because there are no covariates and there is no missing data.

Code for the plot of person × occasion residuals.

df_long <- df_long %>%
   mutate(diff = y - ly)   # new variable: difference

residhist <- ggplot(df_long, aes(x = diff)) +
   geom_histogram(bins = 30, color = "white") +
   labs(x = "Difference (y - ly)", y = "Count",
        title = "Histogram of person × occasion residuals") +
   theme_minimal()

Appendix: Extracting parameters from Mplus output

Here we show how to extract the estimated parameters from the Mplus output using MplusAutomation functions. This is better than copying and pasting numbers from the output, as it is less error-prone and can be automated.

Even better would be to run Mplus from R using MplusAutomation functions, and use the H5RESULTS to get parameter estimates, but that is for another time.

Assume we have already run the model and have the output file ex0399.out.

library(MplusAutomation)
# read the Mplus output file
out <- MplusAutomation::readModels("ex0399.out")
# extract and view the parameter estimates
params <- out$parameters$unstandardized
head(params)
  paramHeader param est se est_se pval
1      LY1.BY    Y1   1  0    999  999
2      LY2.BY    Y2   1  0    999  999
3      LY3.BY    Y3   1  0    999  999
4      DY1.BY   LY2   1  0    999  999
5      DY2.BY   LY3   1  0    999  999
6       SY.BY   DY1   1  0    999  999

Let’s just look at the parameters that are really estimates, defined by having a standard error.

# let's at those entries in params with SE > 0
params |> dplyr::filter(se>0) |> head(n=sum(params$se > 0))
          paramHeader param    est    se  est_se  pval
1              DY1.ON   LY1  0.617 0.144   4.274 0.000
2              DY2.ON   LY2  0.617 0.144   4.274 0.000
3             Y0.WITH    SY -0.497 0.134  -3.716 0.000
4               Means    SY -3.103 0.682  -4.552 0.000
5               Means    Y0  4.782 0.011 448.388 0.000
6           Variances    SY  0.328 0.139   2.353 0.019
7           Variances    Y0  0.902 0.021  43.107 0.000
8  Residual.Variances    Y1  0.759 0.011  66.171 0.000
9  Residual.Variances    Y2  0.759 0.011  66.171 0.000
10 Residual.Variances    Y3  0.759 0.011  66.171 0.000

Pull the mean of y0 into an object in R:

mean_y0 <- params |> dplyr::filter(paramHeader == "Means" & param == "Y0") |> pull(est)
mean_y0
[1] 4.782

That code is not hard but I do have a helper function to make it easier. This function is in my RNJmisc repo on GitHub, and it’s called eme.r.

# this creates an object in the R environment called means_y0 (if 
# there is a matching entry in `params`. Note the case insensitivity
# of the function. Syntax is eme(params_object, "paramHeader", "param")
eme(params, "means", "y0")
   paramHeader param   est    se  est_se pval
15       Means    Y0 4.782 0.011 448.388    0
means_y0$est
[1] 4.782
means_y0$se
[1] 0.011
# and if your guess at the name is not close you'll get a message
# and some help
eme(params, "y0_with","sy")
No exact match for paramHeader = 'y0_with', param = 'sy'.
Did you mean one of these (original case & punctuation preserved)?
 paramHeader param
     Y0.WITH    SY

(fin)