[R-sig-ME] hatTrace (was: no subject)

Douglas Bates bates at stat.wisc.edu
Fri Jul 11 16:23:36 CEST 2008

On Mon, Jul 7, 2008 at 8:35 AM, David Paez <david.paez.1 at ulaval.ca> wrote:
> Hi all,

> In the newest version of lme4 the function hatTrace seems to be hidden away so
> that R doesn't recognize it anymore.

It is there although it is not exported in the NAMESPACE file and it begins with


so it doesn't really help much.

> Does someone know another method that gets to the trace of the hat matrix so
> that I can calculate its DF?

It is reasonably easy to write down a formula for it but providing a
calculation method that is practical for complex models fit to large
data sets is not so easy. Version 0.999875-21 of the lme4 package,
currently on R-forge and soon to be on CRAN, has a version of the
formula at the end of the PLSvGLS vignette.  The problem with
evaluating the formula is that a very large sparse system of equations
must be solved and doing that in the naive way can take a long time.

More information about the R-sig-mixed-models mailing list