Quantitative Analysis/ Regression
Modelling event counts

What is Poisson regression? Theory, calculation and application

Poisson regression models outcomes that are counts, such as the number of clinic visits or incidents. This guide explains the Poisson distribution, incidence rate ratios, the assumptions and the overdispersion check, and how to run a model in AnalyZ Solutions.

15 min read Regression Advanced

01What is Poisson regression?

Poisson regression is a method for studying outcomes that are counts, meaning how many times something happened. It shows which factors are linked to the count, by how much, and how many events to expect for a particular person.

Many outcomes are counts: the number of clinic visits in a year, the number of days a child was ill, the number of incidents reported at a site. The thing you want to explain is the outcome, and the factors you use to explain it are the predictors. Counts are whole numbers that cannot be negative, and they are often bunched near zero with a long tail of larger values.

An example

Suppose you record the number of clinic visits in a year for 600 people, together with whether each person smokes and their age. You want to know three things. Do smokers make more visits than non-smokers? Does age make a difference? And how many visits would you expect from a smoker aged 40? Poisson regression answers all three.

Why not use an ordinary straight line?

Linear regression fits a straight line to a numeric outcome. For counts it has problems. It can predict a negative number of visits, which is impossible. It assumes the spread of the data is the same everywhere, while counts spread out more as their average rises. And it ignores that counts are whole numbers. Poisson regression is built for counts, so its predictions stay above zero and it takes account of how counts spread.

What you get out of it

  1. Direction
    Whether each predictor goes with more or fewer events.
  2. Size
    How many times more or fewer events, as a ratio called the incidence rate ratio, which a later section explains.
  3. Confidence
    Whether the pattern could easily be chance, shown by a significance level and a confidence interval.
  4. Prediction
    The expected number of events for any combination of predictor values.
Results are adjusted for the other predictors. The effect of each predictor is the effect among people who are the same on the others, so differences in those do not distort it.

02When to use it

Use Poisson regression for outcomes that are counts of events, where each unit could in principle have any non-negative whole number. It fits counts of visits, episodes, incidents, or items. It also works for rates when the exposure is the same for everyone, such as a fixed one-year window. To plan the sample for comparing two incidence rates, see sample size for a change in rate.

It is not appropriate when observation periods differ a lot between units, unless you account for exposure. Nor is it suitable when the count has a fixed upper limit, such as the number of correct answers out of ten, which calls for a binomial or logistic approach.

Poisson compared with linear and negative binomial regression

How the three models differ for count data
FeatureLinear regressionPoisson regressionNegative binomial regression
OutcomeNumeric, roughly continuousA count: 0, 1, 2, and so onA count with extra variation
Distribution assumedNormal errorsPoissonNegative binomial
VarianceConstant, separate from the meanEqual to the meanThe mean plus alpha times the mean squared
PredictionsCan fall below zeroAlways above zeroAlways above zero
How effects actAdd a fixed amountMultiply by a fixed ratioMultiply by a fixed ratio
Effect measureDifference in the outcomeIncidence rate ratioIncidence rate ratio
Typical problemSkewed, discrete outcomeOverdispersionToo many zeros

Linear regression can still work for counts when the average is large, roughly above 10 or 20, because the distribution is then close to symmetric. For small counts with many zeros, Poisson regression is the better choice. If the variation is clearly larger than the average, use negative binomial regression.

03The building blocks: the Poisson distribution, the log scale and rates

Poisson regression rests on three ideas: the Poisson distribution, a way of letting its average change from person to person, and the difference between counts and rates.

The Poisson distribution

The Poisson distribution describes the number of events in a fixed period or space when events happen one at a time, independently of each other, at a steady average rate. If a clinic sees an average of 2 visits per person in a year, the Poisson distribution gives the chance that a particular person makes 0, 1, 2, 3, or more visits.

