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:
Harold: Could you try the same set of models using lmer2? In July last year Sundar Dorai-Raj reported that the weights argument was not being used in the CRAN version of lmer (lme4_0.99875-6). Therefore, it's possible that you have actually observed the same phenomenon in lme4_0.99875-9. Sundar found that lmer2 did use weights, but it's not clear whether the weighted model is correct. The development version of lmer (lme4_0.999375-13) is much closer to the CRAN version of lmer2 than lmer. See his original post at: https://stat.ethz.ch/pipermail/r-sig-mixed-models/2007q3/000262.html Best wishes, Nick
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models