SET PRINTBACK=NONE HEADER=NO.
FILE HANDLE filesave /NAME = "C:\Dropbox\PilesOfVariance\Chapter5\SPSS".
GET FILE = "filesave/SPSS_Chapter5.sav".
DATASET NAME Chapter5 WINDOW=FRONT.
COMPUTE time = wave - 1.
VARIABLE LABELS time "time: Time in Study (0=1)".
EXECUTE.
OUTPUT NAME SPSS_Chapter5_Output.
ECHO "Chapter 5 Example: Means by Wave for outcome".
SUMMARIZE
/TABLES = outcome BY wave
/FORMAT = NOLIST TOTAL
/CELLS = COUNT MEAN STDDEV MIN MAX.
DATASET ACTIVATE Chapter5 WINDOW=FRONT.
ECHO 'Ch 5: Empty Means, Random Intercept Model'.
MIXED outcome BY PersonID wave
/METHOD = REML
/PRINT = SOLUTION TESTCOV G R
/FIXED =
/RANDOM = INTERCEPT | COVTYPE(UN) SUBJECT(PersonID)
/REPEATED = wave | COVTYPE(ID) SUBJECT(PersonID)
.
DATASET ACTIVATE Chapter5 WINDOW=FRONT.
ECHO 'Ch 5: Fixed Linear Time, Random Intercept Model'.
MIXED outcome BY PersonID wave WITH time
/METHOD = REML
/PRINT = SOLUTION TESTCOV G R
/FIXED = time
/RANDOM = INTERCEPT | COVTYPE(UN) SUBJECT(PersonID)
/REPEATED = wave | COVTYPE(ID) SUBJECT(PersonID)
/TEST = 'Intercept at Time=0' intercept 1 time 0
/TEST = 'Intercept at Time=1' intercept 1 time 1
/TEST = 'Intercept at Time=2' intercept 1 time 2
/TEST = 'Intercept at Time=3' intercept 1 time 3
.
DATASET ACTIVATE Chapter5 WINDOW=FRONT.
ECHO 'Ch 5: Random Linear Time Model'.
MIXED outcome BY PersonID wave WITH time
/METHOD = REML
/PRINT = SOLUTION TESTCOV G R
/FIXED = time
/RANDOM = INTERCEPT time | COVTYPE(UN) SUBJECT(PersonID)
/REPEATED = wave | COVTYPE(ID) SUBJECT(PersonID)
/TEST = 'Intercept at Time=0' intercept 1 time 0
/TEST = 'Intercept at Time=1' intercept 1 time 1
/TEST = 'Intercept at Time=2' intercept 1 time 2
/TEST = 'Intercept at Time=3' intercept 1 time 3
.
DATASET ACTIVATE Chapter5 WINDOW=FRONT.
ECHO 'Ch 5: Saturated Means, Unstructured Variance Model;'.
ECHO 'ANSWER KEY for both sides of the model'.
MIXED outcome BY PersonID wave
/METHOD = REML
/PRINT = SOLUTION TESTCOV R
/FIXED = wave
/REPEATED = wave | COVTYPE(UN) SUBJECT(PersonID)
/EMMEANS = TABLES(wave) COMPARE(wave)
.
DATASET ACTIVATE Chapter5 WINDOW=FRONT.
ECHO 'Ch 5: Random Linear Time Model with AR1 R Matrix'.
MIXED outcome BY PersonID wave WITH time
/METHOD = REML
/PRINT = SOLUTION TESTCOV G R
/FIXED = time
/RANDOM = INTERCEPT time | COVTYPE(UN) SUBJECT(PersonID)
/REPEATED = wave | COVTYPE(AR1) SUBJECT(PersonID)
.
OUTPUT EXPORT NAME=SPSS_Chapter5_Output
/CONTENTS EXPORT=VISIBLE LAYERS=VISIBLE MODELVIEWS=VISIBLE
/HTML DOCUMENTFILE='C:\Dropbox\PilesOfVariance\Chapter5\SPSS\SPSS_Chapter5_Output.html'
IMAGEFORMAT=PNG STYLING=YES.