McNemar Calculator

Testing Change in Paired Categorical Data

McNemar's test answers a specific before/after question for binary outcomes: among subjects whose classification changed between two measurements, did it change more often in one direction than the other? It's built for paired nominal data laid out in a 2×2 table — the same subjects measured twice — and it deliberately ignores subjects whose classification stayed the same, focusing entirely on the discordant pairs.

The Formula

The test uses a continuity-corrected version when discordant pairs are few, switching to the uncorrected form for larger counts:

With continuity correction (b + c < 25):
χ² = (|b − c| − 1)² / (b + c)

Without correction (b + c ≥ 25):
χ² = (b − c)² / (b + c)

df = 1

Here b and c are the two discordant cells — subjects who changed from one category to the other, in each direction.

Worked Example

Suppose 15 subjects changed from "No" to "Yes" (b = 15) and 5 changed from "Yes" to "No" (c = 5) after an intervention:

McNemar's test result, b = 15, c = 5
QuantityValue
b + c20 (continuity correction applied)
χ²4.05
df1
p-value0.0442

Computed directly from the calculator's continuity-corrected formula.

At p = 0.044, the shift is statistically significant at the conventional 0.05 level — the change from "No" to "Yes" outpaced the reverse by more than chance would predict.

Where This Calculation Matters

  • Pre/post treatment studies — testing whether a treatment shifts subjects from a negative to positive diagnosis (or vice versa) more than chance alone would explain.
  • Matched-pairs survey research — comparing the same respondents' yes/no answers before and after an event, campaign, or intervention.
  • Diagnostic test agreement — checking whether two diagnostic methods applied to the same subjects disagree more in one direction than the other.

How to Use This Calculator

  1. Enter the count for discordant pair b (e.g., Yes before, No after).
  2. Enter the count for discordant pair c (e.g., No before, Yes after).
  3. Select Calculate to get the chi-square statistic and p-value.

Related Calculations

For unpaired categorical comparisons, use the Chi-Square Calculator. For paired continuous measurements, see the Paired T-Test Calculator.