The formulas
The default example is Agresti's presidential-approval data used in R's ?mcnemar.test: 1,600 people asked twice, 150 switched from approve to disapprove and 86 the other way. R gives χ² = 16.82, p < .001, and so does this calculator. The headline p uses the exact test when b + c < 25, otherwise the corrected chi-square.
McNemar vs chi-square vs Fisher
Use McNemar when the same units appear in both rows and columns. When the two groups are different people, use the chi-square test or, for small counts, Fisher's exact test. For paired continuous or ordinal data, the Wilcoxon signed-rank test is the counterpart.
Frequently asked questions
When do I use the McNemar test?
For a yes/no outcome measured twice on the same people (before and after, two raters, two diagnostic tests on one sample) or on matched pairs. It tests whether the proportion of “yes” changed. A chi-square test of independence would be wrong here because the observations are not independent.
Why does McNemar only use the discordant cells?
Pairs that answered the same both times (yes–yes, no–no) carry no information about change. The test compares the two kinds of switch, b (yes→no) and c (no→yes); under the null hypothesis each is equally likely.
Exact McNemar or chi-square?
If b + c is small (under about 25), use the exact binomial p-value. With more discordant pairs the continuity-corrected chi-square is a good approximation; it is what R’s mcnemar.test reports by default.
What is the McNemar odds ratio?
The paired (conditional) odds ratio b/c: how many times more often people switch one way than the other. Its exact confidence interval comes from the Clopper–Pearson interval for b/(b + c).
How do I report a McNemar test?
Give the paired proportions, then the statistic and p: “χ²(1, N = 1600) = 16.82, p < .001, OR = 1.74, 95% CI [1.33, 2.30]”, or for small samples “exact McNemar test, p = .039”.
What is the difference between McNemar and Cochran’s Q?
Cochran’s Q extends McNemar to three or more related yes/no measurements, just as repeated-measures ANOVA extends the paired t-test.