Rates over exposure: the Poisson rate ratio
H₀: RR = 1 · H₁: RR ≠ 1
z = -8.0536 · p = 8.04E-16
p = 8.04E-16 ≤ α = 0.05: reject H₀. Group 1's rate is 0.7891 times group 2's, further from 1 than chance alone would easily take it; the interval, [0.7448, 0.836], gives the range of ratios that fit the data.
How to read the picture
For the score and Wald tests the curve is the null world of z; for the exact test the bars are the binomial distribution of group 1's share of all the events.
The vertical line is your result; the shaded area or the highlighted bars are the p-value.
Below, the rate ratio with its interval, against 1 (no difference) and the null ratio you set.
Your data
Method
Alternative hypothesis
Significance level α
When events are counted over time in service, the fair comparison is the rate: events per unit of exposure. Meridian's telematics policies had 2,062 claims in 23,672 vehicle-years; the standard ones 2,601 in 23,561. The rate ratio compares the two, and the test asks whether it differs from 1, or from any ratio you set, such as 0.9 for 'at least a 10 % reduction'.
The estimate and what the data show
The worked steps
The two rates
y₁ / T₁ = 2062 / 23671.791 = 0.08711 · y₂ / T₂ = 2601 / 23560.917 = 0.1104The rate ratio
RR = 0.08711 / 0.1104 = 0.7891The count ratio H₀ expects
r = RR₀ × T₁ / T₂ = 1 × 23671.791 / 23560.917 = 1.0047The score statistic
z = (y₁ − r y₂) / √((y₁ + y₂) r) = (2062 − 1.0047 × 2601) / √(4663 × 1.0047) = -8.0536The p-value
p = 2 × P(Z ≥ |-8.0536|) = 8.04E-16Critical value at α
α = 0.05: z* = ±1.96Score interval for the rate ratio
95 %: [0.7448, 0.836]
The same in code
- statsmodels
from statsmodels.stats.rates import test_poisson_2indep, confint_poisson_2indep test_poisson_2indep(2062, 23671.791, 2601, 23560.917, value=1, method='score', compare='ratio', alternative='two-sided') confint_poisson_2indep(2062, 23671.791, 2601, 23560.917, method='score', compare='ratio', alpha=0.05)- scipy: the exact conditional test
from scipy import stats stats.binomtest(2062, 4663, p=0.5012, alternative='two-sided')- Excel
B1: =(2062-1.0047*2601)/SQRT((2062+2601)*1.0047) B2: =2*(1-NORM.S.DIST(ABS(B1), TRUE))
Formulas
r is the ratio of the counts H₀ expects, given the exposures; the score test measures how far y₁ lies from r y₂.
Try this
Exposure matters
Open Meridian H1 and halve the standard group's exposure (to 11,780 vehicle-years) without changing its claims.
Look for: The same 2,601 claims over half the exposure is twice the rate: the ratio falls to about 0.39. Counts alone say nothing until they are divided by exposure.
Score, Wald and exact
Open the small plant and switch between the three methods.
Look for: With 25 events in all the three intervals differ visibly; with Meridian's thousands they agree to two decimals. Use the exact test when events are few.
A threshold, not zero
Open 'At least a 10 % reduction?' and move the null ratio from 0.9 down to 0.84.
Look for: The one-sided test keeps rejecting while the null ratio stays above the one-sided interval's upper end, about 0.83. The interval tells you every threshold the data can clear.