* ================================================================== * FILE: mixed007 split-plot ANOVA.sps . * NOTES: Use MIXED procedure to perform split-plot ANOVA . * DATE: 4-Apr-2008 . * AUTHOR: Bruce Weaver, bweaver@lakeheadu.ca . * ================================================================== . * Split-plot ANOVA is also called mixed design or between-within ANOVA. define !spss ()'C:\Program Files\SPSS\'!enddefine. get file = !spss + 'samples\Growth study.sav' . /* REMOVE "samples\" if necessary . * Perform split-plot ANOVA with the * GLM, UNIANOVA and MIXED procedures . * GLM REPEATED MEASURES requires one row per ID. * Use CASESTOVARS to restructure the data . CASESTOVARS /ID = subject /fixed = gender /drop = index /SEP="". GLM distance1 distance2 distance3 distance4 BY gender /WSFACTOR = age 4 Polynomial /METHOD = SSTYPE(3) /EMMEANS = TABLES(gender) /EMMEANS = TABLES(age) /EMMEANS = TABLES(gender*age) /PLOT = profile(age*gender) /DESIGN = gender /WSDESIGN = age . * UNIANOVA and MIXED require one row per observation, so revert * to the original data file. get file = !spss + 'samples\Growth study.sav' . /* REMOVE "samples\" if necessary. UNIANOVA distance BY subject gender age /RANDOM = subject /METHOD = SSTYPE(3) /EMMEANS = TABLES(gender) /EMMEANS = TABLES(age) /EMMEANS = TABLES(gender*age) /DESIGN = gender subject(gender) age age*gender . * NOTE that all error terms but the final one must be specified * on the /DESIGN line when you perform mixed design ANOVA (or * repeated measures ANOVA with 2 or more factors) when you use * UNIANOVA to do the analysis. If you do not specify the error * terms, SPSS will use a pooled error term. * The final error term for this model is age*subject(gender). * But it is omitted, because if you include it, the residual * error term = 0, and things don't work properly. * MIXED with COVTYPE = CS (compound symmetry). MIXED distance BY gender age /FIXED = gender age gender*age | SSTYPE(3) /REPEATED = age | SUBJECT(subject) COVTYPE(cs) /EMMEANS = TABLES(gender) /EMMEANS = TABLES(age) /EMMEANS = TABLES(gender*age) . * To get the same SEs that you get with GLM-Repeated Measures, * you have to set COVTYPE to UN (unspecified), as shown below. * MIXED with COVTYPE = UN (unspecified) . MIXED distance BY gender age /FIXED = gender age gender*age | SSTYPE(3) /REPEATED = age | SUBJECT(subject) COVTYPE(un) /EMMEANS = TABLES(gender) /EMMEANS = TABLES(age) /EMMEANS = TABLES(gender*age) . * Using COVTYPE = CS gives me the same F-tests as GLM-Repeated Measures, * but the SEs for the estimated marginal means are different. * Using COVTYPE = UN gives me somewhat different F-tests, but * the SEs for the estimated marginal means are the same. * ---------------------------------------------------- . freq age gender. * Another way to analyze these data is by treating AGE * and GENDER as covariates rather than factors. * Create 1/0 indicators Male and Female. compute male = (gender EQ "M"). compute female = (gender EQ "F"). format male female (f1.0). crosstabs gender by male female. * Allow random intercept across subjects. MIXED distance with male age /FIXED = male age male*age | SSTYPE(3) /RANDOM = intercept | SUBJECT(subject) /PRINT = solution . * Because age was not centred, the coefficient for MALE * gives the difference between males and females when * age = 0. Centre AGE on in-range values to get meaningful * MALE v FEMALE differences. compute age8 = age-8. compute age10 = age-10. compute age12 = age-12. compute age14 = age-14. * Now re-run the model using AGE8 in place of AGE. MIXED distance with male age8 /FIXED = male age8 male*age8 | SSTYPE(3) /RANDOM = intercept | SUBJECT(subject) /PRINT = solution . * Now with AGE10, AGE12, and AGE14 in place of AGE. MIXED distance with male age10 /FIXED = male age10 male*age10 | SSTYPE(3) /RANDOM = intercept | SUBJECT(subject) /PRINT = solution . MIXED distance with male age12 /FIXED = male age12 male*age12 | SSTYPE(3) /RANDOM = intercept | SUBJECT(subject) /PRINT = solution . MIXED distance with male age14 /FIXED = male age14 male*age14 | SSTYPE(3) /RANDOM = intercept | SUBJECT(subject) /PRINT = solution . * Notice that the coefficient for MALE increases across * this series of models in a fashion that is similar to * what you see in the PLOT created with GLM-Repeated Measures * in the first analysis above. Thus, the nature of the * interaction is such that the difference between males and * females gets larger as age increases. * Now allow random intercept and slope for age across subjects. MIXED distance with male age /FIXED = male age male*age | SSTYPE(3) /RANDOM = intercept age | SUBJECT(subject) COVTYPE(UN) /PRINT = solution . * Change in -2LL from the previous model is trivial, * so revert to previous model. * ================================================================== .