Home › Statistics & Probability Calculators › McNemar Test Calculator with Steps
McNemar's Test Calculator
McNemar’s test compares two proportions measured on the same people, such as the share who pass before and after a course, or two diagnostic tests applied to the same patients. Enter the four cells of the paired table and the calculator tests whether the proportion answering yes changed.
Only the discordant pairs matter: b people changed from yes to no and c changed from no to yes. If there is no real change, b and c should be about equal. The statistic is χ² = (|b − c| − 1)² ÷ (b + c) with Edwards’ continuity correction, or (b − c)² ÷ (b + c) without it, compared with a chi-square distribution with 1 degree of freedom.
When b + c is small (under about 25), the exact version is more reliable: it treats the smaller of b and c as a binomial count with p = 0.5. Both p-values are shown. Do not use the two-proportion z-test or a chi-square test of independence for paired data; they assume independent groups.
Result and step-by-step solution
Exact binomial p = 0.0414 (use this when b + c is below about 25).
- Discordant pairsOnly pairs that changed carry information: b = 15 (yes → no), c = 5 (no → yes), b + c = 20
- Test statisticχ² = (|b − c| − 1)² ÷ (b + c) = (|15 − 5| − 1)² ÷ 20 = 4.05, df = 1
- p-valueP(χ²₁ ≥ 4.05) = 0.0442
- Exact version2 × P(X ≤ 5) for X ~ Binomial(20, 0.5) = 0.0414
- Decisionp = 0.0442 < α = 0.05.
| Proportion yes, first measurement | 0.6 |
|---|---|
| Proportion yes, second measurement | 0.5 |
Frequently asked questions
- When do I use McNemar's test?
- When the same subjects are measured twice on a yes/no outcome (before and after), or when pairs are matched, and you want to know if the proportion changed.
- Why are the a and d cells ignored?
- People who answered the same way both times carry no information about change. The test uses only those who switched (b and c).
- Should I use the continuity correction?
- Many textbooks and SPSS use it; R’s mcnemar.test uses it by default. With small b + c, prefer the exact binomial p-value.
- What are the degrees of freedom?
- 1, because the test compares two discordant counts.
Last reviewed: October 7, 2026. Calculations run in your browser and were validated against SciPy.
