Poisson Regression (Count Regression)

Analyze non-negative integer (count) responses, such as how the number of defects changes with operator experience or shift. Incidence rate ratios (IRR) express each factor's effect as a ratio, and an exposure column adjusts for different observation amounts such as inspection time.

1Data Table

Paste a table copied from Excel into a cell (Ctrl+V). Click a column header (A, B…) before pasting to use the first line as column names. Double-click a header to rename it, right-click to insert/delete rows and columns, and formulas such as =A1*2 work too.

2Poisson Regression Options

Numeric predictors (multiple selection):
Categorical predictors (multiple selection, optional):

How to run a Poisson regression

  1. Copy the count response column and the predictor columns (and an exposure column if needed) with their headers.
  2. Choose the count response Y and the predictors. If the observation period or area differs, check 'Use an exposure (offset) column' and choose the exposure column.
  3. Click Analyze and check the IRR and the overdispersion index.

Worked example with sample data

The example data are the operator experience (years), shift (Day/Night), inspection time (h) and number of defects found in 36 inspections. Defects is the count response, experience is a numeric predictor, shift is a categorical predictor, and inspection time is the exposure (offset).

Actual number of defects per inspection (blue) and the counts predicted by the Poisson regression (orange)
Actual number of defects per inspection (blue) and the counts predicted by the Poisson regression (orange)

The incidence rate ratio (IRR) of experience is 0.9173 (95% CI 0.8723 ~ 0.9645, p=0.0007569): each additional year of experience reduces the defects per hour by about 8%.

With the Day shift as the reference, the Night shift IRR is 1.373 (95% CI 0.9719 ~ 1.939), so the night shift appears to have about 37% more defects, but the confidence interval includes 1 and the effect is not significant (p=0.07219).

The overdispersion index (Pearson χ²/df)=0.8314 is close to 1, so the Poisson assumption is reasonable. In the actual vs predicted counts plot the two colors of points mostly sit close together.

How it is calculated

log(expected count) = b₀ + b₁X₁ + … (+ log exposure) is fitted with statsmodels GLM (Poisson, log link, IRLS). Incidence rate ratio (IRR) = exp(coefficient); its confidence interval is the exponentiated normal-approximation interval.

Overdispersion index = Pearson χ² / residual degrees of freedom; above 1.5 a possible overdispersion is reported. The response must be a non-negative integer.

What the results show

Coefficients and IRR, fit and overdispersion, actual vs predicted counts, an IRR forest plot, residuals vs fitted (Pearson residuals) and an influence plot (the 10 largest absolute residuals highlighted).

Interpreting the Poisson regression

  • An IRR of 1.2 means the expected count rises by 20% when the predictor increases by 1, and 0.8 means it falls by 20%. A categorical term is the ratio to the reference level.
  • If the overdispersion index is clearly greater than 1, the variance is larger than the Poisson assumption and the p-values may be smaller than they should be.
  • The red bars in the influence plot are the observations the model explains poorly.

Frequently asked questions

When do I use an exposure (offset)?

When the observation time, area or production volume differs by row so that the counts cannot be compared directly. The exposure column must be greater than 0.

What if there are decimals?

The response must be a non-negative integer (count), so an input error message appears.

How is the overall significance judged?

The decision sentence uses the smallest p-value among the coefficients (including the intercept).

Other chart tools