# [R] residual df in lmer and simulation results

Douglas Bates bates at stat.wisc.edu
Fri Jul 28 18:48:30 CEST 2006

On 7/26/06, Bill Shipley <bill.shipley at usherbrooke.ca> wrote:
> Hello.  Douglas Bates has explained in a previous posting to R why he does
> not output residual degrees of freedom, F values and probabilities in the
> mixed model (lmer) function:  because the usual degrees of freedom (obs -
> fixed df -1) are not exact and are really only upper bounds.  I am
> interpreting what he said but I am not a professional statistician, so I
> might be getting this wrong...
> Does anyone know of any more recent results, perhaps from simulations, that
> quantify the degree of bias that using such upper bounds for the demoninator
> degrees of freedom produces?  Is it possible to calculate a lower bounds for
> such degrees of freedom?

I can give another perspective on the issue of degrees of freedom for
a linear mixed model although it probably doesn't address the question

The linear predictor in a mixed model has the form X\beta + Zb where
\beta is the fixed-effects vector and b is the random-effects vector.
The fitted values, y-hat, are the fitted values from a penalized least
squares fit of the response vector, y, to this linear predictor
subject to a penalty on b defined by the variance components.  When
the penalty is large, the fitted values approach those from the
ordinary least squares fit of y on X\beta only.  When the penalty is
small, the fitted values approach those from an unpenalized least
squares fit of y on the linear predictor.  (In this case estimates of
the coefficients are not well defined because the combined matrix
[X:Z] is generally rank deficient but the fitted values are well
defined.)

If the rank of X is p and the rank of [X:Z] is r then the effective
number of parameters in the linear predictor for the penalized least
squares fit is somewhere between p and r.  One way of defining the
effective number of parameters is as the trace of the hat matrix for
the penalized least squares problem.  This number will change as the
variance components change and is usually evaluated at the estimates
of the variance components.  This is exactly what Spiegelhalter, Best,
Carlin and van der Linde (JRSSB, 64(4), 583-639, 2002) define to be
their p_D for this model.  The next release of the lme4/Matrix
packages will include an extractor function to evaluate the trace of
the hat matrix for a fitted lmer model, using an algorithm due to
Jialiang Li.

This effective number of parameters in the linear predictor is like
the degrees of freedom for regression.  In the limiting cases it is
exactly the degrees of freedom for regression.  One might then argue
that the degrees of freedom for residuals would be n - hat trace and
use this for the denominator degrees of freedom in the F ratios.
However,  this number does not vary with the numerator term and many
people will claim that it must.  (I admit to being a bit perplexed as
to why the denominator degrees of freedom should change according to
the numerator term when the denominator of the F ratio itself doesn't
change, but many people insist that this is the way things must be.)

So it is possible to calculate a number that can reasonably be
considered to be the
degrees of freedom for the denominator that is actually used in the F
ratios but this will not correspond to what many people will insist is
the "obviously correct" number of degrees of freedom.