Three-factor mixed ANOVA (one between- and two within-subjects factors)

The following example shows how to use the SPSS MIXED procedure to estimate a three-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 three-factor within-subjects 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, the first within-subjects factor (factor A) has two levels (a1 and a2), and the second within-subjects factor (factor B) has three levels (b1, b2, and b3).  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 a1b1 a1b2 a1b3 a2b1 a2b2 a2b3

   /index = condition (6)

   /keep id bsfactor

   /null = keep.

recode condition(1 thru 3 = 1)(4 thru 6 = 2) into wsfactora.

recode condition (1,4 = 1)(2,5 = 2)(3,6 = 3) into wsfactorb.


Finally, the MIXED syntax for the analysis is as follows.  The EMMEANS subcommands give maximum likelihood mean estimates and significance tests for the main effects (other tests are possible).

* the first emmeans line gives the means for all design cells.

* the second emmeans line compares the main effect of bsfactor.

* the third emmeans line compares the main effect of wsfactora.

* the fourth emmeans line compares the main effect of wsfactob.

mixed dv by bsfactor wsfactora wsfactorb

   /method = ml

   /print = testcov

   /emmeans = tables (bsfactor*wsfactora*wsfactorb)

   /emmeans = tables (bsfactor) compare(bsfactor)

   /emmeans = tables (wsfactora) compare(wsfactora) 

   /emmeans = tables (wsfactorb) compare(wsfactorb)

   /fixed = bsfactor wsfactora wsfactorb bsfactor*wsfactora bsfactor*wsfactorb

    wsfactora*wsfactorb bsfactor*wsfactora*wsfactorb

   /repeated = wsfactora*wsfactorb | 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