TITLE:
  Eq 8.12: Adding 4 Negative Mood*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;
  sexPMs = women*PMstr40;
  PMmPMs = PMmood2*PMstr40;
  WPmstr = WPmood*stress;

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 sexPMs
                  PMmPMs WPmstr;
  MISSING = ALL (-9999);
  CLUSTER = PersonID;
  WITHIN = WPmood stress WPmstr;
  BETWEEN = women age80 PMmood2 PMstr40 sexage sexPMs PMmPMs;

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

MODEL:

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

%BETWEEN%
  [symp L1mood L1str L1mL1s] (int bWPmood bstress bWPmstr);
  symp L1mood@0 L1str@0 L1mL1s@0;
  symp ON women age80 sexage (bwomen bage80 bsexage);
  symp ON PMmood2 PMstr40 (bPMmood2 bPMstr40);
  symp ON sexPMs PMmPMs (bsexPMs bPMmPMs);
  L1mood ON PMstr40 (bL1mPMs);
  L1str ON women PMmood2 (bsexL1s bPMmL1s);

MODEL TEST:
  ! Multivariate Test of 4 Negative Mood*Stressors Interactions
  0=bPMmPMs;
  0=bWPmstr;
  0=bL1mPMs;
  0=bPMmL1s;

MODEL CONSTRAINT:
  NEW(est1-est28);
! 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
  est7 = bPMmood2*1;
! est8: Contextual Negative Mood
  est8 = bPMmood2*1 - bWPmood*1;
! est9: WP Negative Mood
  est9 = bWPmood*1;
! est10: BP Stressors: Men
  est10 = bstress*1 + bsexL1s*0 + bPMstr40*1 + bsexPMs*0;
! est11: BP Stressors: Women
  est11 = bstress*1 + bsexL1s*1 + bPMstr40*1 + bsexPMs*1;
! est12: BP Stressors: Sex Diff
  est12 = bsexL1s*1 + bsexPMs*1;
! est13: Contextual Stressors: Men
  est13 = bPMstr40*1 + bsexPMs*0;
! est14: Contextual Stressors: Women
  est14 = bPMstr40*1 + bsexPMs*1;
! est15: Contextual Stressors: Sex Diff
  est15 = bsexPMs*1;
! est16: WP Stressors: Men
  est16 = bstress*1 + bsexL1s*0;
! est17: WP Stressors: Women
  est17 = bstress*1 + bsexL1s*1;
! est18: WP Stressors: Sex Diff
  est18 = bsexL1s*1;
! est19: Contextual Stressors per Day
  est19 = bPMstr40*.2;
! est20: BP Negative Mood by BP Stressors
  est20 = bPMmL1s*1 + bPMmPMs*1;
! est21: BP Negative Mood by Contextual Stressors
  est21 = bPMmPMs*1;
! est22: BP Negative Mood by WP Stressors
  est22 = bPMmL1s*1;
! est23: Contextual Negative Mood by BP Stressors
  est23 = bPMmL1s*1 - bWPmstr*1 + bPMmPMs*1 - bL1mPMs*1;
! est24: Contextual Negative Mood by Contextual Stressors
  est24 = bPMmPMs*1 - bL1mPMs*1;
! est25: Contextual Negative Mood by WP Stressors
  est25 = bPMmL1s*1 - bWPmstr*1;
! est26: WP Negative Mood by BP Stressors
  est26 = bWPmstr*1 + bL1mPMs*1;
! est27: WP Negative Mood by Contextual Stressors
  est27 = bL1mPMs*1;
! est28: WP Negative Mood by WP Stressors
  est28 = bWPmstr*1;