EProportions · Guide test 068
Bowker symmetry test
Tests equality of opposite off diagonal cell probabilities in a square contingency table.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Symmetry and marginal homogeneity (Stuart–Maxwell, Bhapkar, Bowker) — Did the distribution of a categorical rating change between two paired measurements?
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 · Bowker symmetry test
Your data
Edit the counts| Rater 2: low | mid | high | Total | |
|---|---|---|---|---|
| Rater 1: low | 27E = 11.2 | 8E = 15.0 | 6E = 14.8 | 41 |
| Rater 1: mid | 11E = 16.4 | 35E = 22.0 | 14E = 21.6 | 60 |
| Rater 1: high | 3E = 13.4 | 12E = 18.0 | 34E = 17.6 | 49 |
| Total | 41 | 55 | 54 | 150 |
E is the count expected if rows and columns were unrelated.
If H₀ were true
- The reference: how χ² varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .653).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- count rated i by rater 1 and j by rater 2
The verdict
χ²(3) = 1.63, p = .653
p > α = .050: compatible with H₀
Symmetry is stronger than marginal homogeneity: every pair of off-diagonal cells must balance.
- Statistic
- 1.628
- p-value
- 0.6532
Bowker symmetry test on a 3 × 3 table of 150 counts: χ²(3) = 1.63, p = .653. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: the paired category table is symmetric: pij=pji for every i<j.
Assumptions
Independent pairs, same categories on both margins, adequate off-diagonal pair totals.
Formula
Parameters and notation
Sum over estimable off-diagonal pairs; usual df=k(k−1)/2 when all pairs contribute.
Structure of the method
Split the off-diagonal square table into unordered category pairs. Each pair compares the two directions of transition, and their standardized squared differences are summed. This directly targets full paired-table symmetry, which imposes more restrictions than equality of the two margins.
Estimated and nuisance parameters
The off-diagonal totals n_ij+n_ji estimate the amount of information in each symmetry contrast. Conditional on a positive total, the null allocates transitions equally between directions. Diagonal counts contribute no symmetry contrast, and zero off-diagonal totals supply no estimable direction.
Settings and design choices
Specify the active categories, treatment of zero-total pairs, asymptotic versus conditional calibration, and any multiplicity-adjusted follow-up contrasts. For k greater than two, the usual statistic has no McNemar continuity correction; software may still present a generic McNemar method label.
Fitting and adaptation
Rebuild directional counts for each new paired sample. Under the symmetry null, a conditional simulation can split each observed off-diagonal pair total using probability one half, then recompute the summed statistic. This preserves the relevant conditioning; no neural adaptation stage exists.
Sensitivity and robustness
Sparse pair totals weaken the omnibus chi-square approximation even when total N is large. The effective number of contributing contrasts needs careful handling when transitions are absent. Symmetry rejection does not specify which marginal distribution changed, and marginal homogeneity can hold despite rejection.
How to use and calibrate
Use the chi square reference, or an exact conditional symmetry procedure for sparse tables.
Example application
Check whether transitions between categories are equally frequent in both directions.
Interpretation and pitfalls
Watch out
Symmetry implies marginal homogeneity but the reverse need not hold. Do not label this an interchangeable Stuart–Maxwell test.
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
Square table of paired categorical observations. Marginal homogeneity and full symmetry are different null hypotheses.
Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: base R
# 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 <- matrix(c(20,5,3,7,25,4,2,6,22),3,byrow=TRUE)
print(mcnemar.test(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()
Validated — Executed successfully in the validation environment · needs Base/standard library
tab <- matrix(c(20,5,3,7,25,4,2,6,22),3,byrow=TRUE)
print(mcnemar.test(tab))
Output
McNemar's Chi-squared test data: tab McNemar's chi-squared = 0.93333, df = 3, p-value = 0.8174
Sources
- R stats — R stats · mcnemar.teststat.ethz.ch
- mcnemar.teststat.ethz.ch
- Statistics guide v4 (historical):
- Python: Executed end to end through Rscript · R: Executed successfully in the validation 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 068, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT068.