It has a single number, the average, and that number controls everything. The variance equals the mean, so a group with an average of 2 visits also has a variance of 2. The shape changes with the average. When the average is low, most people have zero or one event and the distribution is lopsided. As the average rises, the distribution spreads out and becomes close to symmetric. Each panel below is scaled to its own tallest bar, so compare the shapes and the stated chance of none, and not the heights.

Figure 1. The Poisson distribution at four different averagesFour small bar charts of Poisson probabilities. At an average of 0.5 most of the probability is at zero. At 10 the distribution is bell-shaped around 10.Average 0.5Chance of none: 61%05101520Average 2Chance of none: 14%05101520Average 5Chance of none: 0.7%05101520Average 10Chance of none: under 0.1%05101520Number of eventsThe average
Figure 1. The Poisson distribution at four different averages

From a distribution to a regression

Poisson regression lets the average differ from person to person according to their characteristics. It does this on the log scale, writing the logarithm of the average count as a straight-line combination of the predictors. Taking the exponential converts it back, which keeps every predicted average above zero. A consequence is that effects are multiplicative: a predictor multiplies the expected count by a fixed factor instead of adding a fixed number to it. That factor is the incidence rate ratio.

Counts and rates

A count is only comparable between people if they were observed for the same length of time. A person seen for twelve months will have more events than one seen for six, even if their underlying rate is the same. The quantity of real interest is then the rate, events per unit of exposure, such as visits per person-year. When everyone has the same exposure, the count and the rate carry the same information, and Poisson regression applies directly. AnalyZ Solutions does not include an exposure adjustment, so use it with a fixed observation window.

04The model and how it is calculated

The model

Poisson regression assumes the count Y follows a Poisson distribution with mean μ, and models the logarithm of the mean as a straight-line combination of the predictors.

ln( μ ) = b0 + b1 × x1 + b2 × x2 + ...
μ = e^(b0 + b1 × x1 + b2 × x2 + ...)
P( Y = k ) = e^-μ × μ^k / k!
variance of Y = μ

Taking the exponential keeps the predicted mean positive. A one-unit increase in a predictor multiplies the mean by e^b, which is the incidence rate ratio, explained under Reading the output. The last line is the defining feature of the Poisson distribution, that the variance equals the mean. The coefficients are found by maximum likelihood.

Making a prediction

Take a smoker aged 40, with age measured in decades, using the coefficients from the results below.

  1. Log of the mean
    0.229 + 0.274 × 1 + 0.098 × 4 = 0.894.
  2. Expected count
    e^0.894 = 2.44 clinic visits a year.
  3. Compare with a non-smoker
    The same steps without the smoking term give 1.86 visits. The ratio 2.44 ÷ 1.86 = 1.315, which is the incidence rate ratio e^0.274.
  4. Chance of no visits
    P(Y = 0) = e^-2.44 = 0.087, or about 9% of smokers of this age.

05Assumptions and the overdispersion check

Poisson regression rests on a few assumptions. Breaking them does not stop the model from running, but it makes the standard errors and significance levels unreliable.

Mean equals variance

Poisson regression assumes the variance of the counts equals their mean. Real counts often vary much more than that, a situation called overdispersion. It occurs when some units have far higher counts than others for reasons the model does not capture. If ignored, standard errors are too small and results look more significant than they should.

AnalyZ Solutions checks for this automatically by comparing the observed variation with what Poisson expects. The ratio is built from the squared gaps between each observed count and its predicted mean, each divided by that mean. If the data really follow a Poisson distribution, these average about 1.

Pearson chi-square = Σ ( y - predicted mean )² / predicted mean
dispersion ratio = Pearson chi-square / N

When the ratio is well above 1, specifically above 1.5, the module shows a warning recommending negative binomial regression. A ratio near 1 supports the Poisson assumption. In the example under Interpreting the result the ratio is 0.95, so the model is suitable. The figure compares the 600 observed counts with what a Poisson model with the same average expects, and the two agree closely. The negative binomial guide shows a case where they do not.

