[R] Problem to get a simple Analysis of Variance table with lmer()

Julien Beguin julien.beguin.1 at ulaval.ca
Thu Apr 23 16:27:54 CEST 2009


Dear R users,

Is someone know how to get a simple analysis of variance table using other
random distribution than normal (ex: Poisson or Binomial)? When I try, I
recieved this message: (See my R code below)

--------------------- R response ----------------------------
Erreur dans anova(fit.poisson) :
  single argument anova for GLMMs not yet implemented

OR

Erreur dans anova(fit.binomial) :
  single argument anova for GLMMs not yet implemented
-------------------------------------------------------------

Here is the code that I used for a quick simulation of my data and for a
gaussian distribution I have no problem to get a simple table but not when I
use poisson or binomial distribution... Is it possible that it is effectively
not yet implemented in the lmer package? or did I make something wrong?

------------------------- My R code ---------------------------------
z1<-as.factor(rep(seq(1:2), each=48)) # first random factor with 2 levels
z2<-as.factor(rep(seq(1:16), each=6)) # second random factor (= repetition)
x1<-as.factor(rep(seq(1:3), 32)) # first fixed factor with three levels
x2<-as.character(rep(rep(seq(c("O","N")), each=3), 16)) # second fixed factor
                                                          with 2 levels
y.integer<-as.integer(runif(96, 0, 25)) # response variable (integer)
y.binary<-as.integer(rbinom(96, 1,0.5)) # response variable (binary)
data.test<-as.data.frame(cbind(z1,z2,x1,x2,y))
data.test$y<-as.integer(data.test$y)

The models that I have tested:

fit.normal<-lmer(y.integer~x1*x2 + (1|z1/z2/x1), data=data.test,
family=gaussian)
anova(fit.normal)
summary(fit.normal)

fit.poisson<-lmer(y.integer~x1*x2 + (1|z1/z2/x1), data=data.test,
family=poisson(link = "log"))
anova(fit.poisson)
summary(fit.poisson)

fit.binomial<-lmer(y.binary~x1*x2 + (1|z1/z2/x1), data=data.test,
family=binomial(link = "logit"))
anova(fit.binomial)
summary(fit.binomial)
-----------------------------------------------------------------------

Thank's in advance for you amswer.

Julien

--
Julien Beguin
Etudiant au doctorat
Faculté de Foresterie et de Géomatique
Université Laval, local 2113
2405 rue de la Terrasse, G1V 0A6 Québec (Qc)
Tel: (418) 656-2131 poste 2620
http://www.cen.ulaval.ca/anticosti/jbeguin.html




More information about the R-help mailing list