← 3. Relationships & regression
Negative binomial regression
Try this analysis →

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.

Count dataOverdispersionIncidence rate ratio (IRR)Dispersion parameter α

Average daily traffic per month (thousand vehicles)Monthly accidents

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.

SECTION 1

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.

Key point

Negative binomial regression estimates the effects of predictors on event counts while also accounting for extra variation that the mean alone cannot explain.

SECTION 2

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.

SECTION 3

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

Model form

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.

SECTION 4

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.

Research question

“How do monthly traffic accident counts change as traffic volume, arterial road share and rainy days change?”

ItemDescription
Unit of analysisArea × month
Observations192 (16 areas × 12 months)
OutcomeMonthly traffic accidents
Traffic volumeAverage daily traffic for the month in that area
Road structureArterial road share (per 10 pp)
WeatherRainy days in that month
Mean accident count39.7 accidents
Overall variance of accident counts822.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.

SECTION 5

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.

Mean of observed accidents39.7Variance of observed accidents822.9
Comparison of the overall mean and variance of hypothetical area-month accident counts. They are on different scales, and this is not a definitive test of overdispersion.

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.

SECTION 6

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.

Traffic volume up about 2.72×1.71Arterial road share up 10 pp1.15Rainy days up 1 day1.03Dot: IRR / horizontal line: 95% CI / vertical line: IRR 1
Incidence rate ratios (IRR) and 95% confidence intervals estimated by negative binomial regression. Traffic volume is per one-unit increase on the log scale.
PredictorCoefficient βIRR95% CI
log(traffic volume/30,000)+0.5391.711.30–2.26
Arterial road share up 10 pp+0.1361.151.06–1.23
Rainy days up 1 day+0.0341.031.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).

SECTION 7

Which indicators should you check in negative binomial regression results?

Besides IRRs and confidence intervals, look at the dispersion parameter and model fit.

IndicatorLearning 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% CIUncertainty of the IRR estimate
p-valueTraffic volume 0.000, road share 0.000, rainy days 0.002
Dispersion parameter α0.385 (NB2 form)
Poisson Pearson χ² / df17.34 (reference for overdispersion check)
Model diagnosticsCheck 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.

SECTION 8

How do negative binomial and Poisson regression differ?

Both models handle counts, but their assumptions about the conditional variance differ.

AspectPoisson regressionNegative binomial regression (NB2)
OutcomeEvent countsEvent counts
Conditional meanμμ
Conditional varianceμμ + αμ²
Main advantageSimple count modelAccounts for overdispersion
Coefficient interpretationIRRIRR
What to checkOverdispersion · residuals · independenceDispersion 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.

SECTION 9

How does negative binomial regression differ from other count models?

The right alternative depends on why the extra variation arises.

MethodSuitable situationCaution
Quasi-Poisson regressionCount data needing variance adjustmentDiffers from full likelihood-based comparison
Zero-inflated modelsData with very many zeros due to a separate structureMust distinguish the process generating zeros
Hurdle modelsSeparate zero vs. nonzero from the size of positive countsRequires two-stage interpretation
Mixed-effects negative binomial regressionData with clustered/repeated observations such as areas or periodsCaptures 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.

SECTION 10

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.

SECTION 11

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.

SECTION 12

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.

Example reporting sentence

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.

SECTION 13

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.

✓ Wrap-up

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.

KEY TAKEAWAY

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.