TITLE:
  Eq 10a.2: Fixed Quadratic, Random Linear Model using Years since Birth
  Controlling for Birth Cohort

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

DEFINE:
  tvagesq = tvage84*tvage84;
  ageT0sq = ageT084*ageT084;

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

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

MODEL:

%WITHIN%
  recall;
  linear | recall ON tvage84;
  quad | recall ON tvagesq;

%BETWEEN%
  [recall linear quad] (int btvage84 btvagesq);
  recall linear quad@0;
  recall WITH linear;
  recall ON ageT084 ageT0sq (baint basqint);
  linear ON ageT084 (balin);

MODEL TEST:
  ! Multivariate Test of Birth Cohort Contextual Effects
  0=baint;
  0=basqint;
  0=balin;

MODEL CONSTRAINT:
  NEW(est1-est6);
! est1: Contextual Linear Birth Cohort on Intercept
  est1 = baint*1;
! est2: Contextual Quadratic Birth Cohort on Intercept
  est2 = basqint*1;
! est3: Contextual Linear Birth Cohort on Linear Slope
  est3 = balin*1;
! est4: Total Linear Birth Cohort on Intercept
  est4 = baint*1 + btvage84*1;
! est5: Total Quadratic Birth Cohort on Intercept
  est5 = basqint*1 + balin*1 + btvagesq*1;
! est6: Total Linear Birth Cohort on Linear Slope
  est6 = balin*1 + btvagesq*2;