Re: [R] contrats hardcoded in aov()?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri 24 Jun 2005 - 00:40:25 EST

The source code actually says

         ##  helmert contrasts can be helpful: do we want to force them?
         ##  this version does for the Error model.
         opcons <- options("contrasts")
         ....

and do note it is unset again a few lines later. (Listing a function inside R is not giving you the `source code'.)

So Helmert contrasts are only used for computing the strata, nothing to do with your comment as the user never gets to see anything other than the projections onto strata. Having a nearly orthogonal parametrization helps numerical stability in e.g. establishing if projections are orthogonal.

On Thu, 23 Jun 2005, RenE J.V. Bertin 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 this is really the `source code' as you claim, why did you remove the very helpful comment?

> 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?

As others have noted:

  1. The AoV itself does not depend on the coding used.
  2. Some other things you can do with an aov fit do, and there you want an orthogonal parametrization if possible, both for ease of interpretation and numerical stability.
-- 
Brian D. Ripley,                  ripley@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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Fri Jun 24 00:46:34 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:59 EST