TITLE:
  Eq 7a.4: Adding Sex and Age to the Model for the Means

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

DEFINE:
  sexage = women*age80;

VARIABLE:
  NAMES = PersonID women baseage session studyday dayweek weekend symp mood stress
          sday1 wday1 age80;
  USEVARIABLES = symp women age80 sexage;
  MISSING = ALL (-9999);
  CLUSTER = PersonID;
  BETWEEN = women age80 sexage;

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

OUTPUT:
  TECH3;

MODEL:

%WITHIN%
  symp;

%BETWEEN%
  [symp];
  symp;
  symp ON women age80 sexage (bwomen bage80 bsexage);

MODEL TEST:
  ! Multivariate Test of Fixed Effects
  0=bwomen;
  0=bage80;
  0=bsexage;

MODEL CONSTRAINT:
  NEW(est1-est2);
! est1: Age Slope for Men
  est1 = bage80*1 + bsexage*0;
! est2: Age Slope for Women
  est2 = bage80*1 + bsexage*1;