TITLE:
  Ch 11a: Piecewise Means, Level-3 and Level-2 Random Intercepts
  Three-Level Model Predicting Student Victimization

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

VARIABLE:
  NAMES = ClassID grade size StudID girl SMclose SMvic CMclose CMvic CMg CMemo
          size23 grade35 CMg50 CMemo5 CMvic3 WCclose SMvic3 WCvic wave emo vic close
          time1 time2 w3 WSclose vic3 WSvic emo5 WCemo;
  USEVARIABLES = vic time1 w3;
  MISSING = ALL (-9999);
  CLUSTER = ClassID StudID;
  WITHIN = time1 w3;

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

MODEL:

%WITHIN%
  vic;
  lin | vic ON time1;
  w3dif | vic ON w3;

%BETWEEN StudID%
  vic lin@0 w3dif@0;

%BETWEEN ClassID%
  [vic lin w3dif] (int btime1 bw3);
  vic lin@0 w3dif@0;