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

From: Henric Nilsson <henric.nilsson_at_statisticon.se>
Date: Tue 03 May 2005 - 03:27:25 EST

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



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 03:32:04 2005

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