[R] Conservative "ANOVA tables" in lmer

Douglas Bates bates at stat.wisc.edu
Thu Sep 7 14:59:58 CEST 2006

```Thanks for your summary, Hank.

On 9/7/06, Martin Henry H. Stevens <hstevens at muohio.edu> wrote:
> Dear lmer-ers,
> My thanks for all of you who are sharing your trials and tribulations
> publicly.

> I was hoping to elicit some feedback on my thoughts on denominator
> degrees of freedom for F ratios in mixed models. These thoughts and
> practices result from my reading of previous postings by Doug Bates
> and others.

> - I start by assuming that the appropriate denominator degrees lies
> between n - p and and n - q, where n=number of observations, p=number
> of fixed effects (rank of model matrix X), and q=rank of Z:X.

I agree with this but the opinion is by no means universal.  Initially
I misread the statement because I usually write the number of columns
of Z as q.

It is not easy to assess rank of Z:X numerically.  In many cases one
can reason what it should be from the form of the model but a general
procedure to assess the rank of a matrix, especially a sparse matrix,
is difficult.

An alternative which can be easily calculated is n - t where t is the
trace of the 'hat matrix'.  The function 'hatTrace' applied to a
fitted lmer model evaluates this trace (conditional on the estimates
of the relative variances of the random effects).

> - I then conclude that good estimates of P values on the F ratios lie
> between 1 - pf(F.ratio, numDF, n-p) and 1 - pf(F.ratio, numDF, n-q).
> - I further surmise that the latter of these (1 - pf(F.ratio, numDF,
> n-q)) is the more conservative estimate.
>
> When I use these criteria and compare my "ANOVA" table to the results
> of analysis of Helmert contrasts using MCMC sample with highest
> posterior density intervals, I find that my conclusions (e.g. factor
> A, with three levels, has a "significant effect" on the response
> variable) are qualitatively the same.