NeuroNomixer logoNeuroNomixer
  • Home
  • Blog
  • Visual Guides
  • Authors
  • Contact
Sign InSign Up
NeuroNomixer logo
HomeBlogAuthorsContactPrivacy Policy

© 2026 NeuroNomixer — Built with Next.js & Tailwind CSS

Visual Guides/Count Models: Poisson & Negative Binomial
Generalized Linear Models

Count Models: Poisson & Negative Binomial

Linear regression predicts real numbers, but counts can't be negative or fractional. GLMs with a log link fix this and model count distributions correctly.

Why Linear Regression Fails for Counts

Linear regression can predict negative values and ignores the discrete, non-negative nature of counts. A Poisson GLM uses the log linkE[Y] = exp(β₀ + β₁x)so predictions are always positive.

Show:
06121723120590106015302000Store Size (m²)Complaints
Data points
Linear OLS
Poisson GLM
Neg. Binomial

Complaint counts at retail stores of varying sizes (illustrative data). After fitting the trend, the Poisson model leaves no excess variation: Pearson X²/df is well below 1, so there is no overdispersion.

Overdispersion: When Poisson Isn't Enough

Poisson assumes Var(Y) = E[Y] conditional on the predictors. The rawVar/Meanratio of the counts only tests this when the mean is flat: any trend in the data inflates the marginal variance, which is why every scenario here shows Var/Mean above 1. With a fitted model, the honest diagnostic is the Pearson statisticX²/df: values well above 1 signal true overdispersion.

12.7
Mean of counts
23.7
Variance of counts
1.87
Var/Mean (marginal)
inflated by the trend
0.21
Pearson X²/df (model)
from the Poisson fit
✓ No overdispersion
Verdict (by X²/df)
Marginal check: variance vs. mean of the raw counts. A trend in the data stretches the variance bar even when the counts are perfectly Poisson around that trend.
Mean12.7
Variance23.7
Model-based check: Pearson X² vs. residual degrees of freedom for the fitted Poisson model. Poisson expects X² ≈ df; X² far beyond df means overdispersion.
df (n − 2)28
Pearson X²5.8

Model Comparison

Lower AIC and deviance indicate a better fit. Higher log-likelihood is better. Use AIC to weigh model complexity against fit.

ModelAIC ↓Deviance ↓Log-Lik ↑
Linear OLS
——R²=0.976
Poisson GLMBEST
139.16.4-67.6
Neg. Binomial
141.16.4-67.6

The negative binomial size parameter θ (from Var(Y) = μ + μ²/θ) grows without bound on this dataset: with no overdispersion left once the trend is fitted, the NB collapses into the Poisson model and its extra parameter only costs AIC.

The Poisson Distribution

The Poisson PMF is P(Y=k) = e⁻λ · λᵏ / k!. A single parameter λ controls both the mean and variance. Drag the slider to see how the distribution shifts.

01234567891011121314151617181920212223242526272829k (count)P(Y=k)
8
Mean = λ
8
Variance = λ
0.35
CV = 1/√λ

Model Selection Guide

Linear OLS

❌ Avoid
  • ▸Predicts negative counts
  • ▸Violates non-negativity
  • ▸Use only as baseline

Poisson GLM

✓ Default start
  • ▸Pearson X²/df ≈ 1
  • ▸Count data, no excess zeros
  • ▸Interpretable: exp(β) = rate ratio

Negative Binomial

✓ When overdispersed
  • ▸Pearson X²/df well above 1
  • ▸High-variance counts
  • ▸Adds a size parameter θ (Var = μ + μ²/θ)

Key Takeaways

  • 1.Use Poisson GLM (log link) instead of linear regression for count outcomes.
  • 2.Poisson requires Var = Mean conditional on the predictors. Raw Var/Mean of the counts is only a valid check when there is no trend; with a fitted model, check Pearson X²/df instead.
  • 3.Switch to Negative Binomial when overdispersion is confirmed via AIC or Pearson χ² test.
  • 4.Coefficients from Poisson/NB GLMs are on the log scale: exp(β) gives the multiplicative rate ratio.
← Previous GuideNext Guide →