TITLE:
  Eq 8.11: Adding 4 Sex*Negative Mood and Sex*Stressors Interactions to the Model for the Means
  Using Person-Mean-Centering for Negative Mood, Grand-Mean-Centering for Stressors

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

DEFINE:
  sexage = women*age80;
  sexPMm = women*PMmood2;
  sexPMs = women*PMstr40;

VARIABLE:
  NAMES = PersonID women baseage session studyday dayweek weekend symp mood stress
          PMmood PMstr age80 mood2 WPmood PMmood2 WPstr PMstr40;
  USEVARIABLES = symp women age80 PMmood2 WPmood stress PMstr40 sexage sexPMm sexPMs;
  MISSING = ALL (-9999);
  CLUSTER = PersonID;
  WITHIN = WPmood stress;
  BETWEEN = women age80 PMmood2 PMstr40 sexage sexPMm sexPMs;

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

MODEL:

%WITHIN%
  symp;
  L1mood | symp ON WPmood;
  L1str | symp ON stress;

%BETWEEN%
  [symp L1mood L1str] (int bWPmood bstress);
  symp L1mood@0 L1str@0;
  symp ON women age80 sexage (bwomen bage80 bsexage);
  symp ON PMmood2 PMstr40 (bPMmood2 bPMstr40);
  symp ON sexPMm sexPMs (bsexPMm bsexPMs);
  L1mood L1str ON women (bsexL1m bsexL1s);

MODEL TEST:
  ! Multivariate Test of 4 Sex Interactions
  0=bsexPMm;
  0=bsexPMs;
  0=bsexL1m;
  0=bsexL1s;

MODEL CONSTRAINT:
  NEW(est1-est25);
! est1: Intercept: Men
  est1 = int*1 + bwomen*0;
! est2: Intercept: Women
  est2 = int*1 + bwomen*1;
! est3: Intercept: Sex Diff
  est3 = bwomen*1;
! est4: Age Slope: Men
  est4 = bage80*1 + bsexage*0;
! est5: Age Slope: Women
  est5 = bage80*1 + bsexage*1;
! est6: Age Slope: Sex Diff
  est6 = bsexage*1;
! est7: BP Negative Mood: Men
  est7 = 1*bPMmood2 + 0*bsexPMm;
! est8: BP Negative Mood: Women
  est8 = 1*bPMmood2 + 1*bsexPMm;
! est9: BP Negative Mood: Sex Diff
  est9 = 1*bsexPMm;
! est10: Contextual Negative Mood: Men
  est10 = -1*bWPmood + 0*bsexL1m + 1*bPMmood2 + 0*bsexPMm;
! est11: Contextual Negative Mood: Women
  est11 = -1*bWPmood - 1*bsexL1m + 1*bPMmood2 + 1*bsexPMm;
! est12: Contextual Negative Mood: Sex Diff
  est12 = -1*bsexL1m + 1*bsexPMm;
! est13: WP Negative Mood: Men
  est13 = 1*bWPmood + 0*bsexL1m;
! est14: WP Negative Mood: Women
  est14 = 1*bWPmood + 1*bsexL1m;
! est15: WP Negative Mood: Sex Diff
  est15 = 1*bsexL1m;
! est16: BP Stressors: Men
  est16 = bstress*1 + bsexL1s*0 + bPMstr40*1 + bsexPMs*0;
! est17: BP Stressors: Women
  est17 = bstress*1 + bsexL1s*1 + bPMstr40*1 + bsexPMs*1;
! est18: BP Stressors: Sex Diff
  est18 = bsexL1s*1 + bsexPMs*1;
! est19: Contextual Stressors: Men
  est19 = bPMstr40*1 + bsexPMs*0;
! est20: Contextual Stressors: Women
  est20 = bPMstr40*1 + bsexPMs*1;
! est21: Contextual Stressors: Sex Diff
  est21 = bsexPMs*1;
! est22: WP Stressors: Men
  est22 = bstress*1 + bsexL1s*0;
! est23: WP Stressors: Women
  est23 = bstress*1 + bsexL1s*1;
! est24: WP Stressors: Sex Diff
  est24 = bsexL1s*1;
! est25: Contextual Stressors per Day
  est25 = bPMstr40*.2;