[R-sig-ME] lmer/lmer2 & zero weights

Douglas Bates bates at stat.wisc.edu
Thu Feb 26 20:59:43 CET 2009


On Thu, Feb 26, 2009 at 12:34 PM,  <Richard.Silverwood at lshtm.ac.uk> wrote:
> Dear all,
>
> I simple query from a simple mind. Please humour me.
>
> I recently (possibly foolishly) updated my lme4 package. I have lots of code which calls lmer2. I understand that lmer2 is now deprecated so these calls produce an equivalent call to lmer. However, lmer2 accepted zero weights whilst lmer appears not to ("Error in lmerFrames(mc, formula, contrasts) : negative weights or weights of zero are not allowed"). Is this correct? Is there a reason for this difference?

To tell you the truth I'm not sure whether weights of zero in lmer
would cause problems.  It is fairly easy to find the piece of code
that checks for negative or zero weights and change it to just check
for negative weights then see what the effect is.  As the message
says, the check is in the (hidden) function named lmerFrames near the
end

    ## check weights and offset
    if (any(wts <= 0))
        stop(gettextf("negative weights or weights of zero are not allowed"))
    if(length(off) && length(off) != NROW(Y))
        stop(gettextf("number of offsets is %d should equal %d (number
of observations)",
                      length(off), NROW(Y)))




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