Chapter 11 · Regression models

How do you model counts and rates?

Poisson regression, incidence rate ratios, overdispersion and log-linear models for multi-way tables.

Read first: Risk and survival, Choosing a test

The problem first

You are a DM Neurology resident. Your thesis compares an add-on antiepileptic drug with standard treatment in 120 patients with drug-resistant epilepsy. Seizure diaries were kept for 3 to 6 months, depending on when each patient was recruited.

You entered the total seizure count as the outcome in a Poisson regression and wrote: “The add-on drug reduced seizures (rate ratio 0.78, 95% CI 0.68 to 0.89, p < 0.001).” Your guide looks at the seizure counts column and asks two questions.

“Your patients were followed for 3 to 6 months, and one of them had 52 seizures. What did your analysis do about each of those?”

Start here

What makes a count different from a measurement?

A count is the number of times something happened: seizures in a month, infections in an ICU, admissions in a year. It can only be 0, 1, 2 and so on. It cannot be negative, and when the average is small most values pile up near 0.

Mean 0.50481216variance 0.5, SD 0.71Mean 20481216variance 2, SD 1.41Mean 80481216variance 8, SD 2.83
Made-up teaching example: the Poisson distribution with three different means. When the mean is small the distribution is skewed to the right. As the mean rises it becomes wider and more symmetric. The variance is always equal to the mean, so a count with a higher mean also varies more.

Three features of counts cause problems for the t-test and linear regression. The distribution is skewed when the mean is low. The variance rises with the mean, so groups with more events vary more. And the count depends on how long, or how many people, you watched: a patient followed for 6 months has more chance to record seizures than a patient followed for 3.

The Poisson distribution

When does a count follow a Poisson distribution?

When there are many opportunities for an event, each with a small probability, the events happen independently of each other, and the underlying rate stays the same, the number of events follows a Poisson distribution.

0.13500.27110.27120.18030.09040.0365deaths among 2,000 birthsbinomial, n 2,000, p 0.001Poisson, mean 2
Made-up teaching example: 2,000 births in a year, each with a 1 in 1,000 risk of a particular neonatal death. The exact binomial probabilities and the Poisson probabilities with mean 2,000 × 0.001 = 2 differ by less than 0.001. When n is large and p is small, the binomial distribution approaches the Poisson distribution.

P(k events) = e−μ × μk ÷ k!

k
number of events: 0, 1, 2, …
μ
mean number of events in the interval (in the figure, 2 deaths a year)
k!
k factorial: 1 × 2 × … × k, with 0! = 1
mean = variance
both equal μ, so the SD is √μ

Worked example

With a mean of 2 events a year:

  • P(0) = e−2 = 0.1353. In about 14 years out of 100 there would be no such death.
  • P(1) = e−2 × 2 ÷ 1 = 0.2707. P(2) = e−2 × 4 ÷ 2 = 0.2707.
  • P(5 or more) = 1 − [P(0) + P(1) + P(2) + P(3) + P(4)] = 1 − 0.9473 = 0.0527.

Uses of the Poisson distribution

  • Rare events in large populations: cases of a disease per year in a district, deaths per 1,000 person-years.
  • Counting in the laboratory and in nuclear medicine: counts from radioactive decay, colonies on a plate, cells in a counting chamber. The SD of a count N is √N. 10,000 counts have an SD of 100 (1%), and 100 counts an SD of 10 (10%).
  • Checking whether events cluster: if events occur more in bunches than a Poisson distribution predicts, the variance will be larger than the mean.
  • Poisson regression: modelling counts and rates with several predictors, described below.

For a large mean the Poisson distribution becomes close to a normal distribution with mean μ and SD √μ. With μ = 16, the exact P(10 or fewer) is 0.0774 and the normal approximation with continuity correction gives 0.0846.

Interactive

Change the average seizure count and watch the Poisson probabilities and the variance change

In a Poisson distribution the variance equals the mean, so the spread rises as the mean rises.

Try this: move the average from 2 to 8 seizures a month. The bars spread out and become more symmetric, and the variance rises with the mean, because in a Poisson distribution the two are always equal.

Teaching example: seizures per month in patients who all have the same underlying seizure rate. Made-up numbers.

2.0

Mean and variance are both μ

5

Bars from this count upwards are red

Sample 1 of 100 patients
13.5%chance of a month with no seizures
5.3%chance of 5 or more seizures in a month

Mean 2.0, variance 2.0, SD 1.41. In the sample of 100 patients: mean 2.06, variance 1.96, variance ÷ mean 0.95.

0%14%28%012345678910seizures in a monthbars: Poisson probabilityrings: share of the 100 sampled patients

Rates and the offset

Why compare events per person-time and not the counts?

A count depends on how long, and on how many people, you observed. A rate divides the count by the time at risk: infections per 1,000 catheter-days, deaths per 1,000 person-years, seizures per patient-month.

