[R] formula in fixed-effects part of GLMM
Henric Nilsson
henric.nilsson at statisticon.se
Mon May 2 19:27:25 CEST 2005
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
More information about the R-help
mailing list