Psychology 613
Data Analysis III
Prof. Bertram Malle
Spring 2007


Lecture 13
Within-subject (M)Anova

Click here for a pdf file depicting the 2007 slides for this lecture.In the document, you will be referred back to the SPSS runs on this html page.
(Added May 21, 2007)

What is the difference between repeated-measures designs and within-subject designs? Typically, the first refers to any design that includes multiple (repeated) measures on the same cases; the DVs can be treated as a "bundle" (as we did in General Manova last week). Within-subject designs usually refer to cases in which the DVs are treated as levels of a (within-subject) factors. Mathematically, there is little difference between the two approaches because both make use of general Manova (hence, spectral decomposition of matrices into eigenvalues and eigenvectors); the difference lies in conceptualization and interpretation.

Table of contents

  1. Simple univariate ANOVA with two-level factors
  2. Decision tree for more complex designs
  3. Output on ANOVA with multivariate and univariate tests

Two-way univ within-subj design

12 subjects were participating in an experiment on the determinants of aggressive tone of voice in an argument. Two determinants were examined: time of week (weekday vs. weekend) and personal criticism (present vs. absent). Every subject was examined in all four cells of the design such that their tone of voice was rated for aggressiveness (on a 0-25 scale) in one argument on a weekday, one on the weekend, of which one each occurred after being criticized, one without being criticized. The order was balanced across subjects.
set width = 80 length = none header = off
data list notable free
 / subnr wend_no wday_no wend_cr wday_cr 
begin data
  1  6 10  4 15
  2  3  8  6 17
  3  5 11  5 11
  4  3  5  1 21
  5  4  5  6 20 
  6  7 12  7 17
  7  5 10  8 19
  8  5  6  2 20
  9  6  7  7 24
 10  4 10  6 11
 11  5  8  5 15
 12  5  8  6 13
end data


manova  wend_no wday_no wend_cr wday_cr 
 /wsfact = crit(2) week(2)
 /print = cellinfo(means) transf
 /rename = grand main_crit main_week interact

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Cell Means and Standard Deviations
 Variable .. WEND_NO
                                             Mean  Std. Dev.          N

 For entire sample                          4.833      1.193         12

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Variable .. WDAY_NO
                                             Mean  Std. Dev.          N

 For entire sample                          8.333      2.309         12

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Variable .. WEND_CR
                                             Mean  Std. Dev.          N

 For entire sample                          5.250      2.050         12

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Variable .. WDAY_CR
                                             Mean  Std. Dev.          N

 For entire sample                         16.917      4.078         12

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


 Orthonormalized Transformation Matrix (Transposed)

                 GRAND   MAIN_CRI   MAIN_WEE   INTERACT

 WEND_NO          .500      -.500      -.500       .500
 WDAY_NO          .500      -.500       .500      -.500
 WEND_CR          .500       .500      -.500      -.500
 WDAY_CR          .500       .500       .500       .500

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


 Tests of Significance for GRAND using UNIQUE sums of squares
 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN CELLS              65.17      11      5.92
 CONSTANT                3745.33       1   3745.33    632.20      .000

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN CELLS              93.50      11      8.50
 CRIT                     243.00       1    243.00     28.59      .000


 WITHIN CELLS              32.42      11      2.95
 WEEK                     690.08       1    690.08    234.17      .000


 WITHIN CELLS             112.42      11     10.22
 CRIT BY WEEK             200.08       1    200.08     19.58      .001

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SPSS tests each effect against its own (slightly different) error term. Alternatively, we could form a pooled error term and test each effect against this one. We could do this by hand:

SSpooled = 93.5 + 32.42 + 112.42 = 238.34

dfpooled = 11 + 11 + 11 = 33

Hence, MSpooled = 7.22

We could also request the pooled error term from SPSS: ------------------------------------------------------------------------
manova  wend_no wday_no wend_cr wday_cr
   /wsfact = crit(2) week(2)
   /print = cellinfo(means) transf signif(aver)
   /rename = grand main_crit main_week interact
   /wsdesign = crit + week + crit by week

