Skip to content

EProportions · Guide test 070

Breslow–Day test

Tests whether odds ratios are equal across strata of two by two tables.

Runs in CodeSplashPython (calls R) example not runR example not run

Do it in CodeSplash

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

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 · Breslow–Day test

60
0.60
0.80
0.050

Your data

Edit the counts
EventNo eventTotal
Stratum 1: exposed
16E = 29.0
44E = 31.0
60
Stratum 1: unexposed
13E = 29.0
47E = 31.0
60
Stratum 2: exposed
37E = 29.0
23E = 31.0
60
Stratum 2: unexposed
23E = 29.0
37E = 31.0
60
Stratum 3: exposed
54E = 29.0
6E = 31.0
60
Stratum 3: unexposed
31E = 29.0
29E = 31.0
60
Total174186360

E is the count expected if rows and columns were unrelated.

If H₀ were true

χ² = 8.31
  1. The reference: how χ² varies across samples when H₀ is true.
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .016).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

χBD2=∑k(ak−a^k(ψ^MH))2Var(a^k)\chi^2_{BD} = \sum_k\dfrac{\left(a_k-\hat a_k(\hat\psi_{MH})\right)^2}{\mathrm{Var}(\hat a_k)}

With your numbers

χBD2=8.31,ν=2\chi^2_{BD} = 8.31,\quad \nu = 2
ψ^MH\hat\psi_{MH}
Mantel–Haenszel common odds ratio
a^k\hat a_k
expected exposed events if every stratum had that odds ratio

The verdict

χ²(2) = 8.31, p = .016

p ≤ α = .050: reject H₀

If it rejects, the common odds ratio is a misleading summary: report stratum-specific odds ratios (effect modification).

Statistic
8.314
p-value
0.0157
Breslow–Day test on a 6 × 2 table of 360 counts: χ²(2) = 8.31, p = .016. The p-value is below α = .050, so the data are hard to reconcile with H0.

Breslow–Day test on a 6 × 2 table of 360 counts: χ²(2) = 8.31, p = .016. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: all stratum-specific 2×2 odds ratios share one value.

Assumptions

Independent stratified tables; sufficiently large counts for conditional approximations.

Formula

Q=∑s[as−Eθ^(as)]2Vθ^(as)Q=\sum_s\frac{[a_s-E_{\widehat\theta}(a_s)]^2}{V_{\widehat\theta}(a_s)}

Parameters and notation

θ̂ estimates the common odds ratio. Expected cells solve the fixed margin table equation with that odds ratio; variances are conditional approximations.

Structure of the method

Fit a common odds ratio across independent 2-by-2 strata, obtain expected first cells under that value and fixed margins, and aggregate squared observed-minus-expected deviations using approximate conditional variances. Tarone adjustment removes a residual component attributable to estimating the common parameter.

Estimated and nuisance parameters

The shared odds ratio is an estimated nuisance under the homogeneity null; stratum margins remain fixed for the conditional construction. Expected cells and their variances depend nonlinearly on the fitted odds ratio. Alternative parameters are stratum-specific odds ratios.

Settings and design choices

Choose the common-odds-ratio estimator and whether Tarone correction is applied, and report the choice explicitly. The usual reference uses one fewer degree of freedom than the number of informative strata. Zero-cell handling should follow the specified implementation rather than arbitrary added constants.

Fitting and adaptation

Refit the common effect for each new dataset and for every parametric null replicate. A calibration study simulates tables under a common odds ratio with the relevant margins, then repeats the full fit and heterogeneity statistic. There is no neural fine-tuning analogue.

Sensitivity and robustness

Small stratum counts, extreme common odds ratios, and sparse discordant cells can invalidate approximations. A nonsignificant result may simply reflect low power to detect interaction. Compare estimated stratum effects and intervals; it is not evidence that all populations have identical scientific effects.

How to use and calibrate

Compare with χ²S−1 for S strata; the Tarone adjustment removes a residual common-parameter component. State whether used.

Example application

Check whether treatment odds ratios vary across centers before presenting a common effect.

Interpretation and pitfalls

Watch out

Low power does not establish homogeneity. Zero cells and small strata can undermine the approximation.

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.

Python and R

Three independent 2×2 strata; maintain the same category ordering in every stratum. Homogeneity tests assess whether a common odds ratio is tenable.

Python · invokes R

Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: DescTools

# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
    raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
tab <- array(c(18,9,12,21,15,7,15,23,20,12,10,18),dim=c(2,2,3))
print(DescTools::BreslowDayTest(tab))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
                        text=True, capture_output=True)
print(result.stdout)
if result.stderr:
    print(result.stderr)
result.check_returncode()
R

Not run — Syntax checked; runtime not verified in the final environment · needs DescTools

tab <- array(c(18,9,12,21,15,7,15,23,20,12,10,18),dim=c(2,2,3))
print(DescTools::BreslowDayTest(tab))

Sources

Statistics guide v4 (historical):
Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.

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