[R] contrats hardcoded in aov()?
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Thu Jun 23 16:12:22 CEST 2005
"RenE J.V. Bertin" <rjvbertin at gmail.com> writes:
> Hello,
>
> I was just having a look at the aov function source code, and see that when the model used does not have an Error term, Helmert contrasts are imposed:
>
> if (is.null(indError)) {
> ...
> }
> else {
> opcons <- options("contrasts")
> options(contrasts = c("contr.helmert", "contr.poly"))
> on.exit(options(opcons))
> ...
>
>
> My reading of several contributed user guides' sections on ANOVA is
> that Helmert contrasts are not intuitive at all and best avoided by
> non-expert users. This explains why I didn't see any influence of
> the various contrast settings on my results, and I wonder why this
> local shadowing of global settings is done?
I believe the reason is that you get in trouble further down the line
if the contrast matrices do not sum to zero over rows, which basically
implies contr.helmert or contr.sum.
There is some disagreement over whether this is a natural requirement
for contrast matrices (Brian and I have discussed this previously, on
this list I believe), but this is technical: the code assumes it and
gives wrong results if it isn't true.
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list