TITLE:
  Ch 6: 4a: Fixed Slope12, Fixed Slope26, Random Intercept Model

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

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

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

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

MODEL:

%WITHIN%
  rt;
  slope1 | rt ON slope12;
  slope2 | rt ON slope26;

%BETWEEN%
  [rt slope1 slope2] (int bslope12 bslope26);
  rt slope1@0 slope2@0;

MODEL CONSTRAINT:
  NEW(est1-est7);
! est1: Intercept at Session=1 Time=0
  est1 = int*1 + bslope12*0 + bslope26*0;
! est2: Intercept at Session=2 Time=1
  est2 = int*1 + bslope12*1 + bslope26*0;
! est3: Intercept at Session=3 Time=2
  est3 = int*1 + bslope12*1 + bslope26*1;
! est4: Intercept at Session=4 Time=3
  est4 = int*1 + bslope12*1 + bslope26*2;
! est5: Intercept at Session=5 Time=4
  est5 = int*1 + bslope12*1 + bslope26*3;
! est6: Intercept at Session=6 Time=5
  est6 = int*1 + bslope12*1 + bslope26*4;
! est7: Difference between slope12 and slope26
  est7 = -1*bslope12 + 1*bslope26;