[grand mean and multivariate output suppressed]

 AVERAGED Tests of Significance for MEAS.1 using UNIQUE sums of squares
 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN+RESIDUAL          238.33      33      7.22
 CRIT + WEEK + CRIT      1133.17       3    377.72     52.30      .000
  BY WEEK
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Decision Tree

Whenever we have more than two levels of a within-subject factor, things get complicated because the three within-subject levels cannot be tested simply as a difference contrast (like a paired t test). There are 2 degrees of freedom (2 contrasts) that describe the within-subject factor effects, so we have more than one dependent variable, hence the need for a multivariate design.

What if we stopped right here and said we are not interested in multivariate within-subject designs? Could we analyze our data in a univariate way? Indeed, this is called the "averaged F" approach (and you have probably used it already). Basically, you run your two (or more) univariate within-subject F tests as an average omnibus test and/or interpret the Fs separately as single-df contrasts. But this approach ignores covariances in your data (specifically, among your within-subject variables) and it is not one I highly recommend. Nonetheless, in some circumstances that's all you want, and if certain assumptions are met, it is also statistically permissible.

These considerations lead to the following decision tree (which also includes a between-subject factor to make the scheme applicable to a mixed multifactorial design):

In the output below, you can see the two tests (first Box's M test, later Mauchly's sphericity test). They do not indicate violation, so either solution is acceptable, and in fact all solutions arrive at approximately equal p-values.

Multivariate and univariate ANOVA run


MANOVA TRIAL1 TO TRIAL3 BY GROUP (1,2)
 /WSFACT = TRIALS(3)
 /CONTR (TRIALs) = poly
 /RENAME = const lin quad
 /PRINT = TRANSFORM homog (bart boxm) signif (hf gg hypoth eigen) error(sscp)
 /DISCRIM = stan  corr

Summaries of     TRIAL1
By levels of     GROUP


Variable      Value  Label                      Mean    Std Dev    Cases

For Entire Population                        24.7500     5.8493        8

GROUP          1.00                          25.0000     5.7735        4
GROUP          2.00                          24.5000     6.8069        4


Summaries of     TRIAL2
By levels of     GROUP


Variable      Value  Label                      Mean    Std Dev    Cases

For Entire Population                        20.2500     4.9497        8

GROUP          1.00                          19.5000     6.6081        4
GROUP          2.00                          21.0000     3.4641        4


Summaries of     TRIAL3
By levels of     GROUP


Variable      Value  Label                      Mean    Std Dev    Cases

For Entire Population                        15.5000     6.2106        8

GROUP          1.00                          16.0000     8.4853        4
GROUP          2.00                          15.0000     4.1633        4

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



               CELL NUMBER
                 1    2
 Variable
   GROUP         1    2

 Univariate Homogeneity of Variance Tests

 Variable .. TRIAL1

       Bartlett-Box F(1,108) =                     .06902, P =  .793

 Variable .. TRIAL2

       Bartlett-Box F(1,108) =                    1.00849, P =  .318

 Variable .. TRIAL3

       Bartlett-Box F(1,108) =                    1.21242, P =  .273
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The above tests are not very useful, but SPSS provides them whenever you ask for Box's M test.

 Cell Number .. 1

 Determinant of Covariance matrix of dependent variables =        533.33333
 LOG(Determinant) =                                                 6.27915

 - - - - - - - - - -

 Cell Number .. 2

 Determinant of Covariance matrix of dependent variables =       6165.33333
 LOG(Determinant) =                                                 8.72670

 - - - - - - - - - -


 Determinant of pooled Covariance matrix of dependent vars. =     30142.88889
 LOG(Determinant) =                                                  10.31370


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
As you can see, the test calculated the determinant of each subgroup's var-cov matrix and compares them. This can be understood as comparing the amount of information in each submatrix.

 Multivariate test for Homogeneity of Dispersion matrices

 Boxs M =                         16.86469
 F WITH (6,260) DF =               1.22362, P =   .294 (Approx.)
 Chi-Square with 6 DF =            7.72965, P =   .259 (Approx.)

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Orthonormalized Transformation Matrix (Transposed)

                 CONST        LIN       QUAD

 TRIAL1            .577      -.707       .408
 TRIAL2            .577       .000      -.816
 TRIAL3            .577       .707       .408
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The transformation matrix is a crucial piece of information whenever your within-subject factor has more than two levels. These contrasts (LIN, QUAD) are the two dependent variables that SPSS will analyze for the "TRIALS" effects. But first it analyzes the simple between-subject main effect for GROUPS using the CONST as the dependent variables, which is the measure that collapses across levels of the within-subject factor.

 Order of Variables for Analysis

   Variates     Covariates

    CONST

    1 Dependent Variable
    0 Covariates

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Note..  TRANSFORMED variables are in the variates column.
         These TRANSFORMED variables correspond to the
         Between-subject effects.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tests of Between-Subjects Effects.

 Tests of Significance for CONST using UNIQUE sums of squares
 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN CELLS             263.33       6     43.89
 GROUP                       .00       1       .00       .00     1.000

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Now we are getting ready for the within-subject part:

 Order of Variables for Analysis

   Variates     Covariates

    LIN
    QUAD

    2 Dependent Variables
    0 Covariates

