When to use it
Model a count outcome (0, 1, 2, …) when a Poisson regression is overdispersed (the variance is larger than the mean) so Poisson standard errors would be too small and its p-values too optimistic.
When not to: The count data are actually underdispersed (variance below the mean; negative binomial offers nothing over Poisson in that case; consider a generalized Poisson or Conway-Maxwell-Poisson model), there are STRUCTURAL excess zeros beyond what NB2's own distribution predicts (a zero-inflated or hurdle model is needed), or observations are clustered/repeated without being modeled (a mixed-effects or GEE approach is needed instead).
Step by step
Open it from the menu
Click Regression in the menu bar; under Counts & Categorical choose Negative Binomial Regression.
Fill in the form
Choose the columns: Count to predict, Columns that may explain it, Exposure (time at risk) (optional). The form lists only columns whose type fits each field.
Check the options
The options start at their defaults: Alpha, Confidence level. Change one only when your question needs it.
Run the analysis
Press Run analysis. The Result Card opens on its Results tab.
What to choose in the form
| Count to predict Response required | One numeric or count column. Non-negative integer count outcome. |
|---|---|
| Columns that may explain it Predictors required | One numeric or categorical or ordered categorical column. One or more predictor columns. Categorical predictors are auto-encoded. |
| Exposure (time at risk) (optional) Exposure | One numeric or count column. Exposure / time at risk for each row (person-years, batch size, hours observed). Entered as an offset of log(exposure), which turns every IRR into a rate ratio per unit of exposure. Omit when every row covers the same window. |
| Alpha | Significance threshold for per-predictor tests. Default: 0.05. |
| Confidence level | Confidence level for coefficient / IRR intervals. Default: 0.95. |
How to read the card
The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.
What it assumes
- Independence of observations
If it does not hold: Negative binomial regression assumes rows are independent; grouped or repeated counts (clusters, subjects, sites measured more than once) understate the true standard errors.
How to check: Not checked by KernelStats: stated directly as a standing 'Independence of observations' reminder; a clustered design needs an NB mixed model or GEE with a robust variance instead.
A worked example
Modeling annual customer store visits from age and membership tier, after a Poisson fit showed a dispersion ratio of 2.3.
Result: Negative binomial estimates alpha = 0.41 (SE 0.06); the boundary-corrected LR test against Poisson gives p < .001; IRR for membership tier = 1.34 (nearly identical to Poisson's 1.33), but the negative binomial's 95% CI [1.18, 1.52] is noticeably wider than Poisson's overly narrow [1.24, 1.44].
The strongly significant overdispersion test confirms negative binomial was the right choice here: the point estimate for membership tier's effect barely moved, but the corrected, wider confidence interval is the one that honestly reflects the real uncertainty in the data, exactly the pattern the method is designed to fix.
From the Statistics Library.
The code tabs
Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.
Understand the statistics
Ask Oobi
Type one of these into Ask Oobi beside your data:
- After accounting for overdispersion, how does customer age relate to the number of store visits per year?
- Explain the negative binomial regression in plain words.
- What does negative binomial distribution mean?
Last reviewed November 16, 2026.
