[R] contrast matrix for aov
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Mar 10 11:38:20 CET 2005
On Thu, 10 Mar 2005, Peter Dalgaard wrote:
> 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.]
That seems to be appropriate only if the four treatments are done in a
particular order (`repeated') and one expects correlations in the
responses. However, here the measurements seem to have been averages of
replications.
It may be "usual" to (mis?)specify experiments in SAS that way: I don't
know what end users do, but it is not the only way possible in SAS.
> 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.)
It also assumes that there is a difference between variances of the
contrasts, that is there is either correlation between results or a
difference in variances under different treatments. Nothing in the
description led me to expect either of those, but I was asking why it was
specified that way. (If the variance does differ with the mean then there
are probably more appropriate analyses.)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list