Statistics Glossary → Poisson / Negative Binomial Regression (Count Regression)
Poisson / Negative Binomial Regression (Count Regression)analysis
Regression models that show how count outcomes such as 0, 1, 2, … accidents, visits, species or errors change with predictors, expressing each effect as a rate ratio (IRR).
Concept
Count data cannot be negative, are whole numbers and are often right-skewed: many observations sit at 0 or small values while a few take large ones. Ordinary linear regression can produce negative predictions and ignores the fact that the variance of a count grows with its mean. Poisson and negative binomial regression are designed for this structure.
The model links the logarithm of the expected count to a linear combination of the predictors: ln(μ) = β₀ + β₁x₁ + … so predictions are always positive. The exponential of each coefficient, exp(β), is an incidence rate ratio (IRR): IRR = 1.20 means that, holding the other predictors fixed, a one-unit increase raises the expected count by 20%. When the units compared differ in observation time or area, this is entered as an offset and the model explains a rate (e.g. events per year) rather than a raw count.
The Poisson model assumes that the variance equals the mean. In real data the variance is often larger than the mean (overdispersion); Poisson standard errors are then too small and significance is overstated. The negative binomial model captures this extra variation with an additional dispersion parameter. If there are far more zeros than the model expects, zero-inflated or hurdle models are considered.
When to use it
- When the outcome is the number of events counted over a period or area (yearly hospital visits, accidents at a junction, pests in a field).
- If the variance is clearly larger than the mean use negative binomial instead of Poisson regression; with excess zeros use zero-inflated (ZIP/ZINB) or hurdle models.
- If the outcome is not a count but the number of successes out of a fixed number of trials (a proportion), logistic regression is more suitable; for a continuous outcome, linear regression.
An everyday example
A city council studies how many traffic accidents occurred in a year at 120 junctions. Some junctions have traffic lights and some do not, and daily traffic volume is recorded. Some junctions opened in mid-year, so their observation periods differ, and this period enters the model as an offset. If the model gives IRR = 0.65 for traffic lights, then at the same traffic volume the expected accident rate at signalised junctions is about 35% lower than at unsignalised ones.
Parameters in MerQur
Target (Y, count) and Predictors (X)
Concept: The target is a count variable made up of zero or positive whole numbers; the predictors are the variables used to explain its expected value.
Everyday example: In the junction example the target is the yearly number of accidents at each junction (0, 1, 2, …); the predictors are daily traffic volume and whether the junction is signalised.
What it does: Selects the count variable (integer, >= 0) and the predictors.
Effect on the result: A linearly dependent (e.g. constant) predictor is removed from the model, its coefficient is shown as "--" (undefined) and a warning is given.
On the validation data: In a synthetic test with a constant predictor the model is fitted and the intercept is 0.0016958.
Distribution family (Poisson, Negative binomial)
Concept: In the Poisson distribution the variance of a count equals its mean; the negative binomial adds a parameter (θ) that allows the variance to exceed the mean. The smaller θ, the greater the overdispersion.
Everyday example: If most junctions have 0 to 2 accidents a year but a few dangerous ones have 15 to 20, the counts are far more spread out than Poisson expects. The negative binomial then gives more realistic standard errors.
What it does: Selects Poisson (mean = variance) or negative binomial NB2 (variance = μ + μ²/θ). NB is preferred if Pearson X²/df or deviance/df is clearly above 1 or the overdispersion test is significant.
Effect on the result: Coefficients, SE and LL/AIC/BIC change; in NB, θ and SE(θ) are added and AIC/BIC also count θ.
On the validation data: math coefficient 0.07015 (SE 0.01060) -> NB 0.07107 (SE 0.01153), θ = 6.11, LL -182.75 -> -181.91. nb_data: NB θ = 1.0327, AIC 1741.26. The Poisson BIC is LL-based: 386.70 (NB 390.30).
Offset (optional) and Offset already on log scale
Concept: An offset is a term with its coefficient fixed at 1 that accounts for units being observed over different lengths of time or different areas. Its logarithm enters the model, which then explains the rate per unit of time or area rather than the raw count.
Everyday example: If one junction was observed for 12 months and a newly opened one for only 4, comparing 6 accidents at each directly is misleading. With months observed as the offset, the model answers 'how many accidents per month'.
What it does: Adds the log of the exposure time/area column as a term with coefficient 1; the model explains the rate, not the count. If "already on log scale" is checked, the column is used as it is.
Effect on the result: The intercept and fit change; the IRRs become rate ratios. Rows with an offset <= 0 are removed with a warning; if a raw column is wrongly marked "already log", a clear error message gives the column name and its largest value.
On the validation data: insure data (n = 6): without offset intercept 0.6447, deviance 5.749; with offset = n intercept -5.7209, deviance 2.8207, AIC 40.9276. ln = log(n) + checked and n + unchecked give the same result.
Categorical (factor) variables
Concept: Enters a predictor coded with numbers but representing categories rather than measurements with a separate coefficient for each level (dummy variables); the first level is the comparison level.
Everyday example: If junction type is coded 1 = crossroads, 2 = T-junction, 3 = roundabout, these numbers carry no order or distance. Declared as a factor, the IRRs for T-junctions and roundabouts are given relative to crossroads.
What it does: Dummy-codes a numerically coded predictor (e.g. prog 1/2/3); levels are in numeric order and the first level is the baseline. Used when the codes carry no order/interval meaning.
Effect on the result: The selected variable is modelled with (levels - 1) dummies instead of a single continuous coefficient.
On the validation data: prog continuous: AIC 385.51, prog 0.1233; prog factor: AIC 373.50, prog_2 1.0839 (SE 0.3583), prog_3 0.3698. nb_data NB: prog_2 -0.44076, prog_3 -1.27865.
Confidence Level (%90, %95, %99, Other (custom))
Concept: Sets the confidence level of the intervals for the coefficients and IRRs; the higher the level, the wider the interval.
Everyday example: With IRR = 0.65 for traffic lights, the 95% confidence interval might be [0.48, 0.88]. Because it excludes 1, signals can be said to lower the accident rate; at 99% confidence the interval widens slightly.
What it does: Sets the level of the Wald intervals of the coefficients and IRRs.
Effect on the result: Only the intervals change; coefficient, SE and p do not.
On the validation data: math interval 95% [0.0494, 0.0909], 90% [0.0527, 0.0876], 99% [0.0429, 0.0975], 80% [0.0566, 0.0837].
Covariance / scale (Model-based (default), Pearson scale (quasi), Deviance scale, Robust (sandwich))
Concept: Ways of correcting the standard errors without changing the estimates (coefficients). A scale correction inflates the standard errors by the observed amount of overdispersion; a robust (sandwich) standard error estimates the uncertainty from the data without assuming a particular variance structure.
Everyday example: If the accident counts are twice as spread out as Poisson expects, model-based standard errors make the effect of signals look more precise than it is. A Pearson scale or a robust standard error gives the same IRR with a wider, more honest interval.
What it does: Corrects the SE while the coefficients stay fixed: Pearson scale (SE × √(X²/df)), deviance scale (SE × √(D/df)) or robust sandwich (HC0). Used when the Poisson mean structure is right but the variance is larger.
Effect on the result: SE, z, p and the interval change; Type III tests become scaled LR (LR/φ) or robust Wald.
On the validation data: math SE 0.01060 -> Pearson 0.01103 (φ 1.0824), deviance 0.01042 (φ 0.9666), robust 0.01044. DebTrivedi: hosp SE 0.0060 -> Pearson 0.0155 (φ 6.706), robust 0.0219.
Zero model ((none), Zero-inflated (ZIP / ZINB), Hurdle)
Concept: Models that explain excess zeros with two processes. A zero-inflated model assumes that some units are 'structural zeros' that cannot produce events at all; a hurdle model separately models whether the count is zero or positive, and then how large a positive count is.
Everyday example: In the junction data, village junctions with almost no traffic give 0 accidents every year; these are structural zeros where an accident is almost impossible. At busy junctions, a year with 0 accidents may be luck. A zero-inflated model separates these two kinds of zero.
What it does: Fits a zero-inflated (point mass + count) or hurdle (zero/positive logistic + zero-truncated count) model for excess zeros; the Vuong test (raw, AIC- and BIC-corrected) is given. Used when there are clearly more zeros than the standard model expects.
Effect on the result: An extra table: coefficients of both parts, LL/AIC/BIC, θ (NB), Vuong and observed/expected zeros. An analytic Hessian is used; a quasi-separated parameter is reported as "--" (undefined) with a warning.
On the validation data: fish (142 zeros; Poisson expected 94.6): ZIP LL -752.73, AIC 1521.5, Vuong z = 2.315 (p .0103); hurdle Poisson LL -751.62; ZINB θ = 0.553. DebTrivedi hurdle NB: 16 coefficients and θ = 1.3955.
Extra output: Overdispersion tests
Concept: Tests of whether the variability in the data is significantly greater than the Poisson model expects (variance = mean); a significant result supports the negative binomial model.
Everyday example: A significant result means accident counts vary from junction to junction more than Poisson allows; the effect of signals should be re-estimated with a negative binomial model.
What it does: Gives the Cameron-Trivedi NB1/NB2 auxiliary regression tests and the Poisson-NB likelihood ratio test (boundary distribution, p/2).
Effect on the result: Extra rows.
On the validation data: poisson_sim NB2 α = 0.164 (p .052), LR 1.69 (p .097): no overdispersion; nb_data NB1 α = 5.51 (p 3.5e-13), LR 926.03 (50:50 mixture chi-square for a boundary parameter).
Extra output: Omnibus + Type III tests
Concept: The omnibus test asks whether all predictors together explain the count; Type III tests assess each predictor as a whole with the others in the model.
Everyday example: The omnibus test answers 'do traffic volume and signals together explain accident counts?'. The Type III test separately answers 'does signalisation add information once traffic volume is accounted for?'.
What it does: Gives the omnibus LR test against the intercept-only model and a Type III LR test for each predictor (LR/φ if a scale is selected; Wald if robust SE is selected).
Effect on the result: An extra table.
On the validation data: omnibus LR 98.22; prog 14.57, math 45.01; with Pearson scale 13.46 / 41.59; robust Wald 14.84 / 45.20.
Extra output: Residual diagnostics + rootogram
Concept: Residuals are the differences between observed counts and the counts the model expects; observations with large residuals or high influence point to units the model does not fit. A rootogram sets observed and expected frequencies side by side for each count value, showing how well the model captures the distribution.
Everyday example: If the model expects 2 accidents a year at a junction but 14 occurred, that junction has a large residual and is worth inspecting on site. The rootogram gives a visual answer to questions such as 'does the model correctly predict how many junctions have 0 accidents?'.
What it does: Gives deviance and Pearson residuals (raw and standardized), leverage, Cook D, counts of |r| > 2 and 3, and observed-expected count frequencies.
Effect on the result: An extra table and plot.
On the validation data: |standardized Pearson| > 2: 18 observations; high leverage 16; Cook > 4/n: 12; zero count observed 124, expected 122.08.
Frequency weight and Custom contrast (L), Poisson
Concept: A frequency weight states that a row represents several identical observations. A custom contrast tests a researcher-defined linear combination of coefficients.
Everyday example: If the data are stored as summary rows such as 'signalised, heavy traffic: 25 junctions', the frequency weight conveys these counts. A custom contrast tests a specific question such as 'do T-junctions and roundabouts have the same accident rate?'.
What it does: The frequency weight defines data in count form; the custom contrast tests a linear combination of the coefficients (L matrix).
Effect on the result: The weight changes n and all estimates; the contrast adds an extra test row.
On the validation data: The frequency weight computes the coefficients and n in weighted form; a custom contrast can also be used in the Poisson model.
Example on real data
Data: UCLA poisson_sim (student award counts, 200 students)
Variables: target num_awards (number of awards), predictors prog_lab (programme type) and math (maths score)
- Question: Can the number of awards (num_awards) be explained by programme type (General, Vocational; baseline level Academic) and maths score? Because the outcome is a count, Poisson regression (log link) was used.
- Assumption: Deviance/df = 0.967 and Pearson χ²/df = 1.082; being close to 1, there is no marked overdispersion and the Poisson model is adequate (negative binomial is not needed).
- Result: A 1-point increase in maths score raises the expected number of awards by 7.3% (IRR = 1.073, 95% CI [1.051, 1.095], p < .001). Compared with Academic, the expected count is 0.338 times as large in General (p = .002) and 0.490 times as large in Vocational (p = .026).
- Effect size: Log-likelihood = -182.75, AIC = 373.50, BIC = 386.70, McFadden R² = .212.
- APA: Poisson regression, math IRR = 1.07, 95% CI [1.05, 1.10], p < .001; General IRR = 0.34, 95% CI [0.17, 0.68], p = .002.
Related concepts
Likelihood ratio test (LRT)Zero-inflated and hurdle modelsOverdispersion and the scale parameterOffset (exposure term)Robust (sandwich) standard errors (HC0-HC3)Frequency weight (summary-table data)Incidence rate ratio (IRR)Distribution family (GLM)
The numbers in the examples are MerQur's output on independent, publicly available validation data; see the MerQur Technical Note for details.