I'm creating Poisson GLMs in R. To check for overdispersion I'm looking at the ratio of residual deviance to degrees of freedom provided by summary(model.name).

Is there a cutoff value or test for this ratio to be considered "significant?" I know that if it's >1 then the data are overdispersed, but if I have ratios relatively close to 1 [for example, one ratio of 1.7 (residual deviance = 25.48, df=15) and another of 1.3 (rd = 324, df = 253)], should I still switch to quasipoisson/negative binomial? I found here this test for significance: 1-pchisq(residual deviance,df), but I've only seen that once, which makes me nervous. I also read (I can't find the source) that a ratio < 1.5 is generally safe. Opinions?

up vote 37 down vote accepted

In the R package AER you will find the function dispersiontest, which implements a Test for Overdispersion by Cameron & Trivedi (1990).

It follows a simple idea: In a Poisson model, the mean is $E(Y)=\mu$ and the variance is $Var(Y)=\mu$ as well. They are equal. The test simply tests this assumption as a null hypothesis against an alternative where $Var(Y)=\mu + c * f(\mu)$ where the constant $c < 0$ means underdispersion and $c > 0$ means overdispersion. The function $f(.)$ is some monoton function (often linear or quadratic; the former is the default).The resulting test is equivalent to testing $H_0: c=0$ vs. $H_1: c \neq 0$ and the test statistic used is a $t$ statistic which is asymptotically standard normal under the null.

Example:

R> library(AER)
R> data(RecreationDemand)
R> rd <- glm(trips ~ ., data = RecreationDemand, family = poisson)
R> dispersiontest(rd,trafo=1)

Overdispersion test

data:  rd
z = 2.4116, p-value = 0.007941
alternative hypothesis: true dispersion is greater than 0
sample estimates:
dispersion 
    5.5658 

Here we clearly see that there is evidence of overdispersion (c is estimated to be 5.57) which speaks quite strongly against the assumption of equidispersion (i.e. c=0).

Note that if you not use trafo=1, it will actually do a test of $H_0: c^*=1$ vs. $H_1: c^* \neq 1$ with $c^*=c+1$ which has of course the same result as the other test apart from the test statistic being shifted by one. The reason for this, though, is that the latter corresponds to the common parametrization in a quasi-Poisson model.

  • I had to use glm(trips ~ 1, data = data, family = poisson) (i.e. 1 rather than . for my data), but great, thank you – Phil Nov 6 at 15:38

An alternative is the odTest from the pscl library which compares the log-likelihood ratios of a Negative Binomial regression to the restriction of a Poisson regression $\mu =\mathrm{Var}$. The following result is obtained:

>library(pscl)

>odTest(NegBinModel) 

Likelihood ratio test of H0: Poisson, as restricted NB model:
n.b., the distribution of the test-statistic under H0 is non-standard
e.g., see help(odTest) for details/references

Critical value of test statistic at the alpha= 0.05 level: 2.7055 
Chi-Square Test Statistic =  52863.4998 p-value = < 2.2e-16

Here the null of the Poisson restriction is rejected in favour of my negative binomial regression NegBinModel. Why? Because the test statistic 52863.4998 exceeds 2.7055 with a p-value of < 2.2e-16.

The advantage of the AER dispersiontest is the returned object of class "htest" is easier to format (e.g. converting to LaTeX) than the classless 'odTest`.

Another alternative is to use the P__disp function from the msme package. The P__disp function can be used to calculate the Pearson $\chi^2$ and Pearson dispersion statistics after fitting the model with glm or glm.nb.

Yet another option would be to use a likelihood-ratio test to show that a quasipoisson GLM with overdispersion is significantly better than a regular poisson GLM without overdispersion :

fit = glm(count ~ treatment,family="poisson",data=data) 
fit.overdisp = glm(count ~ treatment,family="quasipoisson",data=data) 
summary(fit.overdisp)$dispersion # dispersion coefficient
pchisq(summary(fit.overdisp)$dispersion * fit$df.residual, fit$df.residual, lower = F) # significance for overdispersion

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.