From: Douglas Bates
Henric Nilsson wrote:
On Mon, 2005-05-02, 17:24, Douglas Bates 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 =
#error
bar <- GLMM (foo$formula, poisson, dataset, random = list
#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
have been folded in to the lmer function and you would need
model as
lmer(OVEN ~ h + h2 + (1|yr), dataset, poisson)
anyway.
I don't have access to the "White Book" right now (or R,
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
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.