Negative binomial regression
Negative binomial regression models counts whose spread exceeds the Poisson assumption, with an extra parameter for that spread.
Fit
When to use it, and when not to
Use it when
- Your outcome is an event count with extra variation after predictors are included.
- A quadratic mean-variance relation is a plausible working model.
Not when
- The outcome is time to a first event with censoring. Use a survival model. Read: Cox proportional hazards regression
- Repeated counts from one person remain correlated. Use a count model that also accounts for that dependence. Read: Mixed-effects models
Before you start
What you need
- Counts and observation windowsoutcomeTypeDefine repeat events and when counting starts and stops.
- Exposure time and target contrastsummaryMeasureUse a log-time offset for rates. Equal windows can support a count comparison.
- The variance model and planning assumptionsRecord expected counts, extra variation and predictor effects. Plan power or precision for the intended design.
- The log mean is correctly specified.How to check: Check fitted counts across predictor values and observation windows.
- The NB2 variance is the mean plus dispersion times the squared mean.How to check: Check whether extra spread grows with the mean. Software may label dispersion or its reciprocal differently.
- The dispersion term alone does not model repeated-observation correlation.How to check: Identify shared people and sites before choosing a clustered analysis.
Plain language
How it works
This article uses NB2, one negative binomial model. It keeps a log mean and adds a dispersion parameter. Its variance is mean plus dispersion times mean squared. A log-time offset converts a count model into a rate model. Exponentiated slopes compare rates at equal predictor values.
Gardner and colleagues describe extra between-person variation. Ver Hoef and Boveng show why the variance relation changes how counts contribute to a fitted model. Extra spread and within-person dependence are different problems. Negative binomial dispersion alone does not solve the second.
Worked example
A worked example
- Setting
- A model of yearly exacerbation counts uses the NB2 variance and independent people.
- Question
- What does an assumed treatment coefficient imply?
- Approach
- Assume a fitted comparison mean of 4, a log rate ratio of log 0.75, and dispersion 0.5. Assume coefficient standard error 0.20.
- Result
- The fitted mean changes from 4 to 3 events per year, a change of -1. The comparison variance is 12.
- What it means
- The rate ratio is 0.75. Its exponentiated 95% Wald interval is 0.51 to 1.11. The interval allows a higher or lower rate.
In practice
Recent studies PubMed search · not vetted
Watch out
Common mistakes
The one to remember
Extra dispersion does not account for dependence between repeated counts. Negative binomial regression needs its own mean and variance assumptions; many zeros alone do not establish a separate structural-zero process.
- Choosing the model because the raw variance exceeds the raw mean.Instead: Assess extra spread after fitting the predictors and exposure time.
- Calling every zero a structural zero.Instead: Examine the event process; an ordinary count distribution can produce many zeros.
- Using a single-proportion interval for a rate ratio.Instead: Use profile-likelihood or Wald intervals for the regression coefficient and exponentiate the limits.
Inside Mallard
How Mallard uses this
Mallard links named negative binomial regression to this method. Its method list and code entry have no dedicated catalog sizing formula.
negative-binomial-rate-ratio).analysis.negative_binomial_regression, the id a plan cue records.Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- Regression analyses of counts and rates: Poisson, overdispersed Poisson, and negative binomial models (opens in a new tab) · Psychol Bull · doi 10.1037/0033-2909.118.3.392
- Quasi-Poisson vs. negative binomial regression: how should we model overdispersed count data? (opens in a new tab) · Ecology · doi 10.1890/07-0043.1