TITLE:
  Ch 4: Empty Means, Random Intercept in G
  n-1 Order Unstructured R

DATA:
  FILE = MPLUS_Chapter4.csv;
  FORMAT = FREE;

DATA LONGTOWIDE:
  LONG = posmood;
  WIDE = posmood1-posmood7;
  IDVARIABLE = PersonID;
  REPETITION = studyday (1-7);

VARIABLE:
  NAMES = PersonID studyday posmood;
  USEVARIABLES = posmood1-posmood7;
  MISSING = ALL (-9999);

ANALYSIS:
  ESTIMATOR = ML;
  PROCESSORS = 4;

OUTPUT:
  STDYX;

MODEL:
  RandInt BY posmood1-posmood7@1;
  RandInt (intvar);
  posmood1-posmood7 (resvar1-resvar7);
  posmood1-posmood6 PWITH posmood2-posmood7 (rescov1-rescov6);
  posmood1-posmood5 PWITH posmood3-posmood7 (rescov7-rescov11);
  posmood1-posmood4 PWITH posmood4-posmood7 (rescov12-rescov15);
  posmood1-posmood3 PWITH posmood5-posmood7 (rescov16-rescov18);
  posmood1-posmood2 PWITH posmood6-posmood7 (rescov19-rescov20);
  posmood1          PWITH posmood7@0                           ;
  [posmood1-posmood7@0 RandInt];