My dataset contains positive integer valued responses and so I want to use Poisson regression. However I am unable to interpret the output given by glm().

  • 1
    $\begingroup$ What exactly is unclear for you? By the way: the fact that your data consists of integers does not mean that Poisson GLM is appropriate model for it - it may be or it may be not... what do you mean by checking adequacy? $\endgroup$ – Tim Apr 21 '16 at 6:43

If you would like to check model adequacy, a good point to start is to plot residuals against fitted values:

In R you can use the following:

E1 <- resid(GLM1, type="pearson")
F1 <- fitted(GLM1, type="response")

  p1 <- scatter.smooth(F1, E1, cex.lab = 1.5, xlab="Fitted values", ylab="Pearson Residuals")
  abline(h = 0, v=0, lty=2); text(F1, E1, labels = row.names(df.exp2), pos = 4)

Here is a link that helps with interpretation.


Another important point in poisson regression is to check for overdispersion: you can use the following formula,

overdisp_fun <- function(model) {
  ## number of variance parameters in an n-by-n variance-covariance matrix
  vpars <- function(m) {
    nrow(m) * (nrow(m) + 1)/2
  # The next two lines calculate the residual degrees of freedom
  model.df <- sum(sapply(VarCorr(model), vpars)) + length(fixef(model))
  rdf <- nrow(model.frame(model)) - model.df
  # extracts the Pearson residuals
  rp <- residuals(model, type = "pearson")
  Pearson.chisq <- sum(rp^2)
  prat <- Pearson.chisq/rdf
  # Generates a p-value. If less than 0.05, the data are overdispersed.
  pval <- pchisq(Pearson.chisq, df = rdf, lower.tail = FALSE)
  c(chisq = Pearson.chisq, ratio = prat, rdf = rdf, p = pval)

if the p-value is lower than 0.05 you should handle overdispersion by either: fit a negative binomial GLM (i.e. glm.nb()) or add an observation-level random term (i.e. glmer(y ~ a+b+c+ (1|ID), family=poisson(link="log"), data).

In my opinion a good indicator for overdispersion might also be very high AIC values, and also very high Differences in AIC values of the model and the Null-model (fitted with intercept only). But i can't explain why, that was just a personal observation.

  • 2
    $\begingroup$ Thanks for this handy script. However, the in the script, it is mentioned that "Generates a p-value. If less than 0.05, the data are overdispersed." while the text below the script mentions that "if the p-value is greater than 0.05 you should handle overdispersion"? I guess the latter sentence should read "if the p-value is LOWER than 0.05 you should handle overdispersion" - correct? Thanks for clarifying! Diederik $\endgroup$ – Diederik Strubbe Jan 4 '17 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy