Skip to content
Prev 898 / 20628 Next

Bug in weights in lmer

Sorry that I haven't responded on this thread previously.  I have had
two computers, a desktop at my office and a desktop at home, go south
in the same week.  I have been reduced to using an old Dell laptop
running Windows as my primary computer at work.  Those of you who know
my affection for Windows can imagine how cheerful that makes me.  :-)

Thank you for pointing out the problem with the weights, Nick, and for
including the example.  I haven't worked out what is going wrong yet
because i am still working on some other problems and some examples.
I can tell you where the pieces of information are in a fitted lmer
model (from the version on R-forge) and that may help to isolate the
problem.  Fixed weights are stored in the pWt slot and used to
calculate a weighted residual sum of squares, the "wrss" element in
the deviance slot.  (The name "pWt" comes from the fact that these are
called the "prior weights" for a generalized linear model.)  When
prior weights are not used this slot has length zero.

The mle  of sigma^2 in the unweighted case is the penalized weighted
residual sum of squares (the "pwrss" element of the deviance slot)
divided by the number of observations.  The "penality" is a quadratic
form in the random effects.  It can be expressed as the squared length
of the orthogonal random effects in the u slot.

It is likely that this estimate should be  the pwrss divided by either
the sum of the elements in pWt or the sum of the squares of the
elements in pWt when we don't have unit weights.  Do either of those
numbers seem reasonable?

Because the variance components are calculated relative to the
estimate of sigma^2, changing sigma^2 will change those too.
On 4/24/08, Nick Isaac <njbisaac at googlemail.com> wrote: