Negative Binomial — overdispersed counts (Var = μ + α μ²)
VerifiedAdvanced & specialized
Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.
Loading teaching datasets…
Or use your own dataset
Loading your datasets…
Models an OVERDISPERSED count outcome (variance >> mean) via the NB2 parameterisation Var(y|x) = μ + α μ².
Reports per-predictor incidence rate ratios (IRR = exp(β)) with 95% CI, MLE-estimated overdispersion parameter α with CI, model fit (deviance, log-likelihood, AIC, BIC, deviance pseudo-R²), an LRT vs nested Poisson testing whether overdispersion is real (H₀: α = 0), and a residual-dispersion check on the NB fit. The robust default for count outcomes in epidemiology, ecology, and any field where Poisson dispersion is rarely 1.
Worked example
How does clinic type affect (overdispersed) monthly visit counts?
Monthly visit counts were overdispersed (variance far exceeding the mean), so a negative-binomial regression replaces Poisson.
Specialist clinics saw about 50% more visits than general clinics (IRR = 1.50, 95% CI [1.18, 1.90], p = .001); the data were overdispersed, so Poisson would have understated the standard errors.
A negative-binomial regression (chosen for overdispersion) showed specialist clinics had significantly more visits, IRR = 1.50, 95% CI [1.18, 1.90], p = .001.
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- Overdispersed event counts per caseHospital readmissions per patient (n = 3000) ~ age + comorbidity + length-of-index-stay + offset(log(follow-up-days)).
- Disease counts in epidemiological surveillanceTB cases per district (n = 200 districts) ~ HIV prevalence + poverty + altitude + offset(log(population)).
When NOT to — use instead
- Equidispersed counts (dispersion ≈ 1)Use Poisson regression — NB adds a parameter without benefit. → Poisson Regression \u2014 IRR for count outcomes (auto-flags overdispersion)
- Continuous outcomeNB is for non-negative integer counts. → Linear Regression \u2014 OLS (continuous y + predictors)
- Binary outcomeUse logistic regression for binary outcomes. → Binomial Logistic Regression \u2014 odds ratios + ROC AUC + classification
- Heavy zero-inflation beyond NB's toleranceUse zero-inflated NB (ZINB) or hurdle model. → Negative Binomial \u2014 overdispersed counts (Var = \u03bc + \u03b1 \u03bc\u00b2)
Hypotheses
Parameter tested: vector of population log-rate coefficients β plus overdispersion parameter α
Assumptions (and what to do if they fail)
Check: α point estimate + LRT p-value vs Poisson.
If violated: α ≈ 0 with LRT p ≥ .05 → no evidence of overdispersion → switch to poisson_regression for parsimony.
Check: Pearson dispersion ratio.
If violated: Residual dispersion still > 1.5 → consider zero-inflated NB, hurdle model, or richer predictor set.
Check: Observed vs expected zero proportion under NB.
If violated: Excess zeros beyond NB expectation → zero-inflated NB or hurdle model.
Check: Max Cook's D.
If violated: Influential cases can flip IRR signs.
Check: Max VIF.
If violated: High VIF inflates IRR standard errors.
Ready to run a Negative Binomial — overdispersed counts (Var = μ + α μ²) on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →