Method · Statistics Library

Poisson regression

Poisson regression models a count outcome (events in a fixed window) as a function of predictors through a log link, reporting each predictor's effect as an incidence-rate ratio, with a built-in check for overdispersion (the variance exceeding the mean).

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

Poisson regression is the standard tool for counts (number of visits, defects, calls) rather than continuous measurements. It models the expected COUNT (technically its logarithm) as a function of your predictors, and reading a coefficient is most naturally done by exponentiating it into an incidence-rate ratio: an IRR of 1.10 means a one-unit increase in that predictor multiplies the expected count by 1.10, a 10% higher rate, holding everything else fixed.

A raw count is meaningless without knowing the WINDOW it was counted over: 12 defects out of a batch of 100 is very different from 12 defects out of a batch of 10,000. If your rows cover different-sized windows (different time periods, different batch sizes, different amounts of exposure), you need to tell the model about that window explicitly (an 'exposure') so every incidence-rate ratio is correctly interpreted as a rate PER UNIT of that window, not just a raw multiplier on an incomparable count.

Poisson regression makes one specific, strong assumption worth checking every time: that the variance of the counts equals their mean. Real count data very often violate this (the spread is wider than expected: overdispersion), and when that happens, Poisson's reported standard errors come out too small and its p-values too optimistic. Checking for this is not optional: it directly determines whether the model's stated uncertainty can be trusted.

Poisson regression is the basic count regression. An exposure offset lets counts from units observed for different lengths of time, or of different sizes, be compared fairly, so the model describes rates rather than raw counts.

Practitioner explanation

KernelStats fits log(lambda) = beta_0 + beta_1*X_1 + ... via maximum likelihood, with IRR_j = exp(beta_j) as the reported effect size. Overdispersion is ACTIVELY COMPUTED (not merely mentioned as a caveat): phi-hat = Pearson chi-square / degrees of freedom, with phi-hat near 1 supporting Poisson and phi-hat >= ~1.5 flagged as overdispersion, at which point the card explicitly recommends switching to negative binomial regression (or quasi-Poisson / robust standard errors) rather than trusting the Poisson standard errors as reported.

An exposure column, when supplied, enters as an OFFSET (log(exposure) with its coefficient FIXED AT 1, which is precisely what distinguishes an offset from an ordinary predictor), turning every reported IRR into a ratio of RATES PER UNIT OF EXPOSURE rather than a ratio of raw, incomparable counts. The Learn More content states a specific, concrete failure mode of skipping exposure when it genuinely varies: if the larger exposure windows happen to coincide with the treated group, the model can report treatment RAISING the count while the true rate per unit of exposure is actually falling, and separately, unmodeled exposure variation itself often masquerades as apparent overdispersion, which can tempt an analyst into negative binomial regression as a fix that does not actually address the real underlying problem.

An exactly redundant predictor set (a duplicated column, the same measurement in two units, or a numeric column mistakenly imported as text that explodes into one dummy per unique value) is rejected outright rather than fit, because the effect would otherwise be split arbitrarily between the aliased columns. An outcome that is exactly zero in every single row is refused with a specific, honest message rather than surfacing statsmodels' internal boundary-condition warning verbatim as a confusing crash-like message to the user.

When to use it

Consider it when

The outcome is a non-negative integer count of events in a fixed (or exposure-adjusted) window, and each predictor's effect should be quantified as a multiplicative rate ratio.

Use caution when

The overdispersion check flags phi-hat well above 1 (switch to negative binomial regression instead), rows cover meaningfully different exposure windows without an exposure column supplied (the IRRs would then compare incomparable raw counts), or the outcome shows excess zeros beyond what Poisson's own distribution predicts (a zero-inflated or hurdle model is needed).

Formulas and symbols

Poisson regression model

log⁡(λ)=β0+β1X1+β2X2+…\log(\lambda) = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \dots

lambda the expected count (rate); the log link ensures predicted counts stay non-negative.

Incidence-rate ratio

IRRj=eβjIRR_j = e^{\beta_j}

IRR > 1 multiplies the expected count upward; IRR < 1 lowers it; IRR = 1 no effect.

Overdispersion statistic

ϕ^=Pearson χ2df\hat\phi = \dfrac{\text{Pearson } \chi^2}{df}

phi-hat near 1 supports Poisson's mean=variance assumption; phi-hat >= ~1.5 flags overdispersion (switch to negative binomial).

Assumptions and checks

  • Poisson regression expects a genuine count outcome (non-negative integers); non-integer values make the results approximate rather than exact.

    In KernelStats: Checked directly: the card detects non-integer outcome values and flags it as a warning.

  • Poisson regression assumes the outcome's variance equals its mean; when the data are overdispersed (variance meaningfully exceeds the mean), the standard errors are too small, so p-values and confidence intervals are too optimistic.

    In KernelStats: Checked directly: the Pearson chi-square-over-degrees-of-freedom dispersion statistic is computed and reported, flagged as a warning above 1.5; when overdispersion is present, Negative Binomial Regression is the recommended alternative.

  • A coefficient that does not converge to a finite, identified value during fitting is not an estimate at all; treating it as one would be reporting an artifact of where the optimizer stopped, not a real effect.

    In KernelStats: Checked directly: the card checks that every coefficient's maximum-likelihood estimate converged to a finite value and flags a failed check (severity 'fail') when it did not.

  • Independence of observations. Poisson regression assumes rows are independent; grouped or repeated counts (clusters, subjects, sites measured more than once) understate the true standard errors.

    In KernelStats: Not checked by KernelStats: no clustering diagnostic is run; a clustered design needs a mixed-effects or GEE approach instead.

Alternatives

  • Negative Binomial Regression. The overdispersion check (Pearson chi-square/df) shows phi-hat meaningfully above 1, indicating the variance exceeds what Poisson's mean=variance assumption allows.
  • Linear Regression. The outcome is actually continuous rather than a genuine count.

Worked example

Scenario

Modeling annual store visits per customer as a function of age and loyalty-program membership, with all customers observed for the full year (no exposure column needed).

Result

Age IRR = 0.98 per year (p = .002); loyalty membership IRR = 1.45 (p < .001); overdispersion phi-hat = 1.12 (Poisson adequate).

Interpretation

Loyalty membership is associated with a 45% higher visit rate, and slightly older customers visit marginally less often, both after adjusting for the other predictor; the overdispersion check near 1 supports trusting the Poisson standard errors and p-values as reported, without needing to switch to negative binomial.

Common misconceptions

Misconception

Leaving out an exposure column when rows genuinely cover different-sized windows is a minor simplification.

Correction

It is not a small approximation: if larger exposure windows happen to coincide with one group (e.g. the treated group), the model can report that treatment RAISES the count even while the true rate per unit of exposure is actually falling. Unmodeled exposure variation also masquerades as apparent overdispersion, which can misleadingly point toward switching to negative binomial regression as a 'fix' that does not address the actual problem.

Misconception

A statistically significant incidence-rate ratio (a small p-value) means the effect is large or practically important.

Correction

With a large enough sample, an IRR as modest as 1.02 can carry p < .001. Statistical significance measures evidence against IRR=1, not the SIZE of the effect; read the IRR itself and its confidence interval to judge practical importance, not just whether the p-value crossed a threshold.

Read more: Misconception: statistical significance means practical importance

References

  1. Regression Analysis of Count Data, Cameron, A. C. and Trivedi, P. K. (2013).
  2. Generalized Linear Models, McCullagh, P. and Nelder, J. A. (1989).