[R] how calculation degrees freedom

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Jan 28 01:33:46 CET 2006

Douglas Bates <dmbates at gmail.com> writes:

> > I'm reasonably convinced by now that the relevant denominator is
> > always the residual variance, but it is happening via deep magic that
> > I don't quite understand... (and is quite counterintuitive to people
> > who are used to the traditional ANOVA decompositions in orthogonal
> > designs)
> Not deep magic for you, Peter.  The slot called rXy in the fitted
> model is analogous to the first p components of the "effects"
> component in an lm model.  Cut it up according to the terms and sum
> the squares.

Yes, that's the bit I do understand. The magic bit is that at that
point, you have removed the effect of the Z, in a penalized fashion,
and somehow this manages to give the right thing.
Consider a balanced design with a number of observations for each
subject, and subjects divided into groups, subject effects considered
random. In traditional aov, you end up dividing the "group" SS by the
"subject" SS. However in lmer, you remove the subject effect (in a
BLUP sort of way) from everything and this gets the "group" SS
adjusted so that it matches the residual SS instead. I'm quite
prepared to believe it; I just don't think it is trivial.

   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