[R-sig-ME] handling overdispersion in poisson random effects models

Jarrod Hadfield j.hadfield at ed.ac.uk
Fri Jul 1 14:10:51 CEST 2011


Hi,

Updating to the current version of lme4 should do it - I think.

Jarrod

Quoting "O'Reilly, Kathleen M" <k.oreilly at imperial.ac.uk> on Fri, 1  
Jul 2011 12:04:54 +0000:

> Dear R users,
>
> Apologies in advance if this is really obvious to solve.
>
> I've following previous threads on handling overdispersion in  
> poisson random effects models, and the suggestions have been very  
> helpful.
>
> Following on from R help thread "Mixed-effects model for  
> overdispersed count data?" and some code written by other users, To  
> account for overdispersion through having each individual as a  
> random effect, the following code should work:
>
> data(cbpp)
> names(cbpp)
> cbpp$id<-1:(dim(cbpp)[1])
> #without overdispersion
> M1 <- lmer(incidence~size+(1|herd),data=cbpp,family=poisson)
> #to include overdispersion
> M2 <- glmer(incidence~size+(1|herd)+(1|id),data=cbpp,family=poisson)
> summary(M2)
>
> However I get the following error when running M2
> "Error in function (fr, FL, glmFit, start, nAGQ, verbose)  :
>   Number of levels of a grouping factor for the random effects
> must be less than the number of observations"
>
> Other people seem to run the equivalent of M2 without error.
>
> Could someone please explain what I'm missing.
>
> Thanking you in advance for your help,
>
> Kath O'Reilly
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




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