[R] Type III sum of squares and appropriate contrasts

John Fox jfox at mcmaster.ca
Thu Oct 11 20:34:07 CEST 2007

Dear Mark and Mel,

For some reason, I didn't see Mel's original posting.

For a different perspective on tests in, e.g., unbalanced ANOVA, see the
discussion in my text, Applied Regression Analysis, Linear Models, and
Related Methods (Sage, 1997). Briefly, if the contrasts for different terms
aren't orthogonal in the row-basis of the model matrix, then the incremental
F-test for "main effects" after all other terms isn't reasonably construed
as a test of main effects; this is what happens when you use the default
"treatment" contrasts in R. On the other hand, if the contrasts for
different terms are orthogonal in the row-basis of the design, then the
incremental F for main effects averages over interactions. This is what
happens when you use "sum" or "helmert" contrasts in R, and may not be of
interest when interactions are present, but it is at least sensibly
interpretable. In a model with covariates you also have to attend to the
centering of the covariates, for analogous reasons.

I hope this helps,

John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Marc Schwartz
> Sent: Thursday, October 11, 2007 1:43 PM
> To: Menelaos Stavrinides
> Cc: r-help at r-project.org
> Subject: Re: [R] Type III sum of squares and appropriate contrasts
> On Thu, 2007-10-11 at 10:24 -0700, Menelaos Stavrinides wrote:
> > I am running a two-way anova with Type III sums of squares 
> and would 
> > like to be able to understand what the different SS mean when I use 
> > different contrasts, e.g. treatment contrasts vs helmert 
> contrasts. I 
> > have read John Fox's "An R and S-Plus Companion to Applied 
> Regression"
> > approach -p. 140- suggesting that treatment contrasts do 
> not usually 
> > result in meaningful results with Type III SS but it's not 
> clear to me 
> > why. Any suggestions on a stats text discussing this would 
> be greatly 
> > appreciated.
> > Thanks,
> > Mel
> A good place to start would be Prof. Venables' "Exegeses on Linear
> Models":
>   www.stats.ox.ac.uk/pub/MASS3/Exegeses.pdf 
> Searching the r-help archives will also yield many discussions.
> Also, see R FAQ 7.18.
> HTH,
> Marc Schwartz
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list