ICU A3,600 catheter-days, 18 infections5.0 per 1,000ICU B1,200 catheter-days, 9 infections7.5 per 1,000Each red mark is one infection. Bar length is catheter-days.
Made-up teaching example. ICU A recorded twice as many infections as ICU B, but it also had three times the catheter-days. Its rate, 18 ÷ 3,600 × 1,000 = 5.0 per 1,000 catheter-days, is lower than ICU B's 9 ÷ 1,200 × 1,000 = 7.5.

Poisson regression with an offset

Poisson regression models the logarithm of the expected count. To model a rate, the logarithm of each unit's time at risk is added to the model with its coefficient fixed at 1. This term is the offset. The SPSS manual describes it as a “structural” predictor whose coefficient is not estimated but assumed to be 1.

ln(expected count) = ln(time at risk) + b₀ + b₁x₁ + … + bₖxₖ

which is the same as   ln(expected count ÷ time at risk) = b₀ + b₁x₁ + … + bₖxₖ

ln(time at risk)
the offset: catheter-days, person-years, months of follow-up, population × years
eb₀
the rate when every predictor is 0
ebᵢ
the incidence rate ratio (IRR) for a 1-unit rise in xᵢ, adjusted for the other predictors

Worked example: two ICUs

IRR = (18 ÷ 3,600) ÷ (9 ÷ 1,200) = 5.0 ÷ 7.5 = 0.67

SE of ln IRR = √(1/18 + 1/9) = 0.408   95% CI = eln 0.667 ± 1.96 × 0.408 = 0.30 to 1.48

p = 0.32. A Poisson regression with ICU as the only predictor and ln(catheter-days) as the offset gives the same IRR, confidence interval and p-value. Without the offset, the ratio of counts (2.0) would point the wrong way.

Incidence, prevalence and person-time are introduced in the risk and survival chapter.

Interactive

Change infections and catheter-days and watch the counts and the rates disagree

The incidence rate ratio uses the time at risk. Its confidence interval depends on the number of events.

Try this: press "Ten times the data". The rates and the rate ratio stay the same, but the confidence interval becomes much narrower, because precision depends on the number of infections, not on the rate.

Made-up teaching numbers. The ICU example from this chapter.

2.00ratio of infection counts, A ÷ B
0.67incidence rate ratio, A ÷ B

ICU A: 5.00 infections per 1,000 catheter-days. ICU B: 7.50. IRR 0.67 (95% CI 0.30 to 1.48), p = 0.321. The interval includes 1, so these data are compatible with equal rates.

Infections (counts)Infections per 1,000 catheter-days18ICU A9ICU B5.00ICU A7.50ICU B3,600 and 1,200 catheter-days

Reading the output

How do you read an incidence rate ratio?

An incidence rate ratio compares event rates. An IRR of 0.78 means the rate in one group is 78% of the rate in the reference group, a 22% lower rate, after adjusting for the other predictors.

  • Per category: each category is compared with the reference category, as in logistic regression.
  • Per unit: for a continuous predictor the IRR is per 1-unit rise. For k units use ek × b.
  • Rate, not risk: the IRR compares events per unit of time. It allows for repeated events in the same patient and for different follow-up.
  • Absolute numbers: a ratio does not show how many events are prevented. Give the rates in each group as well, for example seizures per patient-month (STROBE item 16c asks authors to consider translating relative risks into absolute risks).
FeatureIncidence rate ratioRisk ratio
ComparesEvents per unit of person-timeProportion of people with at least one event
Repeated events in one patientAll countedOnly the first counts
Different follow-upAllowed for through the offsetNeeds equal follow-up, or survival methods
ModelPoisson or negative binomial regressionLog-binomial or modified Poisson regression
ExampleSeizures per patient-monthProportion of patients with any seizure

Poisson regression can also estimate risk ratios for a yes/no outcome. Zou (2004) proposed Poisson regression with robust standard errors for prospective studies with binary data, the “modified Poisson” approach, because the usual Poisson standard errors are wrong for a 0/1 outcome. The logistic regression chapter explains when a risk ratio is needed instead of an odds ratio.

Overdispersion

What if the counts vary more than a Poisson distribution allows?

Poisson regression assumes that patients with the same predictor values have the same underlying rate. Real patients differ: some have frequent seizures and some rare ones. Mixing patients with different rates makes the variance larger than the mean. This is overdispersion.

Every patient: 2 seizures a month0246810seizures in a monthmean 2, variance 2months with no seizure: 13.5%Half 0.5, half 3.5 a month0246810seizures in a monthmean 2, variance 4.25months with no seizure: 31.8%
Made-up teaching example. On the left, every patient has the same rate of 2 seizures a month, and monthly counts follow a Poisson distribution. On the right, half the patients have 0.5 and half 3.5 seizures a month. The average is still 2, but the variance rises to 2 + 1.5² = 4.25, and months with no seizures rise from 13.5% to 31.8%.

Why it matters

