How this instrument works
McNemar's test is built for paired nominal data — the same subjects measured on a yes/no (or any two-category) outcome twice, such as before and after some intervention, or two matched raters judging the same items. Arranged in a 2×2 table, two of the four cells hold the concordant pairs (subjects who gave the same answer both times, in either direction) and two hold the discordant pairs (subjects who switched from one category to the other). McNemar's test deliberately ignores the concordant cells entirely — they carry no information about whether switching happens more in one direction than the other — and works from only the two discordant counts, conventionally labeled B and C.
The test statistic is chi² = (B − C)² / (B + C), which is large when the switching is lopsided (many more people switched one way than the other) and small or zero when switching was roughly balanced in both directions. A widely used refinement, Edwards' continuity correction, adjusts the statistic slightly to better approximate the discrete nature of count data: chi²(corrected) = (|B − C| − 1)² / (B + C). Both versions are reported here, since different fields and textbooks default to different conventions.
This calculator takes only B and C as inputs, not the full 2×2 table with its concordant cells, because those two counts are the entire calculation — the concordant cells genuinely don't enter the formula at all, which is the whole point of the test's design. If you have the full before/after table, you only need to identify which two cells are the discordant ones and enter those two counts here.
- Identify the two discordant-pair counts from your paired before/after (or matched-pairs) table.
- Enter the 'yes then no' switch count into Discordant pairs — B (yes then no).
- Enter the 'no then yes' switch count into Discordant pairs — C (no then yes).
- Read McNemar's chi-square statistic for the standard (uncorrected) result.
- Read Continuity-corrected chi-square for the Edwards-corrected version, often preferred for smaller discordant counts.
Worked example — a rebrand preference survey
A company surveys the same 100 customers before and after unveiling a redesigned logo, asking whether they prefer the old logo or the new one. Most customers didn't change their answer, but among those who did: 15 switched from preferring the old logo to preferring the new one, and 5 switched from preferring the new one back to the old one. Enter 15 into Discordant pairs — B and 5 into Discordant pairs — C.
McNemar's chi-square statistic reads (15−5)²/(15+5) = 100/20 = 5.0 exactly. Continuity-corrected chi-square reads (|10|−1)²/20 = 81/20 = 4.05. Both figures point the same direction: the switching is lopsided, with three times as many customers moving toward the new logo as moving away from it, evidence that the redesign shifted preference rather than customers just randomly changing their minds in both directions equally.
Questions
Why does McNemar's test ignore the concordant pairs entirely?
Because subjects who answered the same way both times provide no evidence about whether opinions are shifting in one direction more than the other — they simply didn't change, in either direction. Only the subjects who did switch (the discordant pairs) carry information about whether switching is balanced or lopsided, which is exactly what McNemar's test is designed to detect, so the concordant counts drop out of the formula by design, not by oversight.
When should I use the continuity-corrected version instead of the standard one?
The continuity correction (Edwards' correction) is a widely used adjustment intended to improve the chi-square approximation's accuracy when the discordant counts (B and C) are relatively small, since chi-square is technically a continuous approximation to what's actually discrete count data. Different fields and textbooks default to different conventions — some always apply it, some reserve it for smaller counts, some skip it entirely — so this calculator reports both figures and leaves the choice to match whatever convention your context expects.
What does it mean if B and C come out roughly equal?
It means switching happened about equally often in both directions, which pushes the chi-square statistic toward zero, its minimum possible value. In the survey example, B = C = 20 would mean exactly as many customers switched toward the new logo as switched away from it — a chi-square of 0 exactly, suggesting no net shift in overall preference even though plenty of individual customers did change their minds.
How is McNemar's test different from a standard chi-square test of independence?
A standard chi-square test of independence compares two separate, independent groups (unrelated subjects) across categories. McNemar's test is specifically for paired data — the very same subjects measured twice, or genuinely matched pairs — where the two measurements aren't independent of each other, since they come from the same person or matched unit. Using an ordinary chi-square test on paired data instead of McNemar's test ignores that pairing and can produce misleading results.
What counts as a valid input for B and C?
Both must be non-negative whole numbers (counts of pairs), and at least one of the two must be greater than zero — with both B and C at zero, there were no discordant pairs at all to analyze, and the test statistic would require dividing by zero. Beyond that minimum, there's no upper limit; McNemar's test scales to any size of paired data set.