McNemar Test Calculator
Enter the four cells of a 2×2 paired contingency table to compute McNemar's chi-squared statistic, p-value, and decide if marginal proportions differ.
2×2 Paired Contingency Table
| After: Yes | After: No | |
|---|---|---|
| Before: Yes |
a (Yes→Yes)
|
b (Yes→No)
|
| Before: No |
c (No→Yes)
|
d (No→No)
|
Table notation
aBoth measurements positive (concordant)
bPositive on Condition 1, negative on Condition 2 (discordant)
cNegative on Condition 1, positive on Condition 2 (discordant)
dBoth measurements negative (concordant)
Only cells b and c (the discordant pair) drive the test statistic.
Fill in the table and click Run Test to see results.
Chi-Square (χ²)
—
P-Value
—
Degrees of Freedom
1
Discordant Pair Summary
b (Cond 1 Yes → No)
—
c (Cond 1 No → Yes)
—
b + c (total discordant)
—
N (total subjects)
—
Marginal Proportions
Condition 1 positive rate
—
Condition 2 positive rate
—
Proportion difference (Cond 2 − Cond 1)
—
Formula applied
Summary
Enter the four cells of a 2×2 paired contingency table to compute McNemar's chi-squared statistic, p-value, and decide if marginal proportions differ.
How it works
- Label your two conditions (e.g., Before / After or Test A / Test B).
- Fill in the four cells: how many subjects went from Yes→Yes, Yes→No, No→Yes, and No→No.
- Choose a significance level (default 0.05) and whether to apply the continuity correction.
- Click "Run Test" — the tool reads the discordant cells b (Yes→No) and c (No→Yes).
- McNemar's statistic χ² = (|b − c| − correction)² / (b + c), with 1 degree of freedom.
- The p-value is read from the chi-squared distribution; the verdict tells you whether to reject the null hypothesis of equal marginals.
Use cases
- Compare pass/fail rates on the same exam before and after a training intervention.
- Test whether a medical treatment changes the proportion of positive diagnoses.
- Evaluate whether two diagnostic tests disagree asymmetrically on the same patients.
- Assess opinion change (agree/disagree) before and after an advertisement.
- Measure whether a software UI change shifts task success rates for the same users.
- Validate survey re-test consistency on binary yes/no questions.
Frequently Asked Questions
Last updated: 2026-06-11 ·
Reviewed by Nham Vu