Figure 2. Observed visit counts against what a Poisson model expects (no predictors)Bar chart of observed counts with a Poisson curve that follows the bars closely.0%10%20%30%012345678910+Observed share of peoplePoisson model expectsAverage 2.08, variance 2.12: close to equalNumber of clinic visits in a yearShare of people
Figure 2. Observed visit counts against what a Poisson model expects (no predictors)

06Reading the output

Incidence rate ratios

An incidence rate ratio, or IRR, compares expected counts between two situations. A ratio of 1 means no difference, above 1 means higher counts, and below 1 means lower counts. If the IRR for smokers compared with non-smokers is 1.3, smokers are expected to have 30% more events. If the IRR for each additional 10 years of age is 1.08, each extra decade goes with 8% higher expected counts.

Ratios multiply, which is why they are convenient. Two predictors with IRRs of 1.3 and 1.2 together suggest counts about 56% higher, since 1.3 times 1.2 is 1.56. Two small calculations help when describing results:

percentage change = (IRR - 1) × 100
effect of k units = IRR ^ k

An IRR of 1.315 means 31.5% more events, and an IRR of 0.80 means 20% fewer. For a numeric predictor the ratio applies per unit. With an IRR of 1.10 per decade of age, twenty years of age go with 1.10 × 1.10 = 1.21, or 21% more events.

Because effects multiply, the same ratio produces a growing difference in absolute terms. The figure shows smokers and non-smokers by age in the example. The ratio is 1.31 at every age, but the gap in expected visits grows from 0.53 visits at age 30 to 0.75 at age 65, because the baseline count is higher at older ages. Reporting only the ratio, or only the difference, hides half of the picture, so give the baseline count as well.

Figure 3. A constant ratio produces a gap that grows with the baselineTwo rising curves of expected visits by age for smokers and non-smokers. The ratio between them is the same at every age but the vertical gap widens.01234203040506070Non-smokersSmokersAge 30: ratio 1.31, gap 0.53 visitsAge 65: ratio 1.31, gap 0.75 visitsAgeExpected clinic visits in a year
Figure 3. A constant ratio produces a gap that grows with the baseline

Coefficients and rate ratios

Each predictor has an IRR with a 95% confidence interval and significance level. A toggle switches between IRRs and raw coefficients on the log scale. The raw coefficient b is the natural logarithm of the IRR, so IRR = e^b. In the example the coefficient for smoking is 0.274 and the IRR is e^0.274 = 1.315. For small coefficients, b is close to the proportional change, but the IRR is the exact figure.

The interval is calculated on the log scale and then converted back, so it is not centred on the IRR. For smoking, the interval of 1.171 to 1.477 sits around an IRR of 1.315, with more room above it than below. An interval that spans 1 corresponds to a predictor that is not significant at the 5% level.

Model fit

The summary reports the number of cases, log-likelihood, a likelihood-ratio test of whether the predictors improve on a model with none, a pseudo R-squared, AIC, and the dispersion ratio. A significant likelihood-ratio test means the predictors help. Pseudo R-squared is usually low for counts, 0.02 in the example, because counts are noisy even when the model is right, so do not judge a Poisson model by it. AIC is useful for comparing with a negative binomial model fitted to the same data, where the lower value is better. The dispersion ratio is the check described in the previous section.

07How to run it in AnalyZ Solutions

Open Inferential Analysis, choose Regression, then Poisson Regression.

  1. Select the dependent variable
    Choose a count variable with non-negative whole numbers. The module suggests suitable columns and tells you if none were detected automatically.
  2. Select the predictor variables
    Choose numeric or categorical predictors.
  3. Set reference categories
    Categorical predictors are converted to comparisons against a reference category automatically. Pick the reference category you want each group compared with, usually the largest or the most natural comparison group.
  4. Apply a subsample filter if needed.
  5. Click Run regression
    The output includes the IRR table, the model summary, any overdispersion warning, a coefficient plot, and a plain-language interpretation.
Look at the counts first. If the average is 0.8 and a handful of respondents report 15 or more, expect overdispersion. A quick look at the distribution in Descriptive Analysis tells you whether negative binomial regression is the better starting point.

