Negative Binomial Regression
When the variation in event counts is larger than the mean, this method accounts for overdispersion while analyzing how predictors affect the expected number of events.
Why do monthly accident counts differ so much even between areas with similar traffic? Do accidents happen more often when there are more rainy days? Some areas have unusually many accidents—how should we analyze these differences?
For questions like these, the method for analyzing the relationship between predictors and accident counts in data where the variation in counts is larger than the mean is negative binomial regression.
Poisson regression assumes that, for the same predictor values, the mean and variance of the counts are equal. In real accident data, however, unobserved differences between areas and various other factors can make the variance larger. Negative binomial regression captures this overdispersion with an additional dispersion parameter.
It is useful in studies where count data such as traffic accidents, hospital visits, absences or public complaints fluctuate more than expected. In this article, using monthly traffic accident counts by area as an example, we look at how the model works, the effects of traffic volume, road structure and rainy days, the incidence rate ratio (IRR), how it differs from Poisson regression, and how to run diagnostics.
What is negative binomial regression?
A regression model for count data whose variance is larger than its mean.
Negative binomial regression analyzes outcomes recorded as integers of 0 or more, such as numbers of accidents, hospital visits or breakdowns. It is especially useful when, for the same predictor values, the actual counts vary more than Poisson regression allows.
In the standard NB2 model, this is expressed as conditional variance = conditional mean + α × conditional mean². Here α is the dispersion parameter that captures the size of the extra variation.
Negative binomial regression estimates the effects of predictors on event counts while also accounting for extra variation that the mean alone cannot explain.
Why do we need negative binomial regression?
To estimate standard errors and uncertainty more appropriately in accident data with large variation.
If accident counts do not cluster fairly evenly around the same mean but are widely scattered, Poisson regression can give standard errors that are too small. In that situation there is a risk of wrongly concluding that differences are statistically significant.
Negative binomial regression models overdispersion with a separate dispersion parameter. However, do not choose it right away just because the variance of all counts is larger than the mean; you should look at the overdispersion that remains after accounting for predictors such as traffic volume and road environment.
How does negative binomial regression work?
It links the expected accident count through a log function and also estimates the extra variance.
① Define the unit of analysis and the event count
Set the number of traffic accidents in one area during one month as the outcome. Because the same area is observed over several months, also check the repeated-measures structure.
② Set the predictors and reference units
Enter traffic volume as the log of its ratio to 30,000 vehicles, arterial road share in units of 10 percentage points, and rainy days in units of 1 day.
③ Express the expected count with a log link
log(expected accidents) = β₀ + β₁×log(traffic volume/30,000) + β₂×arterial road share (per 10 pp) + β₃×rainy days. Exponentiating a coefficient gives the ratio of counts when other conditions are the same.
④ Estimate the coefficients and dispersion parameter α
Standard NB2 regression estimates the regression coefficients and the overdispersion parameter together by maximum likelihood.
⑤ Check residuals and model fit
Review the gap between predictions and observations, repeated observations by area, the share of excess zeros, and fit compared with Poisson regression.
Real-world example: monthly traffic accidents by area
See how much accident counts change with traffic volume, road structure and rainy days.
We generated 192 area-month records from 16 hypothetical areas observed over 12 months. This is simulated learning data in which accident counts vary more than the mean.
“How do monthly traffic accident counts change as traffic volume, arterial road share and rainy days change?”
| Item | Description |
|---|---|
| Unit of analysis | Area × month |
| Observations | 192 (16 areas × 12 months) |
| Outcome | Monthly traffic accidents |
| Traffic volume | Average daily traffic for the month in that area |
| Road structure | Arterial road share (per 10 pp) |
| Weather | Rainy days in that month |
| Mean accident count | 39.7 accidents |
| Overall variance of accident counts | 822.9 |
Comparing only the overall mean and variance of the observations also includes differences in the predictors. For model choice, conditional variance and residual diagnostics matter more.
What does it mean that the variance of accident counts is larger than the mean?
Event counts are spread more widely than Poisson data with the same mean.
In this example, the overall mean accident count is 39.7 and the overall variance is 822.9. The variance is larger than the mean, but differences in traffic volume and environment across areas can also create this gap.
For a Poisson regression fitted with the same predictors, Pearson χ²/residual degrees of freedom is 17.34. A value well above 1 can be taken as a sign of conditional overdispersion, and you should check the residuals and the data structure together.
How do you interpret negative binomial coefficients and IRRs?
The IRR shows by what factor the expected accident count changes when the other predictors are held fixed.
| Predictor | Coefficient β | IRR | 95% CI |
|---|---|---|---|
| log(traffic volume/30,000) | +0.539 | 1.71 | 1.30–2.26 |
| Arterial road share up 10 pp | +0.136 | 1.15 | 1.06–1.23 |
| Rainy days up 1 day | +0.034 | 1.03 | 1.01–1.06 |
For example, the IRR for one more rainy day is 1.03. This means that, other conditions being equal, the expected monthly accident count changes by about 3.4%.
Because traffic volume was entered on the log scale, the IRR when traffic volume increases about 2.72-fold is 1.71. The multiplier on accident counts when traffic volume doubles must be calculated separately as exp(β₁ × ln 2).
Which indicators should you check in negative binomial regression results?
Besides IRRs and confidence intervals, look at the dispersion parameter and model fit.
| Indicator | Learning example / what to check |
|---|---|
| Coefficient β | Effect on the log expected accident count |
| Incidence rate ratio (IRR) | exp(β): ratio of expected counts for a one-unit increase |
| 95% CI | Uncertainty of the IRR estimate |
| p-value | Traffic volume 0.000, road share 0.000, rainy days 0.002 |
| Dispersion parameter α | 0.385 (NB2 form) |
| Poisson Pearson χ² / df | 17.34 (reference for overdispersion check) |
| Model diagnostics | Check residuals, frequency of zeros, independence and fit |
You can check whether the 95% confidence interval of the IRR includes 1, but do not judge policy importance or causation from p-values alone.
In repeatedly measured area data, observations from the same area may be correlated with each other. This coefficient table is a simple NB2 example that assumes independent observations, so in real research you should consider cluster-robust standard errors, mixed effects or a panel approach.
How do negative binomial and Poisson regression differ?
Both models handle counts, but their assumptions about the conditional variance differ.
| Aspect | Poisson regression | Negative binomial regression (NB2) |
|---|---|---|
| Outcome | Event counts | Event counts |
| Conditional mean | μ | μ |
| Conditional variance | μ | μ + αμ² |
| Main advantage | Simple count model | Accounts for overdispersion |
| Coefficient interpretation | IRR | IRR |
| What to check | Overdispersion · residuals · independence | Dispersion parameter · residuals · independence |
Negative binomial regression is not always better than Poisson regression. If there is little overdispersion, or the data have other problems to solve, Poisson regression may be more appropriate.
How does negative binomial regression differ from other count models?
The right alternative depends on why the extra variation arises.
| Method | Suitable situation | Caution |
|---|---|---|
| Quasi-Poisson regression | Count data needing variance adjustment | Differs from full likelihood-based comparison |
| Zero-inflated models | Data with very many zeros due to a separate structure | Must distinguish the process generating zeros |
| Hurdle models | Separate zero vs. nonzero from the size of positive counts | Requires two-stage interpretation |
| Mixed-effects negative binomial regression | Data with clustered/repeated observations such as areas or periods | Captures correlation structure and heterogeneity |
Many zero accident counts do not necessarily call for a zero-inflated model. The negative binomial distribution itself can produce zeros, so you should compare the predicted share of zeros with the actual share.
Cautions for negative binomial regression
Check the cause of overdispersion, the unit of observation, and the limits of causal interpretation.
① Distinguish exposure from predictors.
Traffic volume, which represents the opportunity for accidents itself, can either be estimated as a predictor or included as a log offset, depending on the research question. Using traffic volume as an offset amounts to fixing its coefficient at 1, so the two approaches mean different things.
② Account for repeated observations by area.
Data collected monthly from the same area may not be independent. In that case, consider cluster-adjusted standard errors or mixed-effects negative binomial regression.
③ Do not choose a model just because the variance is large.
Omitted predictors, nonlinear relationships, outliers, measurement error and differing units of observation can also increase variation.
④ Distinguish accident counts from accident risk.
An area with more accidents may still have a lower accident rate per vehicle if its traffic volume is large. Event counts and accident rates per unit of exposure must be interpreted separately.
⑤ Do not assert causation.
Even if there are more accidents on rainy days, other variables such as road congestion or changes in travel volume may be at play.
What extensions exist for negative binomial regression?
The model can be extended to fit the observation structure and research question.
Accident rate analysis with an offset
Include traffic volume or exposure time as an offset to compare accident rates per unit of exposure.
Mixed-effects negative binomial regression
Captures differences in baseline accident levels between areas together with the repeated-measures structure of the data.
Zero-inflated negative binomial regression
Can be considered when you judge that the data also contain periods where accidents are structurally impossible.
Nonlinear terms and interactions
Lets you analyze whether the relationship between rainy days and accident counts is not linear, or whether the effect of rain differs by road type.
How do you report negative binomial regression results?
Describe the data, the reason for choosing the model, the IRRs and the overdispersion diagnostics together.
In a paper or report, state that accident counts were analyzed at the area-month level, and make clear how traffic volume was transformed and the measurement unit of each predictor.
A negative binomial regression was conducted on 12 months of data from 16 hypothetical areas (192 area-months). Monthly accident count was the outcome, and traffic volume, arterial road share and rainy days were included as predictors. The ratio of expected accident counts for a one-day increase in rainy days was estimated at IRR = 1.03 (95% CI [1.01, 1.06]). The NB2 dispersion parameter α was 0.39.
The figures above come from data generated for learning. An actual report should also describe the basis for judging overdispersion, how repeated observations were handled, and the model diagnostics.
Where can negative binomial regression be used?
It can be used in fields where the number of events in a given period or space varies widely.
Traffic and safety research
Analyze how accident counts by area relate to traffic volume, road characteristics and weather.
Medical and health research
Analyze return visits per patient or infection counts by region.
Insurance and finance research
Estimate how the number of claims per policy relates to customer characteristics.
Manufacturing and quality control
Analyze defect counts by production line or the number of equipment failures.
Education and social science research
Explain differences in absences by class or the number of complaints filed by region.
Negative binomial regression is a method for analyzing overdispersed count data.
It examines factors that affect how often events occur, while also accounting for extra variation around the expected count.
Negative binomial regression can be used when the variation in event counts is larger than a Poisson model would expect. In the traffic accident example, we looked at how monthly accident counts by area relate to traffic volume, road structure and rainy days.
However, you should not automatically choose negative binomial regression just because the variance is large. Check the correlation of repeated observations within areas, the scale of observation and exposure, and the characteristics of data with many zeros. Results are communicated more accurately when you present the meaning of the IRRs, their confidence intervals and diagnostics of the dispersion parameter together.
The key to negative binomial regression is count analysis that accounts for overdispersion. Interpret IRRs as ratios of expected counts across conditions, and check exposure, repeated observations, residuals and variance together.