[R] formula in fixed-effects part of GLMM

weihong weihong at ualberta.ca
Sat Apr 30 19:31:14 CEST 2005


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

I am using R2.1.0, lme4 0.8-2, windows xp.  Below is a dataset if you need (yr
is a factor).

> dataset
   OVEN  h  h2 yr
1     2 30 900  0
2     3 30 900  1
3     4 30 900  2
4     3 30 900  3
5     3 30 900  4
6     1 25 625  0
7     2 25 625  1
8     1 25 625  2
9     1 25 625  3
10    2 25 625  4

Thanks ahead!

Weihong Li
Undergraduate student
University of Alberta




More information about the R-help mailing list