08Interpreting the result

The figures below are invented to show the steps, and they follow the results tables in AnalyZ Solutions, with a few columns left out to save space. Suppose the number of clinic visits in a year is modelled for 600 people using smoking status (reference: Non-smoker) and age in decades.

Model summary
NLog-likelihoodLR chi2Prob > chi2Pseudo R²AICDispersion (Pearson chi2/N)
600-1020.707338.64< 0.0010.0192047.410.948
Incidence rate ratios
VariableIRR95% CI lower95% CI upperp-valueSig
Smoker (ref: Non-smoker)1.3151.1711.477< 0.001***
Age (per 10 years)1.1031.0531.154< 0.001***

Reading it step by step

  1. Check for overdispersion first
    The dispersion ratio is 0.948, well below the warning level of 1.5. The average number of visits is 2.08 and the variance is 2.12, which is what a Poisson model expects, so the model is suitable and no warning appears.
  2. Read a categorical predictor
    The rate ratio for smokers is 1.315, with an interval of 1.171 to 1.477. Smokers make about 32% more visits than non-smokers of the same age. The interval is entirely above 1, and the result is significant at the 0.1% level.
  3. Read a numeric predictor
    The rate ratio for age is 1.103 per 10 years, so each extra decade goes with about 10% more visits. Ratios multiply, so a smoker who is 20 years older is expected to make about 1.315 × 1.103 × 1.103 times as many visits, or roughly 60% more.
  4. Keep the fit in perspective
    The pseudo R² is 0.019, which is low. Both predictors matter, but they explain only a small part of why some people visit more than others.

In plain words

Smokers made about 32% more clinic visits than non-smokers, and each extra decade of age was associated with about 10% more visits, both significant at the 0.1% level. The dispersion check showed that a Poisson model was suitable. The predictors explained little of the total variation in visits, so most of the difference between people remains unexplained.

09Common mistakes

Ignoring an overdispersion warning. Switch to negative binomial regression.

Reporting the ratio without the baseline count. A ratio of 1.3 means something different when the baseline is 0.2 visits than when it is 20. Give the expected counts alongside the ratio.

Using it for counts with different exposure. If some people were observed for six months and others for twelve, the counts are not comparable without adjustment.

Modelling a bounded count. Counts out of a fixed total are better handled by logistic regression.

Too many zeros. If many more units have zero than the model expects, for example because many people never use the service at all, neither Poisson nor negative binomial may fit well.

Frequently Asked Questions
Why does the model use a logarithm?
The logarithm keeps every predicted average above zero, which a count needs, and it turns the effects of the predictors into constant ratios. That is why the results are reported as ratios, and why e raised to a coefficient gives the incidence rate ratio.
What is the difference between a count and a rate?
A count is the number of events. A rate is the number of events per unit of exposure, such as visits per person-year. When everyone is observed for the same length of time, the two carry the same information. When observation periods differ, the rate is the fair comparison, and AnalyZ Solutions does not adjust for exposure.
What is the difference between an IRR and an odds ratio?
An odds ratio compares the odds of a yes or no outcome. An IRR compares the expected number of events. An IRR of 1.3 means 30% more events, which is easy to explain.
What does overdispersion mean?
It means the counts vary more than a Poisson model expects. A few units have very high counts. Standard errors from a Poisson model are then too small, which makes results look more significant than they are.
When should I switch to negative binomial?
When the module shows an overdispersion warning, or when you can see from the data that the variation is much greater than the average. Negative binomial regression gives more honest standard errors in that case.
Can the outcome include zeros?
Yes. Poisson regression handles zeros. If you have far more zeros than expected, other models designed for excess zeros may fit better, though they are not part of this module.
How do I handle different observation periods?
The module does not include an exposure adjustment. Where possible, restrict the analysis to units observed for the same length of time, using the subsample filter if the data holds the observation period.

Model counts in your data

Open Regression in AnalyZ Solutions. Free to sign up, free to analyze.

Get started
Related Guides