[R] formula in fixed-effects part of GLMM

Douglas Bates bates at stat.wisc.edu
Mon May 2 17:24:50 CEST 2005


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.




More information about the R-help mailing list