[R] contrats hardcoded in aov()?

Douglas Bates dmbates at gmail.com
Thu Jun 23 15:32:41 CEST 2005


On 6/23/05, RenE J.V. Bertin <rjvbertin at gmail.com> wrote:
> 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?

An aov model is intended to produce just the analysis of variance
table for which the choice of contrasts is irrelevant.  If you do want
to examine individual coefficients then fit the model using lm().




More information about the R-help mailing list