Re: [R] contrast matrix for aov

From: Peter Dalgaard <>
Date: Thu 10 Mar 2005 - 20:33:32 EST

Prof Brian Ripley <> writes:

> On Wed, 9 Mar 2005, Darren Weber wrote:
> > How do we specify a contrast interaction matrix for an ANOVA model?
> >
> > We have a two-factor, repeated measures design, with
> Where does `repeated measures' come into this? You appear to have
> repeated a 2x2 experiment in each of 8 blocks (subjects). Such a
> design is usually analysed with fixed effects. (Perhaps you averaged
> over repeats in the first few lines of your code?)

Actually, that's not "usual" in SAS (and not SPSS either, I believe) in things like

proc glm;

        model y1-y4= ;
        repeated row 2 col 2;

[Not that SAS/SPSS is the Gospel, but they do tend to set the terminology in these matters.]

There you'd get the analysis split up as analyses of three contrasts corresponding to the main effects and interaction, c(-1,-1,1,1), c(-1,1,-1,1), and c(-1,1,1,-1) in the 2x2 case (up to scale and sign). In the 2x2 case, this corresponds exactly to the 4-stratum model row*col + Error(block/(row*col)).

(It is interesting to note that it is still not the optimal analysis for arbitrary covariance patterns because dependence between contrasts is not utilized - it is basically assumed to be absent.)

With more than two levels, you get the additional complications of sphericity testing and GG/HF epsilons and all that.

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (             FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Thu Mar 10 20:48:02 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:42 EST