Negative Binomial Regression Explained: How to Run, Read and Report It

By Dr. Faheem Afzal Shah, Founder, StatFAS.com · Tool: Negative Binomial Regression Calculator

Negative binomial regression models count outcomes, such as the number of infections, hospital visits or errors, when the variance is larger than the mean. Counts like these are usually overdispersed, which makes ordinary Poisson regression too optimistic. This guide explains why, how the negative binomial model fixes it, and how to read and report the results with a fully worked example.

What is negative binomial regression?

Poisson regression assumes Var(y) = μ. The most common negative binomial model (NB2) allows extra variability through a dispersion parameter α:

E[y] = μ = exp(β0 + β1x1 + …)    Var(y) = μ + αμ²

When α = 0 the model reduces to Poisson. Coefficients are estimated by maximum likelihood. Because of the log link, exp(β) is a rate ratio (also called incidence rate ratio): the multiplicative change in the expected count per one-unit increase in the predictor. If observation periods differ across subjects, include the log of exposure time as an offset so that the model describes rates rather than raw counts.

When should you use it?

Use it for non-negative integer outcomes whose variance clearly exceeds the mean: counts of events per person, per site or per period. If the data contain many more zeros than the model predicts, consider zero-inflated or hurdle models. If the variance is about equal to the mean, Poisson regression is adequate (Cameron & Trivedi, 2013).

Assumptions

Original example (illustrative)

Question. Does a self-management programme reduce the number of asthma attacks over six months, after accounting for baseline severity? Data for n = 30 patients (invented; 15 per group):

Show the full illustrative dataset (CSV, copy into the tool)
treatment,severity,attacks
1,5.8,1
0,4.9,0
0,4.1,9
0,5.6,7
1,6.2,0
1,2.5,1
0,4.6,4
0,3.5,1
0,4.7,2
1,3.1,0
0,5.0,3
1,4.9,0
1,4.5,0
1,3.4,1
0,4.4,5
1,3.4,0
1,3.0,0
1,5.3,1
1,3.3,2
0,6.8,1
1,6.1,4
1,2.0,0
0,5.4,1
0,3.3,0
1,5.0,1
0,5.1,6
0,2.0,0
1,4.6,2
0,4.6,1
0,6.4,7

The mean number of attacks is 2.00 and the variance is 6.28, a variance-to-mean ratio of 3.14. A Poisson model gives a Pearson dispersion statistic of 2.02 (values well above 1 indicate overdispersion), and Poisson standard errors (for example, 0.316 for treatment) are too small compared with the negative binomial value of 0.421. The likelihood-ratio test of α = 0 against Poisson gives χ² = 9.58, p < .001 (a half-chi-square reference is used because α = 0 lies on the boundary of the parameter space).

Illustrative negative binomial (NB2) results, n = 30
TermbSEexp(b)zp
Intercept1.1900.2433.294.89< .001
Treatment (1 = programme)−1.1540.4210.32−2.74.006
Severity (centred at 5)0.3600.1871.431.93.053

Estimated dispersion: α = 0.53; log-likelihood = −51.46.

Interpretation. The expected number of attacks in the programme group is 0.32 times that of the control group (rate ratio 0.32, 95% CI [0.14, 0.72]), after adjusting for severity: roughly a 68% lower rate. Each one-point increase in baseline severity multiplies the expected rate by 1.43 (95% CI [0.99, 2.07]). With 30 patients, intervals are wide, so the size of the effect is uncertain even though the direction is supported. A rate ratio describes relative rates, not an absolute number of attacks avoided.

How to run negative binomial regression with StatFAS

Open the Negative Binomial Regression Calculator. Arrange a count outcome column and predictor columns.

Understanding the output

APA 7 reporting example

A negative binomial regression indicated that the programme was associated with a lower rate of asthma attacks after adjusting for baseline severity (rate ratio = 0.32, 95% CI [0.14, 0.72], p = .006). The model was chosen because the data were overdispersed (Poisson Pearson dispersion = 2.02; likelihood-ratio test against Poisson, p < .001).

Common mistakes and troubleshooting

Limitations and alternatives

NB2 handles overdispersion but not underdispersion, clustering or excess zeros. Alternatives include quasi-Poisson models (same mean model, scaled standard errors), zero-inflated or hurdle models, and mixed-effects count models. For binary outcomes see logistic regression; for time to the first event use Cox regression; for an overview of choosing among them, see the regression guide.

Conclusion

Negative binomial regression is the standard remedy for overdispersed counts. Check dispersion first, report rate ratios with intervals, handle exposure correctly, and remember that the model describes relative rates under specific distributional assumptions.

Screenshots to supply (genuine captures only):
1. statfas-negative-binomial-regression-interface.png, alt: "StatFAS Negative Binomial Regression Calculator interface"
2. statfas-negative-binomial-regression-example-data.png, alt: "Example data entered in the StatFAS Negative Binomial Regression Calculator"
3. statfas-negative-binomial-regression-settings.png, alt: "Negative Binomial Regression Calculator settings in StatFAS"
4. statfas-negative-binomial-regression-result.png, alt: "Negative Binomial Regression Calculator results generated in StatFAS"

Frequently asked questions

How do I know if my data are overdispersed?

Compare the variance with the mean (they are equal for Poisson), check whether the Pearson chi-square divided by its degrees of freedom is well above 1, or run a likelihood-ratio test of the dispersion parameter against Poisson.

What is a rate ratio?

It is the exponentiated regression coefficient in a count model. A rate ratio of 0.75 means the expected count is 25% lower per one-unit increase in the predictor (or compared with the reference group).

When should I use an offset?

Use an offset, the log of the exposure time or population at risk, when observation periods or group sizes differ, so that the model compares rates and not raw counts.

References

Author attribution: Dr. Faheem Afzal Shah, Plant Functional Genomics and Regulatory Genomics Researcher; StatFAS.com Founder.