I'm using a glm poisson regression in R, and I did a model diagnostics after my model fitting, but the residual distribution is so wierd. enter image description here


marked as duplicate by Glen_b Dec 11 '18 at 3:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


That is not unusual for a Poisson GLM: The Poisson GLM is a model used when the response variable is discrete (specifically, a non-negative integer), and often the explanatory variables are continuous. With this type of data and model it is not unusual to get lines of residual points that correspond to particular discrete response values, but with varying explanatory variables. In your initial residual plot, each of those lines of residuals corresponds to a particular value of the response variable, and the variation in the lines reflects the variation in the continuous explanatory variables. As you can see, the model has fit these lines so that it gives a residual mean that is roughly zero. That is exactly what you would expect from a Poisson GLM.

In this particular case there is not really any clear evidence to diagnose a model departure (though you might want to try some other related models as alternatives). For a Poisson GLM with a small number of response values we do not generally expect the deviance residuals to be normally distributed. From your plots it looks like there are only 8-10 outcomes for the response variable in your data, so the clear lines of residuals, and corresponding "kinky" QQ-plot are to be expected. If you want to test the fit of your model you could use a negative binomial GLM to generalise your analysis, to see if there is any over-dispersion.

  • $\begingroup$ Thanks a lot for your great interpretation.Well my response variable is "offspring" so they are indeed only 8-10 outcomes.I think there's no over-dispersion in my data because "deviance(model)/df.residual(model)=0.68" . $\endgroup$ – geeh Dec 11 '18 at 5:09
  • $\begingroup$ @geeh: Now I'm feeling very smug at being able to tell how many response outcomes you had. ;) In regard to over-dispersion, that is not something that can be checked by looking at the goodness-of-fit statistics of the Poisson GLM. $\endgroup$ – Reinstate Monica Dec 11 '18 at 5:17
  • $\begingroup$ Sorry,I'm not quite understand what you said.How should I check over-dispersion in R, I thought it was over-dispersion if deviance(model)/df.residual(model) >1, isn't it? $\endgroup$ – geeh Dec 11 '18 at 5:55
  • $\begingroup$ Over-dispersion refers to a variance higher than in the Poisson model (where the variance is constrained to be equal to the mean. It is generally better to fit a negative binomial mode (see link in answer) which removes this constraint and allows for a free variance parameter. Fitting with this model will give an estimate of variance. $\endgroup$ – Reinstate Monica Dec 11 '18 at 7:11

These standard residual plots can be difficult to make sense of. It might be easier to explore plots of standardized residuals simulated from your fitted model. If your glm model object is called mod.glm, then:



res.sim <- simulateResiduals(mod.glm)

plotSimulatedResiduals(res.sim) # or plot(res.sim)

See http://www.flutterbys.com.au/stats/tut/tut10.6a.html for a detailed example.

For a correctly specified Poisson regression model, you would expect a uniform (flat) distribution of the simulated residuals (not a normal distribution).

The last command listed above creates a qq-plot to detect overall deviations from the expected (uniform) distribution, and a plot of the residuals against the fitted values. As explained at https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html, the latter plot is accompanied by the fitted 0.25, 0.5 and 0.75 quantile regression lines; these lines "provide a visual aid in detecting deviations from uniformity in y-direction" (where y refers to the response variable in the Poisson regression model). "These lines should be straight, horizontal, and at y-values of 0.25, 0.5 and 0.75. Note, however, that some deviations from this are to be expected by chance, even for a perfect model, especially if the sample size is small."

You could also plot the simulated residuals against each of the predictor variables in your model:

plotResiduals(YOURPREDICTOR, res.sim$scaledResiduals)

In these plots of residuals against each predictor, you would expect uniformity in the y direction if the Poisson regression model is correctly specified.

You can also test for overdispersion, zero-inflation, etc., using functions available in the DHARMa package.


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