For a generalized linear model, the residual deviance is often described as having asymptotically a chi-squared null distribution.

I read that it's the case, for example

http://thestatsgeek.com/2014/04/26/deviance-goodness-of-fit-test-for-poisson-regression/

but I can't figure out why.

Can you help with an explanation?

**Contents**hide

#### Best Answer

Your original question was rather cryptic, but I will assume that you are referring to the total residual deviance that is computed when you fit a generalized linear model.

Your question alludes to a widespread misconception. Regardless of what you might have read, the residual deviance from a generalized linear model is not asymptotically chi-square distributed. Differences in deviances used to test nested hypotheses usually do follow a scaled chi-square distribution asymptotically, but the residual deviance itself does not.

There are in fact conditions under which the residual deviance can be shown to be chisquare, but these depend on "small dispersion" asymptotics rather than large n asymptotics. Essentially, these conditions require that each individual observation becomes informative rather than just that there are many observations.

In practice, there are two main special cases in which the glm residual deviance follows a chisquare distribution. One is Poisson regression when all the fitted values are reasonably large, say more 2 or 3. The other is binomial regression. For binomial regression, one needs that all the $np$ and $n(1-p)$ values are greater than about 2 or 3. In other words, $n$ should be reasonably large and none of the probabilities should be too close to 0 or 1. Negative binomial glm can also produce chisquare residual deviances but in this case the NB mean and size parameters both have to be reasonably large.

There are other cases when the residual deviance follows a scaled chisquare distribution, i.e., a chisquare distribution multiplied by an unknown dispersion parameter. This applies for normal and inverse Gaussian glms, or for gamma glms when the shape parameter not too small. In some rare cases the dispersion parameter can be known, so a chisquare residual deviance can arise after dividing out the dispersion.

These results are derived in Section 5.4 of my recent textbook with Peter Dunn (Dunn and Smyth; 2018).

**Reference**

Dunn, PK, and Smyth, GK (2018). *Generalized linear models with examples in R*. Springer, New York, NY. https://doi.org/10.1007/978-1-4419-0118-7