[R] degrees of freedom in lm() treatment contrasts

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 4 19:23:15 CEST 2004


The thing is, it is *terms* that have degrees of freedom, and that does
not depend on the contrasts used except in rather exceptional
circumstances (when you set them with C() being one).

And the number of df assigned to a term depends on what went before, as
well as the data (since you can extrinsic aliasing). The only source that
is close to comprehensive is section 2.4 of the White Book (not an easy
read, though).  Do read V&R section 6.2 first.

I teach my students via series of examples: the general principles seem 
too hard for beginners.


On Tue, 4 May 2004, Martin Henry H. Stevens wrote:

> Does anyone have a good (and specific) reference for an explanation for 
> the calculation of degrees of freedom in treatment contrasts? I checked 
> the indexes of Venables and Ripley 2002, Crawley 2002, and Neter et al. 
> (Applied Linear Statistical Models, 4th ed.), as well as the lm code. I 
> would happily accept a "verbal" email explanation as well.
> Many thanks,
> Hank Stevens

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