REGRESSION MODELLING FOR HEALTH PRACTITIONERS · CHAPTER 6
Poisson and Negative Binomial Regression
Count outcomes in health research
In health studies it is common to measure outcomes as counts of events: number of doctor visits, hospital readmissions, episodes of asthma, or adverse drug reactions. These data are non‐negative integers and often represent rates over a specified exposure time (e.g., person–years of follow‐up). Using linear regression to model counts is inappropriate because it can predict negative values and ignores the discrete nature of the data. As noted by UCLA’s count regression tutorial, count data are common across disciplines and count models are preferable to ordinary least squares; they can also incorporate exposure to model rates. The canonical count model is the Poisson regression; however, when the variance of the counts exceeds the mean (overdispersion), a negative binomial model may provide a better fit.
Poisson regression model
Let denote the count of events for subject observed over exposure . Under the Poisson model, with mean equal to variance. The log of the mean count is modelled as a linear predictor: where is an offset ensuring that counts are adjusted for differing exposure times. Exponentiating a coefficient yields a rate ratio. For example, represents the multiplicative change in the rate of events for a one–unit increase in .
Negative binomial regression
Poisson models assume the variance equals the mean. In practice, health count data often exhibit overdispersion due to unobserved heterogeneity or clustering. The negative binomial distribution introduces a dispersion parameter such that . When , the negative binomial reduces to the Poisson. Negative binomial regression uses the same log–linear predictor as the Poisson model but estimates from the data.
Worked example
Suppose we study the number of emergency department visits for asthma
over one year for 500 children. Predictors include exposure to tobacco
smoke (Smoke), age (Age), and an exposure
offset equal to follow‐up months. We model the rate of visits using
Poisson and negative binomial regression and compare the fit.
Worked example
R
library(MASS) # for glm.nb
# Assume df has: Visits (count), Smoke (0/1), Age, months (exposure time)
fit_pois <- glm(Visits ~ Smoke + Age + offset(log(months)),
family = poisson, data = df)
summary(fit_pois)
exp(coef(fit_pois)) # rate ratios
fit_nb <- glm.nb(Visits ~ Smoke + Age + offset(log(months)), data = df)
summary(fit_nb)
exp(coef(fit_nb)) # rate ratios under NB model
Python (statsmodels)
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
# df: DataFrame with columns Visits, Smoke, Age, months
# Poisson model
model_p = smf.glm('Visits ~ Smoke + Age', data=df,
family=sm.families.Poisson(),
offset=np.log(df['months']))
result_p = model_p.fit()
print(result_p.summary())
print(np.exp(result_p.params))
# Negative binomial (NB2) model
model_nb = smf.glm('Visits ~ Smoke + Age', data=df,
family=sm.families.NegativeBinomial(),
offset=np.log(df['months']))
result_nb = model_nb.fit()
print(result_nb.summary())
print(np.exp(result_nb.params))
Julia
using DataFrames, GLM, Distributions, StatsBase
# df: DataFrame with Visits, Smoke, Age, months
fm = @formula(Visits ~ Smoke + Age + offset(log(months)))
# Poisson model
fit_pois = glm(fm, df, Poisson(), LogLink())
coeftable(fit_pois)
exp.(coef(fit_pois))
# Negative binomial model (NB2)
fit_nb = glm(fm, df, NegativeBinomial(), LogLink())
coeftable(fit_nb)
exp.(coef(fit_nb))
Interpretation
Interpretation. A rate ratio greater than 1 indicates an increased rate of events associated with the predictor; less than 1 indicates a reduction. For example, if , children exposed to smoke have 50% more asthma visits per month than unexposed children, adjusting for age.
Model choice. Compare Poisson and negative binomial fits using information criteria (AIC/BIC) and residual plots. Substantial overdispersion suggests the negative binomial model.
Offset. Always include an offset for exposure time or population at risk to model rates correctly. Count models incorporate the log of exposure with coefficient constrained to one.
Zero inflation. When there are more zeros than expected under a Poisson model (e.g., many individuals have zero visits), consider zero‐inflated or hurdle models.
Exercises
Exercises
Using the simulated asthma dataset described above, fit Poisson and negative binomial models. Report the estimated rate ratios and compare AIC values. Which model fits better? Examine residuals to assess model fit.
Construct a dataset with 100 individuals where counts follow a Poisson distribution with mean , and simulate a predictor that increases by a factor of 1.5 when . Fit a Poisson regression and verify that the estimated rate ratio is close to 1.5.
Explain why ordinary least squares regression is inappropriate for count data. Illustrate with a simple example in which OLS predicts negative counts.
Investigate the impact of overdispersion by generating data with variance twice the mean. Fit both Poisson and negative binomial models and compare the estimated dispersion.
Code examples use illustrative datasets. Supply data with the named columns to run them.