McNemar's Test Calculator
Test for significant differences in paired binary outcomes - before/after studies and matched pairs.
📖 What is McNemar's Test?
McNemar's test is a non-parametric statistical test designed for paired binary data. It tests whether the marginal proportions of a binary outcome are the same across two paired conditions - before and after a treatment, two diagnostic tests applied to the same patients, or two raters judging the same subjects. The test was introduced by Quinn McNemar in 1947 and is the standard method for paired categorical data in medical, psychological, and clinical research.
The key insight of McNemar's test is that only the discordant pairs carry information about change. Concordant pairs (both Yes or both No) tell us nothing about whether the conditions differ - they show no change. The discordant pairs in cell b (Yes in condition 1, No in condition 2) and cell c (No in condition 1, Yes in condition 2) are where all the evidence lies. If b = c, the marginal proportions are equal and there is no evidence of a systematic change. If b ≠ c substantially, the proportions differ significantly.
The test statistic is χ² = (b − c)²/(b + c), which follows a chi-square distribution with 1 degree of freedom under the null hypothesis of marginal homogeneity. For small discordant counts (b + c < 25), the Edwards continuity-corrected version χ²_cc = (|b − c| − 1)²/(b + c) is preferred. The odds ratio b/c gives the direction and magnitude of change: values above 1 indicate more subjects changed from Yes to No than from No to Yes.
McNemar's test is used extensively in clinical trials to compare before-and-after treatment responses, in diagnostic accuracy studies to compare two tests on the same patient, in ophthalmology to compare outcomes in paired eyes, and in education to compare pre-test and post-test pass rates on the same students.
📐 Formulas
Continuity-corrected version (Edwards, 1948): χ²_cc = (|b − c| − 1)² / (b + c)
p-value: P(χ²₁ ≥ χ²_observed) - upper tail of chi-square distribution with df = 1.
Odds ratio of discordant pairs: OR = b / c
Table notation:
a = condition 1 positive & condition 2 positive (concordant Yes)
b = condition 1 positive & condition 2 negative (discordant: Yes → No)
c = condition 1 negative & condition 2 positive (discordant: No → Yes)
d = condition 1 negative & condition 2 negative (concordant No)
Null hypothesis: b = c (marginal homogeneity - the probability of the outcome is the same in both conditions).