Message-ID: <40e66e0b0904281012le789766s21fb2d12dce6b735@mail.gmail.com>
Date: 2009-04-28T17:12:07Z
From: Douglas Bates
Subject: re fit with binomial model (lme4)
In-Reply-To: <23276751.post@talk.nabble.com>
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)
> ? ? ?})