[R] re fit with binomial model (lme4)

Douglas Bates bates at stat.wisc.edu
Tue Apr 28 19:12:07 CEST 2009


Thanks for sending that, Ben.  I have incorporated a slightly modified
version, with attribution, in the lme4 sources.

On Tue, Apr 28, 2009 at 8:03 AM, Ben Bolker <bolker at ufl.edu> wrote:

> I think the following works, but use with caution -- I just
> wrote it last night.
>
> setMethod("refit", signature(object = "mer", newresp = "matrix"),
>          function(object, newresp, ...)
>      {
>        ## newresp <- as.double(newresp[!is.na(newresp)])
>        wts <- rowSums(newresp)
>        newresp <- newresp[,1]/wts
>        stopifnot(length(newresp) == object at dims["n"])
>        object at y <- newresp
>        object at pWt <- wts
>        lme4:::mer_finalize(object)
>      })




More information about the R-help mailing list