Poisson Regression
A method for analyzing how many times an event occurs in a fixed period of time or space, and estimating how the expected number of events changes with conditions.
Does a library get more visitors on weekdays or on weekends? How do the numbers of visits in the morning and evening differ? Can we confirm with numbers whether visitors drop on rainy days?
As in these questions, a method that analyzes the number of events occurring in a fixed period of time or space by linking it to predictors is called Poisson regression.
Whereas ordinary linear regression is mainly used to explain changes in a continuous outcome, Poisson regression deals with things recorded as nonnegative integers, such as numbers of visits or accidents. Exponentiating the model's coefficients lets you interpret by what factor the expected number of events changes when other conditions are held constant.
It is useful in studies that compare numbers of events, such as library use, hospital visits, filed complaints, or facility breakdowns. In this article we use the number of library visitors per hour as an example to look at how the model works, the effects of day of week, time of day, and weather, interpreting the incidence rate ratio (IRR), checking overdispersion, and reporting the results.
What is Poisson regression?
A generalized linear model used to predict counts of occurrences.
Poisson regression analyzes how many times an event occurred within a fixed observation unit. The outcome is a nonnegative integer such as 0, 1, or 2; numbers of visits, accidents, and breakdowns are examples.
Unlike ordinary linear regression, it uses a log link so that the mean count cannot be negative. It is natural to interpret a predictor's effect as the factor by which the expected count changes, rather than as a fixed increase in the count itself.
Instead of assuming that the number of visits rises by 5 people, you estimate how many times the expected number of visits under a given condition is compared with the reference condition.
Why do we need Poisson regression?
The distribution of count data and the way it increases differ from continuous data.
The number of visitors per hour cannot be less than zero, and situations with twice as many visitors as usual can happen. Ordinary linear regression can produce negative predictions and may not properly reflect the mean and variance structure of count data.
Poisson regression can directly model the expected count under each condition. However, the Poisson distribution assumes that the conditional mean and variance are equal, so if the variation in the actual observations is too large, you should also consider other models.
How does Poisson regression work?
It links the predictors to the log of the expected count and estimates the model by maximum likelihood.
① Define the unit of analysis and the outcome
Make each observation one hour at the library, and set the number of patrons who visited in that hour as the outcome.
② Define the predictors and the reference condition
Day of week is coded as weekend or not, time of day as evening or not, and weather as whether it rained. The reference is a weekday, a non-evening time slot, and a clear day.
③ Express the expected count with a log link
log(expected visitors) = intercept + β₁×weekend + β₂×evening + β₃×rain. So the expected number of visitors is the exponential function applied to this linear expression.
④ Estimate the coefficients by maximum likelihood
Estimate the coefficients so that the visit counts actually observed become as likely as possible. Applying the exponential function to each coefficient gives the incidence rate ratio (IRR).
⑤ Check fit and overdispersion
Check the differences between observed and predicted values, residual patterns, and the Pearson chi-square statistic divided by the residual degrees of freedom, among other things.
Real-world case: hourly visitors at a library
Analyze how day of week, time of day, and weather relate to the number of visits.
Suppose we observed four time slots a day for 5 weeks at a hypothetical library. These are example data for learning, with visitor counts generated for a total of 140 time slots. Every slot was set to 1 hour long.
“How much does the library's expected number of visitors per hour change on weekends, in the evening, and on rainy days?”
| Item | Value or description |
|---|---|
| Unit of observation | 1-hour slot |
| Number of observations | 140 slots |
| Outcome | Visitors per hour (nonnegative integer) |
| Predictors | Weekend or not, evening or not, rain or not |
| Reference condition | Weekday, non-evening slot, clear day |
| Mean number of visitors | 23.4 |
| Variance (all observations) | 64.7 |
The variance of the full data also reflects differences in conditions such as day of week and time of day. So the fact that the variance is larger than the mean alone does not lead to the conclusion of conditional overdispersion.
How does the expected number of visitors change?
Compare the combinations of day type and time of day under the same weather.
The expected number of visitors on a weekday, outside the evening, on a clear day is about 23.3 per hour. More visitors than that are expected in the evening, and relatively fewer are expected on weekends under the same conditions.
This graph is not a plain average of the observations; it shows predicted values computed from the estimated model coefficients.
How do you interpret the incidence rate ratio (IRR)?
The exponentiated coefficient gives the multiple of the expected count relative to the reference condition.
| Comparison | Regression coefficient β | IRR | 95% confidence interval |
|---|---|---|---|
| Weekend (vs. weekday) | -0.334 | 0.72 | 0.66–0.78 |
| Evening (vs. other times) | +0.440 | 1.55 | 1.44–1.67 |
| Rain (vs. clear day) | -0.128 | 0.88 | 0.82–0.95 |
With other conditions equal, the IRR for the evening is 1.55, meaning the expected number of visitors is about 55% higher than outside the evening. An IRR of 0.80 means about 20% fewer.
The IRR is not the probability that an individual visitor will visit; it is a ratio of the expected number of events in a fixed observation unit, or of the rate per unit of exposure.
Which indicators do you check in Poisson regression results?
Look at uncertainty and goodness of fit along with the regression coefficients and incidence rate ratios.
| Indicator | Example result or meaning |
|---|---|
| Regression coefficient (β) | Effect of the predictor on the log expected count |
| Incidence rate ratio (IRR) | exp(β): multiplicative change by condition |
| 95% confidence interval | Uncertainty in the IRR estimate |
| p-value (p) | Weekend 0.000 / evening 0.000 / rain 0.001 |
| Pearson χ² / residual df | 1.16 (exploratory indicator of conditional overdispersion) |
| Residuals and fit | Check for biased predictions or large residuals |
If the confidence interval includes 1, there may not be enough evidence that the variable's IRR differs from 1. Don't judge the importance of an effect from a p-value alone; look at the effect size and the research context together.
How does Poisson regression differ from linear regression?
The basic assumptions of the models applied to continuous and count outcomes differ.
| Category | Linear regression | Poisson Regression |
|---|---|---|
| Outcome | Continuous values | Nonnegative integer counts |
| Range of predictions | Can be negative | Positive expected counts |
| Link | Identity link (default) | Log link |
| Coefficient interpretation | Mean difference per unit increase | Multiplicative change via exponentiated coefficients |
| Typical examples | Test scores, sale prices | Numbers of visitors, numbers of accidents |
If you are analyzing how many patrons visit the library per hour, Poisson regression is a natural first choice. On the other hand, if you are analyzing how many minutes a single visitor stays, a different regression model suited to a continuous outcome may be appropriate.
How does Poisson regression differ from negative binomial regression?
The difference matters when counts vary too much even after accounting for the observed conditions.
| Category | Poisson Regression | Negative binomial regression |
|---|---|---|
| Conditional variance | Assumed equal to the conditional mean | Allows variance larger than the mean |
| Suitable when | The Poisson assumption is roughly reasonable | Count data with clear overdispersion |
| Cautions | Standard errors can be underestimated under overdispersion | Requires estimating an additional dispersion parameter |
In this example, Pearson χ² divided by the residual degrees of freedom is 1.16. Don't settle on a model from a single indicator alone; also look at the residuals, clustering structure, the frequency of zeros, and so on.
Omitted predictors or correlated observations from the same date can also look like overdispersion. Not all of these problems can be solved with negative binomial regression alone.
Cautions with Poisson regression
Count accurately and check that the observation conditions are comparable.
Check the exposure of each observation unit.
Don't compare visit counts for one hour and for three hours as they are. If the slots differ in length, include log(exposure time) as an offset and analyze the rate per unit time. In this example every slot is 1 hour, so no separate offset is needed.
Check the independence of observations.
Visit counts measured consecutively on the same day of the week or the same date may not be independent. If needed, consider a model that reflects clustering by date or branch, or repeated measures.
Check for overdispersion and excess zeros.
When residual variation is large, negative binomial regression is a candidate; when zeros occur structurally in large numbers, a zero-inflated model and the like can be candidates.
Don't interpret a simple association as a causal effect.
Even if there are fewer visitors on rainy days, you can't conclude that this is a causal effect of the weather itself. There may be omitted factors such as exam periods, events, or the season.
Look at nonlinearity and interactions.
The time-of-day effect may differ between weekdays and weekends, and splitting days only into weekend or not can hide important differences.
What extensions of Poisson regression are there?
The model can be extended to fit the data structure and the research question.
Rate models with an offset
Compare slots with different observation times or available populations by adjusting for exposure.
Quasi-Poisson regression
An approach that keeps the mean structure while adjusting the size of the variance separately. It differs from likelihood-based comparisons that use a full probability distribution.
Negative binomial regression
An alternative for count data whose variance is larger than the conditional mean.
Zero-inflated Poisson regression
Can be considered when there are very many time slots with no visitors at all because of a separate generating process.
Mixed-effects and repeated-measures Poisson regression
Analyzes the data while accounting for the correlation structure across several library branches or repeatedly observed dates.
How do you report Poisson regression results?
Clearly present the observation unit, the coefficients or IRRs, confidence intervals, and model-checking results.
In a paper or report, state that the outcome is the number of visits in a fixed period of time, and explain what the reference condition is. Effect sizes are easiest to understand when presented as IRRs with 95% confidence intervals.
A Poisson regression analysis was conducted on visit counts for 140 time slots collected at a hypothetical library. Weekend, evening time slot, and precipitation were included as predictors. Controlling for the other variables, the expected number of visits in the evening was about 55% higher than in other time slots (IRR = 1.55, 95% CI [1.44, 1.67]).
The sentences above are results from data generated for learning. In a real analysis, you should also report the sampling method, independence, overdispersion, the model selection process, and so on.
Where can Poisson regression be used?
It is used to analyze the number of events that occur in a fixed period or space.
Library and store operations
Analyze the relationship between hourly visit counts and day of week, weather, and promotions.
Medical and health research
Explain the number of emergency room visits or disease cases occurring in a given period.
Traffic and safety analysis
Analyze accident counts by road segment together with traffic volume and road characteristics.
Manufacturing and quality control
Analyze the number of defects per production hour or the number of equipment failures.
Digital service analytics
Predict the number of inquiries received or errors occurring per hour.
Poisson regression is a method for comparing counts of events across conditions.
Interpret changes in the expected count as incidence rate ratios, and check that the variance and observation conditions are appropriate.
Poisson regression is a method used to explain and predict the number of events occurring in a fixed observation unit. In the library example, we looked at how the expected number of visitors changes with day of week, time of day, and weather, and interpreted the differences between conditions as multiples using the incidence rate ratio (IRR).
When interpreting, check whether the observation times are the same, whether repeated observations are independent, and whether the variance is not much larger than the mean. If overdispersion is large, you can adjust the standard errors or consider other approaches such as negative binomial regression. In a real analysis, it is good to present the model's diagnostic results together with the study design.
The core of Poisson regression is linking the expected number of occurrences in count data to predictors. Interpret multiplicative changes with the IRR, the exponentiated coefficient, and check exposure, independence, and overdispersion.