RE: [R] formula in fixed-effects part of GLMM

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Tue 03 May 2005 - 05:06:21 EST


> From: Douglas Bates
>
> Henric Nilsson wrote:
> > On Mon, 2005-05-02, 17:24, Douglas Bates wrote:
> >
> >
> >>weihong wrote:
> >>
> >>>Can GLMM take formula derived from another object?
> >>>
> >>>foo <- glm (OVEN ~ h + h2, poisson, dataset)
> >>>
> >>># ok
> >>>bar <- GLMM (OVEN ~ h + h2, poisson, dataset, random =
> list (yr = ~1))
> >>>
> >>>#error
> >>>bar <- GLMM (foo$formula, poisson, dataset, random = list
> (yr = ~1))
> >>>#Error in foo$("formula" + yr + 1) : invalid subscript type
> >>
> >>That won't work without some tweaking of the GLMM function. In the
> >>0.95-1 and later versions of the lme4 package the
> capabilities of GLMM
> >>have been folded in to the lmer function and you would need
> to fit that
> >>model as
> >>
> >> lmer(OVEN ~ h + h2 + (1|yr), dataset, poisson)
> >>
> >>anyway.
> >
> >
> > I don't have access to the "White Book" right now (or R,
> for that matter),
> > but doesn't it say that something like the following works?
> >
> > fit.lm <- lm(y ~ x)
> > fit.glm <- update(fit.lm, class = "glm")
> >
> > But this isn't implemented in R, right? If one can make a
> wish, it would
> > be really nice being able to (using weihong's example):
> >
> > bar <- update(foo, . ~ . + (1|yr), class = "lmer")
> >
> >
> > //Henric
>
> It's not very convenient from the point of view of dispatch. The
> dispatch rules are such that the update method for the lm or glm class
> would need to be aware of the lmer class to be able to do
> this. The lm
> and glm classes predate lmer by a long time.

In that case, wouldn't lmer also need to be in "stats" (or somewhere "stats" can import from)?

Best,
Andy



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue May 03 05:11:46 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:32 EST