McNemar's Test (paired 2×2)
VerifiedCategorical
Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.
Loading teaching datasets…
Or use your own dataset
Loading your datasets…
Tests whether there is a significant change in a dichotomous variable between two related (paired) measurements.
Counts the discordant pairs (b: yes→no, c: no→yes) and asks whether b ≠ c via χ² = (b − c)² / (b + c) with df = 1, OR via exact binomial on min(b,c) when b + c < 25. Reports the χ² statistic with continuity correction, p, the marginal-difference 95% CI, and the odds ratio of changing-yes-to-no vs no-to-yes. Concordant pairs are uninformative and conditioned out; power is driven entirely by b + c.
Worked example
Did a campaign change the same voters' yes/no support?
100 voters' support (yes/no) was recorded before and after a campaign; McNemar's test looks only at the voters who switched.
Support rose — 22 switched no→yes versus 8 yes→no, χ²(1) = 5.63, p = .018 — a significant shift toward support.
McNemar's test showed a significant change in support after the campaign (22 no→yes vs 8 yes→no), χ²(1) = 5.63, p = .018.
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- Pre-test / Post-test (categorical outcome)100 voters' support for a policy is measured before and after a campaign.
- Matched pairs with binary outcomeSibling pairs where one received an intervention and one didn't; outcome is whether each child reached a developmental milestone (yes/no).
When NOT to — use instead
- Independent groups (different subjects per arm)McNemar requires PAIRING. → Two-Proportions Z-Test
- Multi-category paired outcome (k > 2)McNemar is restricted to 2×2. → Stuart-Maxwell / Bowker (paired k-category)
- Three or more related binary measurementsCochran's Q extends McNemar to ≥ 3 related binary outcomes. → Cochran's Q Test (repeated binary)
- Small discordant count (b + c < 25)Asymptotic χ² is unreliable. → Exact McNemar's Test (small-sample binary paired)
Hypotheses
Parameter tested: difference in marginal proportions (or equivalently, ratio of discordant cells b:c)
Assumptions (and what to do if they fail)
Check: Read off b and c from the 2×2 table.
If violated: Few discordant pairs make the chi-square approximation unreliable.
Check: Verify b > 0 OR c > 0 in the 2×2 table.
If violated: If b = c = 0, no test is meaningful.
Ready to run a McNemar's Test (paired 2×2) on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →