TITLE:
  Ch 6: 5a: Fixed Time, Fixed Slope26, Random Intercept Model

DATA:
  FILE = MPLUS_Chapter6.csv;
  FORMAT = FREE;

DEFINE:
  ! Rescale rt so Mplus will show all results
  rt = rt/10;
  time1=session-1; slope26=0;
  IF session GE 2 THEN slope26=session-2;

VARIABLE:
  NAMES = PersonID session rt;
  USEVARIABLES = rt time1 slope26;
  MISSING = ALL (-9999);
  CLUSTER = PersonID;
  WITHIN = time1 slope26;

ANALYSIS:
  ESTIMATOR = ML;
  PROCESSORS = 4;
  TYPE = TWOLEVEL RANDOM;

MODEL:

%WITHIN%
  rt;
  linear | rt ON time1;
  slope2 | rt ON slope26;

%BETWEEN%
  [rt linear slope2] (int btime1 bslope26);
  rt linear@0 slope2@0;

MODEL CONSTRAINT:
  NEW(est1-est7);
! est1: Intercept at Session=1 Time=0
  est1 = int*1 + btime1*0 + bslope26*0;
! est2: Intercept at Session=2 Time=1
  est2 = int*1 + btime1*1 + bslope26*0;
! est3: Intercept at Session=3 Time=2
  est3 = int*1 + btime1*2 + bslope26*1;
! est4: Intercept at Session=4 Time=3
  est4 = int*1 + btime1*3 + bslope26*2;
! est5: Intercept at Session=5 Time=4
  est5 = int*1 + btime1*4 + bslope26*3;
! est6: Intercept at Session=6 Time=5
  est6 = int*1 + btime1*5 + bslope26*4;
! est7: Rate of change from session 2 to 6
  est7 = btime1*1 + bslope26*1;