[R] contrast matrix for aov

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Mar 10 10:33:32 CET 2005


Prof Brian Ripley <ripley at stats.ox.ac.uk> 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
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list