Two-factor mixed ANOVA (one between- and one within-subjects factor)

The following example shows how to use the SPSS MIXED procedure to estimate a two-factor mixed effects ANOVA with missing values on the repeated measures variables.  The following example assumes that the between-subjects factor is complete.

The typical data setup for a two-factor mixed ANOVA has the repeated measures variables as separate columns (i.e., wide format).  For example, consider a design where the between-subjects factor (bsfactor) has two levels and the repeated measures factor has five levels (rm1 to rm5).  The data would look like this.

In order to use the SPSS mixed procedure to implement maximum likelihood estimation, the data must be stacked, such that the repeated measures variables appear in a single column and each case has multiple rows of data.  The stacked file would look like this.

The VARSTOCASES command (from the pull-downs, choose DATA then RESTRUCTURE) stacks the data file.  The syntax for the above example is as follows.


   /make dv from rm1 rm2 rm3 rm4 rm5

   /index = wsfactor (5)

   /keep id bsfactor

   /null = keep.

Finally, the MIXED syntax for the analysis is as follows.  The EMMEANS subcommands give maximum likelihood mean estimates and significance tests for the simple effect comparing the two between-subjects groups at each level of the within-subjects factor (other tests are possible).

* the emmeans line gives maximum likelihood means and simple effects tests.

mixed dv by bsfactor wsfactor

   /method = ml

   /print = testcov

   /emmeans = tables (bsfactor*wsfactor) compare(bsfactor)

   /fixed = bsfactor wsfactor bsfactor*wsfactor

   /repeated = wsfactor | subject(id) covtype(cs).

The previous analysis specifies a compound symmetric covariance structure that is consistent with a standard repeated measures ANOVA.  Changing the covariance structure from CS to UN implements an unstructured covariance matrix (less stringent assumptions, more estimated parameters).  The square root of the diagonal elements in the estimated covariance matrix are maximum likelihood standard deviations.

Questions or suggestions? Email Craig Enders