[R-sig-ME] lmer bug / feature

Douglas Bates bates at stat.wisc.edu
Tue Apr 8 23:58:04 CEST 2008


On 4/8/08, Robert Kushler <kushler at oakland.edu> wrote:

>  Well, I left you alone for *two* days.

>  1) The "Groups" labels in the Random effects section of the lmer
>    output have vanished in rel -12 (but I think this relates
>    to the structural changes introduced in rel -11).

That is indeed a bug.  Thanks for reminding me.  I will fix that.

>  2) The "interaction" variance is listed first for models
>    of the form  "Y ~ (1 | A) + (1 | B) + (1 | A:B)".

>    Similarly, the "inner" variance appears first in nested
>    models like

>       "Y ~ (1 | A/B)"  or  "Y ~ (1 | A) + (1 | A:B)" (implicit nesting)
>    or
>       "Y ~ (1 | A) + (1 | B)" (explicit nesting).

>    It would seem more "user friendly" to list the terms in the
>    order they appear in the model formula.  (This will be less
>    of a problem if issue #1 is resolved.)

John Maindonald has also pointed out that the ordering of the terms in
the VarCorr display is counter-intuitive.

The ordering of the terms is not arbitrary - they are ordered by
decreasing numbers of levels in the grouping factor.  At least that
was the intention.  Versions before -11 had a bug in the code and the
terms were not being reordered when they should have been.  I fixed
that bug but, in the process, introduced bug #1.

This ordering is chosen to facilitate the selection of a fill-reducing
permutation for the sparse Cholesky decomposition and I would be
reluctant to change that part of the code.  For big data sets and
models with multiple random effects terms a good fill-reducing
permutation is the key to saving both time and memory when fitting the
model.

I'm not sure how much work would be involved in reordering the terms
for display.

I'll fix the first bug.  Patches for the second infelicity (this
really is an infelicity, not a bug) would be gladly accepted.  The
relevant function is the hidden function formatVC in lme4/R/lmer.R.
The first argument is a list and the fix may be as simple as reversing
the order of the elements of that list before operating on it.  This
would create an ordering by increasing numbers of levels, not
necessarily the ordering of the terms in the original formula.  You
would need to work a bit harder to get that.

I have taken the liberty of cc:'ing this reply to the R-SIG-Mixed-Models list.




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