Skip to content
Prev 178641 / 398506 Next

re fit with binomial model (lme4)

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)
      })

  Ben Bolker