Note: The three levels of TRIALS are transformed into two contrasts, and these are the new variables analyzed---because they are two, a multivariate analysis is indicated.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tests involving 'TRIALS' Within-Subject Effect.


 Mauchly sphericity test, W =      .79852
 Chi-square approx. =             1.12498 with 2 D. F.
 Significance =                      .570

 Greenhouse-Geisser Epsilon =      .83231
 Huynh-Feldt Epsilon =            1.00000
 Lower-bound Epsilon =             .50000

AVERAGED Tests of Significance that follow multivariate tests are equivalent to
univariate or split-plot or mixed-model approach to repeated measures.
Epsilons may be used to adjust d.f. for the AVERAGED results.

The total var-cov matrix, whose sphericity was just tested, is now being decomposed into the error matrix and the hypothesis matrix. (The first hypothesis matrix is the TRIALS x GROUP interaction.) As usual, the ratio between the two, HE-1, is subjected to spectral decomposition, and the resulting solution is the eigenvalue and eigenvector of the "effect," tested for multivariate significance.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 WITHIN CELLS Sum-of-Squares and Cross-Products

                   LIN       QUAD

 LIN           159.500
 QUAD           79.963    251.167

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 EFFECT .. GROUP BY TRIALS
 Adjusted Hypothesis Sum-of-Squares and Cross-Products

                   LIN       QUAD

 LIN              .250
 QUAD            1.299      6.750

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Multivariate Tests of Significance (S = 1, M = 0, N = 1 1/2)

 Test Name         Value    Exact F Hypoth. DF   Error DF  Sig. of F

 Pillais          .02693     .06918       2.00       5.00       .934
 Hotellings       .02767     .06918       2.00       5.00       .934
 Wilks            .97307     .06918       2.00       5.00       .934
 Roys             .02693
 Note.. F statistics are exact.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Eigenvalues and Canonical Correlations

 Root No.    Eigenvalue        Pct.   Cum. Pct.  Canon Cor.

        1          .028     100.000     100.000        .164

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 EFFECT .. GROUP BY TRIALS  (Cont.)

