TITLE:
  Ch 6: 3b: Random Quadratic Time Model (0=Session 6)

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

DEFINE:
  ! Rescale rt so Mplus will show all results
  rt = rt/10;
  time6 = session - 6;
  time6sq = time6*time6;

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

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

MODEL:

%WITHIN%
  rt;
  linear | rt ON time6;
  quad | rt ON time6sq;

%BETWEEN%
  [rt linear quad] (int btime6 btime6sq);
  rt linear quad;
  rt linear quad WITH rt linear quad;

MODEL CONSTRAINT:
  NEW(est1-est12);
! est1: Intercept at Session=1 Time=-5
  est1 = int*1 - btime6*5 + btime6sq*25;
! est2: Intercept at Session=2 Time=-4
  est2 = int*1 - btime6*4 + btime6sq*16;
! est3: Intercept at Session=3 Time=-3
  est3 = int*1 - btime6*3 + btime6sq*9;
! est4: Intercept at Session=4 Time=-2
  est4 = int*1 - btime6*2 + btime6sq*4;
! est5: Intercept at Session=5 Time=-1
  est5 = int*1 - btime6*1 + btime6sq*1;
! est6: Intercept at Session=6 Time= 0
  est6 = int*1 + btime6*0 + btime6sq*0;
! est7: Linear Slope at Session=1 Time=-5
  est7 = btime6*1 - btime6sq*10;
! est8: Linear Slope at Session=2 Time=-4
  est8 = btime6*1 - btime6sq*8;
! est9: Linear Slope at Session=3 Time=-3
  est9 = btime6*1 - btime6sq*6;
! est10: Linear Slope at Session=4 Time=-2
  est10 = btime6*1 - btime6sq*4;
! est11: Linear Slope at Session=5 Time=-1
  est11 = btime6*1 - btime6sq*2;
! est12: Linear Slope at Session=6 Time= 0
  est12 = btime6*1 + btime6sq*0;