[R] How to tell if there is overdispersion in a GLMM?
Ben Bolker
bbolker at gmail.com
Wed Feb 4 01:28:46 CET 2015
maggy yan <kiotoqq <at> gmail.com> writes:
>
> I read something on http://glmm.wikidot.com/faq, under "How can I deal with
> overdispersion in GLMMs?":
>
> library(lme4) ## 1.0-4set.seed(101)
> d <- data.frame(y=rpois(1000,lambda=3),x=runif(1000),
> f=factor(sample(1:10,size=1000,replace=TRUE)))
> m1 <- glmer(y~x+(1|f),data=d,family=poisson)
> overdisp_fun(m1)
## chisq ratio rdf p
> ## 1026.7780815 1.0298677 997.0000000 0.2497659
> library(glmmADMB) ## 0.7.7
> m2 <- glmmadmb(y~x+(1|f),data=d,family="poisson")
> overdisp_fun(m2)
## chisq ratio rdf p
> ## 1026.7585031 1.0298480 997.0000000 0.2499024
>
> In both case, the chisq is > rdf, does it mean there is over dispersion?
>
> thanks for any help
>
Off-topic here, but:
the residual deviance is greater than the residual degrees
of freedom, but only a little bit (3%). So, technically, there
is overdispersion here, but not more than expected if the underlying
data generating process was not overdispersed
(p-value = 0.25). Which is a good thing
because the data are generated from a Poisson distribution, so
the null hypothesis is actually true.
More information about the R-help
mailing list