[R-sig-ME] Nested fixed variable in glmer

Bruno Moreira brjmoreira2 at gmail.com
Fri Mar 12 11:50:02 CET 2010


Dear all,

I have data with the following structure (data is not real, just an example)

SUCESS <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30)
FAIL <- c(30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1)
sf <- cbind(s= SUCESS, f= FAIL)
sp <- c("A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","B","B","B","B","B","B","B","B","B","B","B","B","B","B","B")
ind <- c("1","1","1","1","1","2","2","2","2","2","3","3","3","3","3","4","4","4","4","4","5","5","5","5","5","6","6","6","6","6")
treat <- c("A","A","A","B","B","A","A","A","B","B","A","A","A","B","B","A","A","A","B","B","A","A","A","B","B","A","A","A","B","B")
tlevel <- c("AA","AB","AC","BA","BB","AA","AB","AC","BA","BB","AA","AB","AC","BA","BB","AA","AB","AC","BA","BB","AA","AB","AC","BA","BB","AA","AB","AC","BA","BB")


Individual (ind) is random
The response variable is sf and the explanatory variables are
species(sp) and treatment(treat). treatments (A and B) have different
levels (tlevel)

I want to nest tlevels in treat, but i do not know if this is the
right way as it gives an error message:

library(lme4)
r0 <- glmer(sf ~ 1 + (1|ind), family="binomial")
r1 <- glmer(sf ~ sp + treat/tlevel + tlevel/treat*sp + (1|ind),
family="binomial")

anova(r0,r1)

And it gives me this error message:
In mer_finalize(ans) : gr cannot be computed at initial par (65)

I am new with this and i would  appreciate any help.

thanks

bruno




More information about the R-sig-mixed-models mailing list