Monday, February 4, 2019

Latent change score model in Mplus

A similar post was done for R, and here's an Mplus code; requests for such simple code come along periodically.
It is for 2 waves only, with 1 indicator latents (and with measurement error estimated for both 'cause' and 'effect' sets of variables: yes, it runs!), and for observed variables only. It was posted on SEMNET, and there is a lot more on this 'change modeling' (another posting on Semnet sends to lots of materials, full texts too).

Try it on your data (no changes needed: just add your own variable names in DEFINE), and let me know what you see in your data, in one of mine I saw the SIGN of the effect flipping when using latents!!!

1. With LVs
  DEFINE:
  X1 = YourXatTime1;
      X2 = YourXatTime2;
  Y1 = YourYatTime1;
      Y2 = YourYatTime2;

  MODEL:
  !X part
  ! first create LV behind each observed indicator:
  ! time 1
  LX1 by X1; ! define new 1 indicator LV
  [X1@0] ; ! set the intercept of the X1 to 0 to identify/define the meal of its latent
  X1 (measerrX);! name the residual error to be set equal across time and estimated
  ! time 2
  LX2 by X2; ! define new 1 indicator LV
  [X2@0] ; ! set the intercept of the X1 to 0 to identify/define the meal of its latent
  X2 (measerrX);! name the residual error to be set equal across time and estimated

  LCS21X by LX2@1; !defined by the 2nd variable
  LX2 @0; !residual variance of 2nd measure @0: note this is true residual, with measurement
  LCS21X ON LX1;  !PROPORTIONAL-GROWTH estimated: can omit it too, by adding ! or adding @0:
  [LX2 @0] ; !intercepts of 2nd measure @0
  LX2 on LX1@1; !autoregressive path set @1

  !Y part
  ! first create LV behind each observed indicator:
  ! time 1
  LY1 by Y1; ! define new 1 indicator LV
  [Y1@0] ; ! set the intercept of the X1 to 0 to identify/define the meal of its latent
  Y1 (measerrY);! name the residual error to be set equal across time and estimated
  ! time 2
  LY2 by Y2; ! define new 1 indicator LV
  [Y2@0] ; ! set the intercept of the X1 to 0 to identify/define the meal of its latent
  Y2 (measerrY);! name the residual error to be set equal across time and estimated

  LCS21Y by LY2@1; !defined by the 2nd variable
  LY2 @0; !residual variance of 2nd measure @0: note this is true residual, with measurement
  LCS21Y ON LY1;  !PROPORTIONAL-GROWTH estimated: can omit it too, by adding ! or adding @0:
  [LY2 @0] ; !intercepts of 2nd measure @0
  LY2 on LY1@1; !autoregressive path set @1

  ! bivariate section

  LCS21Y ON LCS21X; ! CHANGE IN X LEADING TO CHANGE IN Y
  ! COVARIANCES BETWEEN EXOGENOUS VARIABLES ARE ADDED BY DEFAULT: YOU MAY WANT TO DEFLECT TH
  ! LX1 WITH LY1@0 ;
  ! BE PREPARED TO MAKE THESE @0 IT MAY NOT RUN OTHERWISE
  LCS21X @0;
  LCS21Y @0;
   OUTPUT: TECH1 TECH4 stand ;

2. With observed variables:

DEFINE:
X1 = YourXatTime1;
    X2 = YourXatTime2;
Y1 = YourYatTime1;
    Y2 = YourYatTime2;

MODEL:
!X part

LCS21X by X2@1; !defined by the 2nd variable
X2 @0; !residual variance of 2nd measure @0: note this is true residual, with measurement error of X1 partialled out
LCS21X ON X1;  !PROPORTIONAL-GROWTH estimated: can omit it too, by adding ! or adding @0: different models!!!
[X2 @0] ; !intercepts of 2nd measure @0
X2 on X1@1; !autoregressive path set @1

!Y part

LCS21Y by Y2@1; !defined by the 2nd variable
Y2 @0; !residual variance of 2nd measure @0: note this is true residual, with measurement error of X1 partialled out
LCS21Y ON Y1;  !PROPORTIONAL-GROWTH estimated: can omit it too, by adding ! or adding @0: different models!!!
[Y2 @0] ; !intercepts of 2nd measure @0
Y2 on Y1@1; !autoregressive path set @1

! bivariate section

LCS21Y ON LCS21X; ! CHANGE IN X LEADING TO CHANGE IN Y
! COVARIANCES BETWEEN EXOGENOUS VARIABLES ARE ADDED BY DEFAULT: YOU MAY WANT TO DEFLECT THEM INITIALLY
! X1 WITH Y1@0 ;
! BE PREPARED TO MAKE THESE @0 IT MAY NOT RUN OTHERWISE
!LCS21X @0; 
!LCS21Y @0; 
 OUTPUT: TECH1 TECH4 stand ;
 
 

2 comments:

  1. Can you share the post with the R version?

    ReplyDelete
  2. Things have changed since this posting... e.g. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC9547120/ and https://quantdev.ssri.psu.edu/sites/qdev/files/Chap_16_Latent_Change_Score.html

    ReplyDelete