Skip to content

EProportions · Guide test 076

Poisson E test

An unconditional test comparing two Poisson rates while allowing different exposure amounts.

Runs in CodeSplashPython example validatedR example validated Corrected in edition 2

Do it in CodeSplash

In the app, set it up in Analyze with this method:

In Poisson rates (one rate or two rates compared), choose Test (two rates) = E-test (rate difference).

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Poisson E test

800
1000
2.5
1.5
0.050

Alternative

Your data

Edit the counts
Group 120 of 800 · 0.025
Group 213 of 1000 · 0.013

If H₀ were true

T = 1.80
  1. The reference: how T varies across samples when H₀ is true, T over every pair of counts at the pooled rate (unconditional: Poisson probabilities at the pooled rate).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .072).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

T=x1/t1−x2/t2x1/t12+x2/t22,p=∑(k1,k2): ∣T∣≥∣Tobs∣Pois(k1; t1λ^) Pois(k2; t2λ^)T=\dfrac{x_1/t_1-x_2/t_2}{\sqrt{x_1/t_1^2+x_2/t_2^2}},\quad p=\sum_{(k_1,k_2):\,|T|\ge|T_{obs}|}\mathrm{Pois}(k_1;\,t_1\hat\lambda)\,\mathrm{Pois}(k_2;\,t_2\hat\lambda)

With your numbers

T=1.80,λ^=0.02T = 1.80,\qquad \hat\lambda = 0.02
λ^\hat\lambda
pooled rate (x₁ + x₂)/(t₁ + t₂) under H₀
t1, t2t_1,\ t_2
exposures

The verdict

T = 1.80, p = .072, RR = 1.92

p > α = .050: compatible with H₀

Effect size: rate ratio RR = 1.923

An unconditional test: the statistic's distribution is computed exactly at the pooled rate. Usually more powerful than the conditional (binomial) test.

Statistic
1.804
p-value
0.0719
Poisson E test on 20/800 vs 13/1000: T = 1.80, p = .072, RR = 1.92. The p-value is above α = .050, so the data are compatible with H0.

Poisson E test on 20/800 vs 13/1000: T = 1.80, p = .072, RR = 1.92. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0: λ1−λ2=δ0.

Assumptions

Independent Poisson counts with fixed known exposures; a fitted null rate is used for the unconditional enumeration.

Formula

T=X1/t1−X2/t2−δ0X1/t12+X2/t22pE=∑(a,b)∈EPλ^10(a)Pλ^20(b)\begin{gathered}T=\frac{X_1/t_1-X_2/t_2-\delta_0}{\sqrt{X_1/t_1^2+X_2/t_2^2}}\\[5pt] p_E=\sum_{(a,b)\in\mathcal E}P_{\widehat\lambda_{10}}(a)P_{\widehat\lambda_{20}}(b)\end{gathered}

Parameters and notation

Null constrained estimates satisfy λ̂10−λ̂20=δ0; for δ0=0 both equal (x1+x2)/(t1+t2). E is the statistic-defined tail.

Structure of the method

Estimate event rates under the stated null difference, enumerate a sufficiently large grid of two Poisson counts, and sum their fitted-null joint probabilities for outcomes at least as extreme under the standardized statistic. This is plug-in unconditional enumeration, not a supremum over every nuisance rate.

Estimated and nuisance parameters

Under an equal-rate null, estimate the common rate by pooled events divided by pooled exposure. For a nonzero difference, obtain the constrained rate estimates with the implementation-specific parameterization. Each Poisson count has mean exposure times its rate; rates alone are not count means.

Settings and design choices

Choose null difference, alternative, ordering statistic, zero-count statistic convention, and numerical truncation tolerance. The custom R example implements delta=0 only. A nonzero difference requires revising both the statistic and constrained rate fit, not merely subtracting delta from the observed contrast.

Fitting and adaptation

Refit null rates after each dataset change and each simulation replicate used to examine calibration. Increase the count-grid cutoff until tail omission is negligible relative to the reported p-value. Fine-tuning does not apply, and truncation precision is a numerical control rather than a significance level.

Sensitivity and robustness

Sparse counts make normal intuition unreliable even though enumeration is used. Plugging in nuisance estimates does not supply the same uniform finite-sample guarantee as nuisance maximization. Zero-event denominators and highly unequal exposures need explicit checks; overdispersion invalidates the fitted Poisson probabilities.

How to use and calibrate

Enumerate joint Poisson outcomes using null fitted rates and a controlled numerical truncation; use the documented E-test implementation.

Example application

Compare two sparse event rates without conditioning on the total count.

Interpretation and pitfalls

Watch out

Plug-in unconditional enumeration is not the same as a nuisance-parameter supremum exact test. Zero-event denominators need implementation handling.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
  • Rewritten in the review: formula.
  • Formuladocs.scipy.org

    The fitted quantities are rates; the Poisson probability masses must use exposure multiplied by rate as their count means. This makes the original abbreviated probability notation explicit and consistent with both examples.

    Corrected text

    \begin{gathered}T=\frac{X_1/t_1-X_2/t_2-\delta_0}{\sqrt{X_1/t_1^2+X_2/t_2^2}}\[5pt] p_E=\sum_{(a,b)\in\mathcal E}\operatorname{Pois}(a;t_1\widehat\lambda_{10})\operatorname{Pois}(b;t_2\widehat\lambda_{20})\end{gathered}

Python and R

Estimated-null-rate unconditional E-test, not the conditional exact test; the R probability grid truncates negligible tails.

Python · native

Validated — Executed successfully in the validation environment · needs numpy, scipy

import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
print(stats.poisson_means_test(12,100,7,90))
Output
SignificanceResult(statistic=np.float64(0.929320377284585), pvalue=np.float64(0.362290579748186))
R

Validated — Executed successfully in the validation environment · needs Base/standard library

# Unconditional E-test: sum joint Poisson probabilities for outcomes at least as extreme.
x1<-12;x2<-7;t1<-100;t2<-90; rate<-(x1+x2)/(t1+t2)
zfun<-function(a,b) ifelse(a+b==0,0,(a/t1-b/t2)/sqrt(a/t1^2+b/t2^2))
g<-expand.grid(a=0:qpois(1-1e-12,rate*t1),b=0:qpois(1-1e-12,rate*t2))
z<-zfun(x1,x2); p<-sum(dpois(g$a,rate*t1)*dpois(g$b,rate*t2)*(abs(zfun(g$a,g$b))>=abs(z)-1e-12))
print(c(z=z,p=p))
Output
        z         p 
0.9293204 0.3622906

Sources

Statistics guide v4 (historical):
R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 076, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT076.