>Note # 12188
>Because there are no functions significant at level alpha, MANOVA will not
>report any canonical discriminant or correlation analysis for this effect.

 EFFECT .. GROUP BY TRIALS  (Cont.)
 Univariate F-tests with (1,6) D. F.

 Variable Hypoth. SS   Error SS Hypoth. MS   Error MS        F  Sig. of F

 LIN          .25000  159.50000     .25000   26.58333   .00940       .926
 QUAD        6.75000  251.16667    6.75000   41.86111   .16125       .702

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Now the main effect for TRIALS forms another H matrix, and a new PCA is run on the corresponding HE-1 matrix.

 EFFECT .. TRIALS
 Adjusted Hypothesis Sum-of-Squares and Cross-Products

                   LIN       QUAD

 LIN           342.250
 QUAD            5.340       .083

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Multivariate Tests of Significance (S = 1, M = 0, N = 1 1/2)

 Test Name         Value    Exact F Hypoth. DF   Error DF  Sig. of F

 Pillais          .71658    6.32080       2.00       5.00       .043
 Hotellings      2.52832    6.32080       2.00       5.00       .043
 Wilks            .28342    6.32080       2.00       5.00       .043
 Roys             .71658
 Note.. F statistics are exact.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Eigenvalues and Canonical Correlations

 Root No.    Eigenvalue        Pct.   Cum. Pct.  Canon Cor.

        1         2.528     100.000     100.000        .847

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 EFFECT .. TRIALS (Cont.)
 Standardized discriminant function coefficients
           Function No.

 Variable            1

 LIN             1.091
 QUAD            -.424

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Correlations between DEPENDENT and canonical variables
           Canonical Variable

 Variable            1

 LIN              .921
 QUAD             .011

As usual, the multivariate function has to be interpreted. The function consists almost exclusively of linear contributions (which you can verify by plotting the means by hand).

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 EFFECT .. TRIALS (Cont.)
 Univariate F-tests with (1,6) D. F.

 Variable   Hypoth. SS   Error SS Hypoth. MS   Error MS          F   Sig

 LIN         342.25000  159.50000  342.25000   26.58333   12.87461  .012
 QUAD           .08333  251.16667     .08333   41.86111     .00199  .966

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tests involving 'TRIALS' Within-Subject Effect.

 AVERAGED Tests of Significance for TRIAL using UNIQUE sums of squares
 Source of Variation          SS      DF        MS         F  Sig of F

 WITHIN CELLS             410.67      12     34.22
    (Greenhouse-Geisser)            9.99
    (Huynh-Feldt)                  12.00
    (Lower bound)                   6.00
 TRIALS                    342.33       2    171.17      5.00      .026
    (Greenhouse-Geisser)            1.66                5.00      .036
    (Huynh-Feldt)                   2.00                5.00      .026
    (Lower bound)                   1.00                5.00      .067
 GROUP BY TRIALS             7.00       2      3.50       .10      .904
    (Greenhouse-Geisser)            1.66                 .10      .871
    (Huynh-Feldt)                   2.00                 .10      .904
    (Lower bound)                   1.00                 .10      .760
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Note how little the corrections change the results (because Mauchly's test showed no violation). Also note how similar the p-values are to the corresponding multivariate tests.

Another way of interpreting either the multivariate or averaged-F results is shown below: by looking at its constituents---the transformed variables LIN and QUAD---one at a time ("trend analysis" in T&F's terms). Because the contrasts we formed are orthogonal (i.e., LIN and QUAD are uncorrelated), you can safely interpret their effect size. But the p-values you see should be treated with caution since they are not corrected for multiple testing. They should be used as interpretation aids, the same way you should use the discriminant functions.



 Estimates for LIN
 --- Individual univariate .9500 confidence intervals

 TRIALS

  Parameter     Coeff.  Std. Err.    t-Value     Sig. t Lower -95%  CL- Upper

        1   -6.5407377    1.82289   -3.58812     .01153  -11.00118   -2.08029

 GROUP BY TRIALS

  Parameter     Coeff.  Std. Err.    t-Value     Sig. t Lower -95%  CL- Upper

        2   .176776695    1.82289     .09698     .92590   -4.28367    4.63722

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Estimates for QUAD
 --- Individual univariate .9500 confidence intervals

 TRIALS

  Parameter     Coeff.  Std. Err.    t-Value     Sig. t Lower -95%  CL- Upper

        1   -.10206207    2.28750    -.04462     .96586   -5.69936    5.49524

 GROUP BY TRIALS

  Parameter     Coeff.  Std. Err.    t-Value     Sig. t Lower -95%  CL- Upper

        2   .918558654    2.28750     .40156     .70192   -4.67874    6.51586

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -