Negative binomial regression handles count outcomes whose variation exceeds their average, which is common in health, safety, and service-use data. This guide explains overdispersion and rate ratios and shows how to run a model in AnalyZ Solutions.
Negative binomial regression is a method for studying outcomes that are counts, such as the number of clinic visits in a year, when the counts vary more than a simple count model allows. It shows which factors are linked to the count, by how much, and how many events to expect for a particular person.
Counts are whole numbers that cannot be negative, and in real data many people have zero or one event while a few have very many. The thing you want to explain is the outcome, and the factors you use to explain it are the predictors.
Suppose you record the number of clinic visits in a year for 600 people, together with whether each person has a long-term condition and their age. You want to know three things. Do people with a long-term condition make more visits? Does age make a difference? And how many visits would you expect from a 40-year-old with a long-term condition? Negative binomial regression answers all three.
Linear regression can predict a negative number of visits and assumes the spread of the data is the same everywhere, which counts do not follow. The standard model for counts, Poisson regression, assumes the variation in counts equals their average. In real data it often does not, because a few people with very many events stretch the spread far beyond the average. Negative binomial regression adds one parameter that lets the variation exceed the average, so the standard errors and significance levels stay honest.
Use it for count outcomes when the variance clearly exceeds the mean, or when Poisson regression in AnalyZ Solutions displays an overdispersion warning. It fits counts of health facility visits, incidents, hospitalisations, days absent, or services used, wherever a few units dominate the totals.
If the counts are equidispersed, Poisson is simpler and gives the same answers. If there are far more zeros than either model expects, for instance because many people never use a service, neither is ideal. If the data are clustered, use multilevel regression with a count outcome.
Negative binomial regression builds on the Poisson model, so it helps to see where that model falls short. This section covers the Poisson starting point, the problem called overdispersion, and the extra parameter that fixes it.
The standard model for counts is Poisson regression. It writes the logarithm of the average count as a straight-line combination of the predictors, which keeps every prediction above zero, and it reports effects as ratios called incidence rate ratios. A ratio of 1.3 means 30% more events.
Poisson regression assumes that the spread of counts matches their average. Real data rarely behave so neatly. In health and service data, a large share of people may have zero or one event while a few have very many: some people make dozens of clinic visits, some sites report many incidents, and some pupils miss a lot of school days. The variation is then far greater than the average would suggest, which is called overdispersion.
The consequence is not a slight loss of accuracy. A Poisson model on overdispersed data reports standard errors that are too small, so it makes confidence intervals too narrow and calls too many predictors significant. Negative binomial regression fixes this by adding a parameter that lets the variation exceed the average.
The figure below uses the 600 counts from the example in this guide. With no predictors in either model, a Poisson model with the same average expects far too few people with no visits and too few with many. A negative binomial model follows the data.
Negative binomial regression has the same structure as Poisson regression. It models the expected count through a log link and reports incidence rate ratios. The addition is a dispersion parameter, usually called alpha, which measures how much extra variation there is beyond Poisson. AnalyZ Solutions uses the common NB2 form, in which the variance grows with the square of the average. The figure plots the variance against the average. The Poisson variance rises in a straight line, while the negative binomial variance curves upward, and the larger alpha is, the more steeply.
An alpha close to zero means the data are close to Poisson, and the extra parameter is doing little. A larger alpha means stronger overdispersion. The value itself is rarely reported as a finding. What matters is that the model handles it, and that the resulting standard errors can be trusted.
The mean is modelled in exactly the same way as in Poisson regression, with the log of the mean as a straight-line combination of the predictors. The change is in the variance:
The dispersion parameter α is estimated together with the coefficients by maximum likelihood. When α is zero the variance collapses to μ and the model is Poisson. The larger α is, the more the counts spread out, and the more the variance exceeds the mean, especially when the mean itself is large.
Take a person with a long-term condition, aged 40, with age in decades, and the results below, where α = 1.111.
The figure shows the two distributions side by side at this mean.
Many people with no visits, together with a few with very many, is the pattern that real overdispersed counts show, and only the negative binomial model reproduces it. That is why Poisson standard errors come out too small in such data.
Each predictor has an IRR with a 95% confidence interval and a significance level. A ratio of 1 means no difference, above 1 means higher expected counts, and below 1 means lower. An IRR of 1.5 for people with a long-term condition means they are expected to record 50% more events than people without one. A toggle switches to raw coefficients on the log scale.
The summary reports the number of cases, log-likelihood, a likelihood-ratio test, a pseudo R-squared, AIC, and the dispersion parameter alpha. Comparing AIC with a Poisson model on the same variables is a useful check. A clearly lower AIC for the negative binomial model confirms that the extra flexibility was needed.
Open Inferential Analysis, choose Regression, then Negative Binomial Regression.
The figures below are invented to show the steps, and they follow the results tables in AnalyZ Solutions, with a few columns left out to save space. Suppose the number of clinic visits in a year is modelled for 600 people using a long-term condition (reference: None) and age in decades. A Poisson model was run first, and it showed a dispersion ratio of 2.882, above the warning level of 1.5, so a negative binomial model was used.
| N | Log-likelihood | LR chi2 | Prob > chi2 | Pseudo R² | AIC | alpha |
|---|---|---|---|---|---|---|
| 600 | -1012.6862 | 5.54 | 0.0627 | 0.003 | 2033.37 | 1.111 |
| Variable | IRR | 95% CI lower | 95% CI upper | p-value | Sig |
|---|---|---|---|---|---|
| Long-term condition (ref: None) | 1.305 | 1.045 | 1.629 | 0.0189 | * |
| Age (per 10 years) | 1.003 | 0.920 | 1.094 | 0.9473 | ns |
People with a long-term condition made about 30% more clinic visits, a result significant at the 5% level. Because the counts were far more spread out than a Poisson model allows, a negative binomial model was used, and its wider interval is the more honest one. Age showed no clear association with visits.
Choosing it automatically without checking. When counts are not overdispersed, Poisson is simpler.
Ignoring zero inflation. If many units never take part in the activity at all, the model may fit poorly.
Treating alpha as a result. It describes the spread of the counts and is not an effect of any predictor.
Ignoring clustering. Counts from the same person, clinic, or school are usually correlated, and a multilevel count model is more appropriate.
Open Regression in AnalyZ Solutions. Free to sign up, free to analyze.
Get started