Poisson regression calculates its standard errors from the assumption that variance equals mean. When the variance is larger, the standard errors are too small, the confidence intervals too narrow and the p-values too small. The rate ratio itself is usually estimated reasonably, but its precision is overstated.

How to detect it

  1. Variance ÷ mean of the counts in each group. In the teaching trial below: 34.4 ÷ 7.6 = 4.5 with standard treatment and 72.6 ÷ 6.17 = 11.8 with the add-on drug. (With unequal follow-up this is only a rough check.)
  2. Pearson χ² ÷ residual degrees of freedom after fitting Poisson regression. Close to 1 is consistent with a Poisson distribution. The teaching trial gives 813.07 ÷ 118 = 6.89. The deviance ÷ df, 5.48, is a similar check.
  3. Likelihood ratio test of α = 0: compares the negative binomial model with the Poisson model. Teaching trial: χ² = 332.4, p < 0.001.
  4. Observed and expected frequencies: compare how many patients had 0, 1, 2 … events with the numbers each model predicts.
05101505101520+seizures during follow-uppatientsobservedPoisson expectednegative binomial expected
Teaching trial, made-up data: seizure counts of 120 patients over 3 to 6 months. The Poisson model (red line) predicts 0.4 patients with no seizures and almost nobody with 20 or more. The trial had 9 patients with no seizures and 5 with 20 or more. The negative binomial model (dashed line) predicts 10.0 and 6.3.

The fix: negative binomial regression

Negative binomial regression uses the same log link and offset, and gives incidence rate ratios in the same way. It adds one parameter, α, for the extra variation between patients:

variance = μ + α × μ²

When α = 0 the model is Poisson regression. Two other corrections keep the Poisson estimates but enlarge the standard errors: quasi-Poisson regression, which multiplies them by √(Pearson χ² ÷ df), and robust standard errors. In the teaching trial all three corrections give similar intervals, all wider than the Poisson interval.

