TITLE:
  Eq 10a.2: Fixed Quadratic, Random Linear Model using Years in Study
  Controlling for Death Cohort

DATA:
  ! Prior necessary data manipulation conducted using other programs
  FILE = MPLUS_Chapter10a.csv;
  FORMAT = FREE;

DEFINE:
  timesq = time*time;
  ytdT0sq = ytdT07*ytdT07;

VARIABLE:
  NAMES = PersonID occasion ageT0 tvage ytdT0 tvytd recall time
          roundage tvage84 ageT084 roundytd tvytd7 ytdT07;
  USEVARIABLES = recall time ytdT07 timesq ytdT0sq;
  MISSING = ALL (-9999);
  CLUSTER = PersonID;
  WITHIN = time timesq;
  BETWEEN = ytdT07 ytdT0sq;

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

MODEL:

%WITHIN%
  recall;
  linear | recall ON time;
  quad | recall ON timesq;

%BETWEEN%
  [recall linear quad] (int btime btimesq);
  recall linear quad@0;
  recall WITH linear;
  recall ON ytdT07 ytdT0sq (bdint bdsqint);
  linear ON ytdT07 (bdlin);

MODEL TEST:
  ! Multivariate Test of Death Cohort Total Effects
  0=bdint;
  0=bdsqint;
  0=bdlin;

MODEL CONSTRAINT:
  NEW(est1-est6);
! est1: Contextual Linear Birth Cohort on Intercept
  est1 = bdint*1 - btime*1;
! est2: Contextual Quadratic Birth Cohort on Intercept
  est2 = bdsqint*1 - bdlin*1 + btimesq*1;
! est3: Contextual Linear Birth Cohort on Linear Slope
  est3 = bdlin*1 - btimesq*2;
! est4: Total Linear Birth Cohort on Intercept
  est4 = bdint*1;
! est5: Total Quadratic Birth Cohort on Intercept
  est5 = bdsqint*1;
! est6: Total Linear Birth Cohort on Linear Slope
  est6 = bdlin*1;