Perform McNemar's test for paired binary data. Compute chi-square statistic, exact binomial p-value, odds ratio, and compare correction methods on matched pairs.
McNemar's test is designed for paired binary data — situations where the same subjects are measured under two conditions (before/after, test A/test B) with a yes/no outcome. Unlike the chi-square test of independence, which assumes independent observations, McNemar's test properly accounts for the paired structure of the data.
This calculator takes a paired 2×2 contingency table and computes the McNemar statistic with optional continuity corrections (Yates' or Edwards'), the exact binomial p-value, and marginal proportion differences. It also compares results across all correction methods in a single summary table.
Common applications include evaluating treatment effects in before-after studies, comparing diagnostic test accuracy, assessing attitude changes in matched surveys, and testing agreement patterns in reliability studies. Check the example with realistic values before reporting. Use the steps shown to verify rounding and units. Cross-check this output using a known reference case. Use the example pattern when troubleshooting unexpected results. Validate that outputs match your chosen standards.
When your data consists of matched pairs with binary outcomes, an ordinary chi-square test is inappropriate because it ignores the pairing structure. McNemar's test focuses only on the discordant pairs — the cases where the two conditions disagree — providing a valid test of whether the marginal proportions differ. This calculator handles all the math and lets you compare correction methods side by side.
McNemar's Test (no correction): χ² = (b − c)² / (b + c) With Yates' correction: χ² = (|b − c| − 1)² / (b + c) Exact Binomial Test: Under H₀, b ~ Binomial(b + c, 0.5) p-value = 2 × P(X ≤ min(b, c)) Where: a = concordant +/+ pairs b = discordant +/− pairs c = discordant −/+ pairs d = concordant −/− pairs
Result: χ² = 4.05 (Yates'), p = 0.0442
With 5 discordant +/− pairs and 15 discordant −/+ pairs, McNemar's test with Yates' correction gives χ² = 4.05 (1 df), p = 0.044. This is significant at α = 0.05, indicating the marginal proportions differ — more subjects changed from negative to positive than the reverse.
In McNemar's setup, each subject contributes to exactly one cell. Cell a contains subjects who were positive on both occasions, d those negative on both, b those who changed from positive to negative, and c those who changed from negative to positive. The test asks whether b and c differ more than expected by chance alone.
The uncorrected McNemar statistic can give slightly liberal p-values with small discordant counts. Yates' correction subtracts 1 from |b − c| to better approximate the discrete binomial distribution with a continuous chi-square. Edwards' correction subtracts 0.5 instead. For very small discordant counts (under 10), the exact binomial test is recommended regardless.
McNemar's test is ubiquitous in diagnostic accuracy studies. When comparing two diagnostic tests applied to the same patients, it determines whether the tests have different sensitivity or specificity. In clinical trials with crossover designs, it tests treatment effects on binary endpoints. In epidemiology, it's used for matched case-control studies.
It tests whether the marginal row and column proportions in a paired 2×2 table are equal. Common uses: before/after studies, comparing two diagnostic tests on the same patients, and assessing attitude changes in panel surveys.
Concordant pairs (both positive or both negative) don't help distinguish between the two conditions. Only subjects who changed (discordant pairs) provide information about whether the conditions differ.
When the number of discordant pairs (b + c) is small — typically under 25. The chi-square approximation is reliable for larger samples. The exact test is always valid but loses power interpretation with very small samples.
It subtracts 1 from |b − c| before squaring, making the chi-square approximation more accurate for small samples by reducing the statistic slightly. This makes the test conservative.
McNemar's test is for binary (yes/no) outcomes, while the paired t-test is for continuous data. Both handle paired observations, but McNemar's uses a chi-square framework for categorical data.
Yes, Cochran's Q test generalizes McNemar's test to three or more related groups with binary outcomes. For ordered categories, the Stuart-Maxwell test or Bhapkar's test may be appropriate.