FeaturePoisson regressionNegative binomial regression
VarianceEqual to the meanMean + α × mean²
Extra parameterNoneα (SPSS calls it the ancillary parameter; R's MASS::glm.nb estimates θ = 1/α)
SuitsCounts from a constant rate: radioactive counts, rare events in large populationsCounts that vary between patients: seizures, exacerbations, days in hospital
If overdispersion is presentStandard errors too small, p-values too smallStandard errors allow for it
Teaching trial, IRR (95% CI)0.78 (0.68 to 0.89), p < 0.0010.78 (0.57 to 1.09), p = 0.14
AIC in the teaching trial1041.3710.9 (lower is better)

Interactive

Increase the extra variation and watch the Poisson confidence intervals stop covering the true rate ratio

A 95% confidence interval should contain the true value in about 95 of 100 studies. With overdispersion, Poisson intervals do so less often.

Try this: start at a variance ÷ mean ratio of 1, where both methods give 95% intervals that contain the true rate ratio in about 95 of 100 trials. Move the ratio to 4 and watch the Poisson coverage fall while the negative binomial coverage stays close to 95%.

Made-up trials: control patients average 3 seizures during follow-up, and the new drug truly lowers the rate by 25% (true rate ratio 0.75). Each setting runs 200 trials.

1.0

1 = Poisson; above 1 = overdispersion

60

30, 60 or 120

Run 1
96%Poisson 95% CIs that contain the true rate ratio
97%negative binomial 95% CIs that contain it

Across the trials the estimated ln(rate ratio) actually varied with SD 0.110. Poisson regression reported an average standard error of 0.114; negative binomial regression reported 0.117 (average estimated α 0.02). Both standard errors are close to the actual variation.

true 0.750.250.50.7511.52.25black: negativebinomial CIred: Poisson CIrate ratio (log scale), first 30 trials

Zeros

What if there are more zeros than the model expects?

Sometimes the zeros come from two sources. Some people cannot have the event at all, such as non-smokers when the outcome is cigarettes smoked. Others could have it but did not, by chance. A zero-inflated model treats these two sources separately.

Adults who smoked 0 cigarettes yesterday (of 300)Observed174Poisson5.3Negative binomial162.2Zero-inflated Poisson174.0174 non-smokers cannot have a count above 0. The 126 smokers reported 1 or more.
Made-up teaching example: cigarettes smoked yesterday by 300 adults. Mean 4.04, variance 37.9. A Poisson model expects only 5.3 zeros. A negative binomial model, which allows for extra variation, expects 162.2. A zero-inflated Poisson model estimates that 58% of people belong to a group that always reports 0, and that the others smoke 9.6 cigarettes a day on average. It reproduces the 174 zeros.
  • Zero-inflated model: Lambert (1992) described zero-inflated Poisson regression: with probability p the only possible observation is 0, and with probability 1 − p a Poisson count is observed. Both parts can depend on predictors. A zero-inflated negative binomial model uses a negative binomial count part.
  • Hurdle model: one part models whether the count is zero or not, and a second part models the size of the count among those above zero.
  • Check the negative binomial model first. Many zeros are not the same as excess zeros. In the seizure trial the negative binomial model predicts 10.0 patients with no seizures against 9 observed, so no zero-inflated model is needed.
  • Choose a zero-inflated model only when there is a clinical reason for a group that cannot have the event.

Multi-way tables

How do you analyse a table with three categorical variables?

A log-linear model is Poisson regression applied to the cell counts of a contingency table. There is no single outcome variable. The interaction terms describe which variables are associated.

Hospital A30.7%28.0%newstandard46 of 15014 of 50OR 1.14Hospital B10.0%10.7%newstandard5 of 5016 of 150OR 0.93Both hospitals pooled25.5%15.0%newstandard51 of 20030 of 200OR 1.94
Made-up teaching example: 400 operations in two hospitals. Pooled, the new technique has more infections (25.5% against 15.0%, odds ratio 1.94). Within each hospital there is almost no difference (odds ratios 1.14 and 0.93). Hospital A uses the new technique more often and has more infections, so hospital is associated with both technique and infection.

The models, from simplest to saturated

Write hospital as H, technique as T and infection as O. The notation lists the highest interactions included: [HT][HO] means the model contains H, T, O, the H × T term and the H × O term.

ModelWhat it saysG²dfp
[H][T][O]Mutual independence: no two variables are associated129.164< 0.001
[HT][O]Infection is independent of hospital and technique together24.513< 0.001
[HT][HO]Conditional independence: technique and infection are independent within each hospital0.1520.93
[HT][HO][TO]Homogeneous association: the technique–infection odds ratio is the same in both hospitals0.1010.76
[HTO]Saturated: fits every cell exactly00—

G² (the deviance) compares each model's expected counts with the observed counts. A small G² with a large p-value means the model fits. The conditional independence model [HT][HO] fits, and adding the T × O term improves G² by only 0.05 (p = 0.82). The technique–infection association in the pooled table (G² = 6.89, 1 df, p = 0.009) disappears once hospital is in the model.

ln(expected count) = λ + λH + λT + λO + λHT + λHO

FeatureLog-linear modelLogistic regression
OutcomeNone: all variables are treated alikeOne yes/no outcome
What is modelledThe count in each cell of the tableThe log-odds of the outcome
AnswersWhich variables are associated, and whether an association holds within strataHow predictors change the odds of the outcome
Teaching tableAdding [TO] to [HT][HO]: G² falls by 0.05, p = 0.82Infection on hospital and technique: likelihood ratio test for technique 0.05, p = 0.82
LinkA log-linear model that contains the [HT] term gives the same test as the logistic modelPreferred when one variable is clearly the outcome

Decide

Which count model fits your data?

Answer the questions in order. Each answer links to its section.

What do your data look like?

Which count model: all possible answers
  • Poisson regression: Report the incidence rate ratio with its 95% CI and the dispersion you checked.
  • Negative binomial regression: The same incidence rate ratios, with standard errors that allow for extra variation between patients.
  • Zero-inflated or hurdle model: Models the zeros and the counts separately. Needs a clinical reason for a separate group with no events.
  • Log-linear model: Poisson regression on the cell counts. The interaction terms describe the associations.
  • Modified Poisson regression: Poisson regression on the yes/no outcome with robust standard errors gives risk ratios.

The formula

Worked example: the seizure trial

Made-up teaching data: the trial at the top of this chapter. 60 patients per group, followed for 3 to 6 months. Fitted in Python with statsmodels, with ln(months of follow-up) as the offset.

Standard treatmentAdd-on drug
Patients6060
Seizures456370
Patient-months of follow-up271282
Rate per patient-month1.681.31
Mean and variance of the counts7.6 and 34.46.2 and 72.6
Patients with 0 seizures63
  1. Crude rate ratio: (370 ÷ 282) ÷ (456 ÷ 271) = 1.312 ÷ 1.683 = 0.78.
  2. Poisson regression: B = −0.2488, SE 0.070. IRR = e−0.2488 = 0.78, 95% CI e−0.2488 ± 1.96 × 0.070 = 0.68 to 0.89, p < 0.001.
  3. Check dispersion: Pearson χ² 813.07 on 118 df, ratio 6.89. The counts vary about seven times more than a Poisson distribution allows.
  4. Negative binomial regression: B = −0.2422, SE 0.165, α = 0.67. IRR = 0.78, 95% CI 0.57 to 1.09, p = 0.14.
  5. Compare the models: likelihood ratio test of α = 0, χ² = 332.4, p < 0.001. AIC 1041.3 (Poisson) against 710.9 (negative binomial).
  6. Other corrections: quasi-Poisson 95% CI 0.54 to 1.12 (p = 0.18). Poisson with robust standard errors 0.53 to 1.15 (p = 0.21).
  7. Zeros: 9 observed, 0.4 expected under Poisson, 10.0 under the negative binomial model. No zero-inflated model is needed.
  8. Absolute difference: 1.683 − 1.312 = 0.37 fewer seizures per patient-month, 37.1 per 100 patient-months.

Conclusion: the point estimate is the same, a 22% lower seizure rate, but once the variation between patients is allowed for, the data are compatible with anything from a 43% reduction to a 9% increase.

In a real paper

Count models in two published cohort studies

Open-access paper · CC BY

van Hasselt TJ, Dorner RA, Katheria A, Battersby C, Gale C, Lo DKH, et al. Neonatal morbidities and hospitalization in the first 2 years of life among infants born very preterm. JAMA Netw Open. 2025;8(9):e2530123.

The study: A national retrospective cohort of 39 413 children born at 22 to 31 weeks' gestation in England and Wales (2013 to 2018) and discharged home from neonatal care. The outcome was the total number of calendar days in hospital between neonatal discharge and age 2 years: a count that was 0 for about a third of children and very long for a few.

What the authors wrote
“Negative binomial regression was used to calculate the adjusted incidence rate ratio (AIRR) for total calendar days hospitalized, adjusting for gestational age, sex, small for gestational age, and season of neonatal discharge.”
In plain words

The outcome is a count of days, not a yes/no event, so a count model was used. Negative binomial regression was chosen instead of Poisson regression because days in hospital vary far more between children than a Poisson distribution allows. The adjusted incidence rate ratio compares the expected number of days in hospital between groups of children with the same gestational age, sex, small-for-gestational-age status and season of discharge.

ReportedValueWhat it means
AIRR, bronchopulmonary dysplasia vs none1.80 (95% CI, 1.72-1.88)Children with BPD were expected to spend 1.80 times as many days in hospital
AIRR, severe NEC vs none1.88 (95% CI, 1.65-2.15)88% more days in hospital
AIRR, neonatal brain injury vs none1.46 (95% CI, 1.36-1.57)46% more days in hospital
AIRR, <24 weeks vs 31 weeks (reference)2.03 (1.74-2.37)A categorical predictor compared with its reference category
AIRR, male vs female (reference)0.86 (0.83-0.89)Below 1: boys spent fewer days in hospital
Likelihood ratio test of α = 0P < .001Overdispersion present, so Poisson regression was not appropriate
Children at least once in hospital26 498 (67.2%)About a third of children had a count of 0
Check these when you read it
  • Is the reason for negative binomial rather than Poisson regression given? Here a likelihood ratio test of α = 0 is reported in the table footnote.
  • Did every child have the same time at risk? Follow-up ran from neonatal discharge to age 2, and no offset is described.
  • With about a third of children at 0 days, were the zeros checked against the zeros the model predicts?
  • Are rates or expected days given as well as ratios? The authors give expected days for combinations, such as 40.6 days for a child born before 24 weeks with 3 morbidities.
  • Is the reference category stated for each categorical predictor?
Open-access paper · CC BY-NC-ND

Buchardt AS, Nielsen JSA, Jensen A, Bohnstedt C, Munkholm A, Pedersen O, et al. Pediatric intensive care utilization and outcomes in Denmark. JAMA Netw Open. 2026;9(8):e2629876.

The study: A population-based retrospective cohort of children aged 0 to 17 years admitted to ICUs in 19 public Danish hospitals, 2019 to 2024: 7875 children and 9458 ICU admissions. The number of children at risk changed from year to year, so admission counts had to be turned into rates per person-year.

What the authors wrote
“To examine incidence over time, incidence rate ratios (IRRs) were modeled using Poisson regression with the logarithm of the number of person-years as offsets and comparing the IR in a given calendar year with the IR in the reference year (2020).”
In plain words

Each calendar year contributes a count of admissions and a number of person-years. The logarithm of person-years enters as the offset, so the model compares admissions per person-year, not raw admission counts. Each year is a category compared with 2020, the reference year. The authors add that repeated contacts by the same child were allowed for with robust standard errors in the confidence intervals.

ReportedValueWhat it means
Person-time1 155 101 (2020) and 1 378 002 (2024) person-yearsThe denominator changed by 19%, so counts alone would mislead
ICU admission rate, 20201.35 (95% CI, 1.35-1.35) per 1000 person-yearsRate = admissions ÷ person-years
ICU admission rate, 20241.17 (95% CI, 1.17-1.17) per 1000 person-yearsRate × person-years: about 1,600 admissions in that year
IRR, 2024 vs 20200.86 (95% CI, 0.86-0.86)A 14% lower ICU admission rate in 2024
Check these when you read it
  • Are the confidence intervals plausible for the number of events? With about 1,600 ICU admissions a year, a Poisson approximation from the reported rates and person-years (our calculation) gives roughly 1.11 to 1.23 for the 2024 rate and 0.81 to 0.93 for the IRR, not intervals identical to the estimates.
  • Was overdispersion or clustering addressed? Here repeated contacts by the same child were allowed for with robust standard errors.
  • Is the offset the logarithm of the right denominator (person-years of children at risk)?
  • Is the reference year stated, and was a sensitivity analysis done with another reference year? The authors repeated the analysis with 2022.

How to run it

Running Poisson, negative binomial and log-linear models in SPSS, R and jamovi

Menu paths are from the IBM SPSS Statistics 27 manuals. Functions and arguments are from the CRAN reference manuals and the R documentation.

SPSS

  1. Create the offset: Transform > Compute Variable, with ln_months = LN(months). The offset must be the logarithm of the time at risk.
  2. Analyze > Generalized Linear Models > Generalized Linear Models. On the Type of Model tab, under Counts, choose Poisson loglinear.
  3. On the Response tab choose the count. On the Predictors tab add factors and covariates and put ln_months in Offset. Add the effects on the Model tab.
  4. The goodness-of-fit statistics include the deviance and Pearson chi-square. Divide Pearson chi-square by the residual degrees of freedom to check dispersion. The IRR is eB.
  5. For negative binomial regression, the Negative binomial with log link option fixes the ancillary parameter at 1. To estimate it, choose Custom, distribution Negative binomial, link Log, and Estimate value for the parameter.
  6. Log-linear models: Analyze > Loglinear > Model Selection fits hierarchical log-linear models with backward elimination. Analyze > Loglinear > General fits a specified model.

R

fit_p <- glm(seizures ~ drug + offset(log(months)), family = poisson, data = d)
exp(cbind(IRR = coef(fit_p), confint.default(fit_p)))
sum(residuals(fit_p, type = "pearson")^2) / df.residual(fit_p)   # dispersion ratio
performance::check_overdispersion(fit_p)

fit_nb <- MASS::glm.nb(seizures ~ drug + offset(log(months)), data = d)   # estimates theta = 1/alpha
exp(cbind(IRR = coef(fit_nb), confint.default(fit_nb)))
fit_q  <- glm(seizures ~ drug + offset(log(months)), family = quasipoisson, data = d)
lmtest::coeftest(fit_p, vcov. = sandwich::vcovHC(fit_p, type = "HC0"))    # robust standard errors

pscl::zeroinfl(cigs ~ age | age, dist = "negbin", data = z)   # count part | zero part
performance::check_zeroinflation(fit_nb)

m1 <- glm(n ~ H*T + H*O, family = poisson, data = cells)       # log-linear: [HT][HO]
m2 <- update(m1, . ~ . + T:O)
anova(m1, m2, test = "Chisq")

jamovi

  1. Log-linear models: Analyses → Frequencies → Log-Linear Regression, with the categorical variables as factors and the cell counts as the counts variable.
  2. Poisson and negative binomial regression need the GAMLj module, installed from the jamovi library. It adds a Linear Models menu containing Generalized Linear Models, with Poisson, Poisson (overdispersion) and Negative binomial model types.
  3. GAMLj's Offset variable enters the model with its coefficient fixed at 1, so supply ln(time at risk), not the time itself.

How to report it

What to write in the thesis and the paper

Give the counts, the time at risk and the rates, say how you checked dispersion, then give the rate ratio with its confidence interval.

Methods

  • The count outcome and how time at risk was measured (person-years, catheter-days, months of follow-up), and that its logarithm was the offset.
  • The model and why: Poisson, negative binomial, quasi-Poisson or robust standard errors, and how overdispersion and excess zeros were assessed (STROBE item 12a: describe all statistical methods).
  • Predictors adjusted for and why (STROBE item 16a), reference categories, software and version.

Results

  • Events, time at risk and rate in each group, then unadjusted and adjusted IRRs with 95% CIs.
  • The dispersion statistic or test result, and absolute rate differences where they help (STROBE item 16c).

A worked sentence using this chapter's teaching numbers

Over 553 patient-months of follow-up there were 456 seizures with standard treatment (1.68 per patient-month) and 370 with the add-on drug (1.31 per patient-month). Seizure counts were overdispersed (Pearson χ² ÷ df 6.89; likelihood ratio test of α = 0, p < 0.001), so negative binomial regression with ln(months of follow-up) as the offset was used. The add-on drug was associated with a 22% lower seizure rate (incidence rate ratio 0.78, 95% CI 0.57 to 1.09, p = 0.14), or 0.37 fewer seizures per patient-month.

By specialty

Count model problems by specialty

An add-on antiepileptic trial counts seizures from diaries, with follow-up of 3 to 6 months per patient.

Use ln(months of follow-up) as an offset, and expect overdispersion: a few patients have many more seizures than the rest.

Common myths

Common mistaken beliefs

  • Myth: More events in one group means a higher rate.

    Only if time at risk is the same. ICU A had twice ICU B's infections and a lower rate: 5.0 against 7.5 per 1,000 catheter-days.

  • Myth: A very small p-value from Poisson regression settles the question.

    Check dispersion first. In the teaching trial Poisson regression gave p < 0.001 and negative binomial regression p = 0.14 for the same rate ratio of 0.78.

  • Myth: Many zeros always need a zero-inflated model.

    A negative binomial model often predicts them. In the seizure trial it expected 10.0 zeros against 9 observed.

  • Myth: The offset is one more predictor to adjust for.

    Its coefficient is fixed at 1, and it must be the logarithm of the time at risk.

  • Myth: An incidence rate ratio is the same as a risk ratio.

    The IRR compares events per unit of person-time and counts every event. The risk ratio compares the proportion of people with at least one event.

  • Myth: Counts can be analysed with a t-test on the mean count.

    A t-test ignores unequal follow-up and the link between the mean and the variance, and gives no rate ratio.

Why this matters to you

Five consequences of getting count models wrong

  1. Protocol sent back

    A plan that compares "number of infections" between wards without catheter-days or patient-days as the denominator.

  2. A wrong conclusion in the thesis

    Poisson regression on overdispersed seizure counts gives a p-value that is far too small, and a drug is declared effective on weak evidence.

  3. Questions you cannot answer at the viva

    "How did you allow for different follow-up?" and "Did you check whether the variance was larger than the mean?" need the offset and a dispersion statistic.

  4. Misreading papers

    Accepting a rate ratio with no statement of the time at risk, or confidence intervals that are narrower than the number of events allows.

  5. Harm to patients

    An infection-control unit that treats more catheter-days as "more infections" may change a practice that was working.

History

History of count models

  1. 1837

    Siméon-Denis Poisson

    Published a monograph on probabilities in which he derived the distribution now named after him, as a limit of the negative binomial distribution.

  2. 1898

    Ladislaus von Bortkiewicz

    Published data on deaths from horse kicks in corps of the Prussian army, each observed over 20 years, in his "law of small numbers". Armitage later noted that the near-Poisson overall distribution could hide considerable variation between corps.

  3. 1920

    Major Greenwood and G. Udny Yule

    Published "An inquiry into the nature of frequency distributions representative of multiple happenings with particular reference to the occurrence of multiple attacks of disease or of repeated accidents".

  4. 1972

    John Nelder and Robert Wedderburn

    Published "Generalized linear models", which fitted normal, binomial, Poisson (contingency tables) and gamma models by one method.

  5. 1989

    C. B. Dean and Jerald Lawless

    Published "Tests for detecting overdispersion in Poisson regression models" in the Journal of the American Statistical Association.

  6. 1992

    Diane Lambert

    Described zero-inflated Poisson regression for count data with excess zeros, with an application to soldering defects on printed wiring boards.

  7. 2004

    Guangyong Zou

    Proposed modified Poisson regression, with robust standard errors, to estimate relative risks directly in prospective studies with binary data.

Guidelines

Count models in reporting guidelines

STROBE (2007), item 12a

“Describe all statistical methods, including those used to control for confounding.”

STROBE (2007), item 16a

“Give unadjusted estimates and, if applicable, confounder-adjusted estimates and their precision (e.g., 95% confidence intervals). Make clear which confounders were adjusted for and why they were included.”

STROBE (2007), item 16c

“If relevant, consider translating estimates of relative risk into absolute risk for a meaningful time period.”

Reading a paper

Six checks on any count model

  • Is the time at risk (person-years, catheter-days, follow-up) stated, and was its logarithm used as an offset when it differed between units?
  • Are the event counts and rates given for each group, not only the rate ratio?
  • Was overdispersion checked, and was negative binomial regression, quasi-Poisson or robust standard errors used when it was present?
  • If there are many zeros, were they compared with the zeros the model predicts, and is there a clinical reason for any zero-inflated model?
  • Are the confidence intervals plausible for the number of events?
  • For a multi-way table, was the association checked within strata as well as in the pooled table?

Why is it called that?

Word surgery

“Rate”

In everyday speech

A speed, a price, or a percentage, as in "success rate".

In research

Events divided by the time at risk, such as 1.68 seizures per patient-month. A "success rate" that is a proportion is not a rate in this sense.

“Offset”

In everyday speech

Something that balances something else, as in "offset the cost".

In research

The logarithm of each unit's time at risk, added to a count model with its coefficient fixed at 1.

“Dispersion”

In everyday speech

Scattering, as in the dispersal of a crowd.

In research

The variance of a count relative to its mean. Overdispersion means the variance is larger than a Poisson distribution allows.

Memory trick

Counts need three questions: over how much time (offset), with how much variation (variance ÷ mean), and with how many zeros (observed against expected).

Poisson

named after Siméon-Denis Poisson, who described the distribution in 1837

The distribution of the number of events that occur independently at a constant rate, with variance equal to the mean.

Dispersion

Latin dispersio: "a scattering"

How widely counts are spread. Overdispersion: more spread than a Poisson distribution with the same mean.

Rate

Medieval Latin rata (pars): "fixed (amount)"

Events per unit of time at risk. The incidence rate ratio compares two rates.

Count

Latin computare: "to count, sum up, reckon together"

A number of events: 0, 1, 2 and so on, never negative.

Offset

"something set off against something else, a counterbalance", from 1769

The log of time at risk, which balances the count against how long each unit was observed.

Exam answers

Model answer outlines

Poisson distribution

MD Nuclear Medicine 2019, 2021, 2022, 2023 · MD Community Medicine 1992, 2016
  1. Definition: a discrete probability distribution of the number of events in a fixed interval of time or space, when events occur independently at a constant average rate. Named after S.-D. Poisson (1837).
  2. Formula: P(X = k) = e−μ μk ÷ k!, for k = 0, 1, 2, …, where μ is the mean number of events in the interval.
  3. Conditions: many opportunities, each with a small probability; independent events; constant rate; two events cannot occur at exactly the same instant.
  4. Properties: one parameter, μ. Mean = variance = μ, SD = √μ. Skewed to the right when μ is small, close to normal when μ is large. The binomial distribution approaches it when n is large and p small, with μ = np. The sum of independent Poisson counts is also Poisson.
  5. Worked example: μ = 2 events a year. P(0) = e−2 = 0.135. P(5 or more) = 0.053.
  6. Nuclear medicine: radioactive decay counts follow a Poisson distribution. The SD of N counts is √N, so relative uncertainty is 1 ÷ √N: 10% for 100 counts, 1% for 10,000. Longer acquisition or higher counts give more precise images and measurements.
  7. Community medicine: rare events in large populations: cases of a disease per year in a district, deaths per 1,000 person-years, confidence limits for a small number of cases, and comparison of incidence rates.
  8. Checking the fit: compare variance with mean. Variance > mean (overdispersion) suggests clustering or differences between individuals, which a negative binomial distribution allows for. Observed and expected frequencies can be compared by a χ² goodness-of-fit test.
  9. Poisson regression: models counts and rates with predictors, using ln(person-time) as an offset. eb is the incidence rate ratio. Check for overdispersion and excess zeros.
  10. Limitations: real counts often vary more than the Poisson model allows. Events that cluster (outbreaks, repeated seizures in the same patient) break the independence assumption.

The one thing to remember

Before modelling a count, divide it by the time at risk, and check whether its variance is larger than its mean.

All worked examples use made-up numbers for teaching. Models were fitted in Python 3 with statsmodels 0.14.5 and SciPy 1.15.3.

Sources: van Hasselt TJ et al. JAMA Netw Open 2025;8(9):e2530123 (doi:10.1001/jamanetworkopen.2025.30123, PMID 40900591). Buchardt AS et al. JAMA Netw Open 2026;9(8):e2629876 (doi:10.1001/jamanetworkopen.2026.29876, PMID 42616498). Seneta E. Poisson, Siméon-Denis. Encyclopedia of Biostatistics. 2005 (doi:10.1002/0470011815.b2a17119). Orton C. Archaeology International 2006;10 (doi:10.5334/ai.1005). Griffith DA, Haining R. Geographical Analysis 2006;38(2):123–39 (doi:10.1111/j.0016-7363.2006.00679.x). Pandit JJ. Anaesthesia 71(1):7–11, published online 23 November 2015 (doi:10.1111/anae.13261, PMID 26597473). Armitage P. Bortkiewicz, Ladislaus von. Encyclopedia of Biostatistics. 2005 (doi:10.1002/0470011815.b2a17016). Greenwood M, Yule GU. J R Stat Soc 1920;83(2):255 (doi:10.2307/2341080). Nelder JA, Wedderburn RWM. J R Stat Soc Series A 1972;135(3):370 (doi:10.2307/2344614). Dean C, Lawless JF. J Am Stat Assoc 1989;84(406):467–72 (doi:10.1080/01621459.1989.10478792). Lambert D. Technometrics 1992;34(1):1 (doi:10.2307/1269547). Zou G. Am J Epidemiol 2004;159(7):702–6 (PMID 15033648). von Elm E et al. STROBE statement. PLoS Med 2007;4(10):e296 (PMID 17941714), and Vandenbroucke JP et al. STROBE explanation and elaboration. PLoS Med 2007;4(10):e297 (PMID 17941715). IBM SPSS Statistics 27 Advanced Statistics and Core System manuals. CRAN reference manuals: stats (R documentation), MASS, pscl, performance, sandwich, lmtest, jmv. GAMLj and jamovi documentation.

Past papers

TNMGRMU questions on poisson and log-linear models

Questions from MD, MS, DM, MCh and Ph.D. papers that this chapter helps you answer. Tap a sitting to open the university's own question paper.

  1. ×6Poisson distributionMD Nuclear Medicine · May 2023MD Nuclear Medicine · May 2022MD Nuclear Medicine · Jul 2021MD Nuclear Medicine · May 2019MD Community Medicine · Apr 2016MD Community Medicine · Sep 1992