McNemar's Test (paired 2×2)

Verified

Categorical

Independently verified. Every statistic this test reports has been re-derived against an independent reference — never the library the pipeline itself calls — the rendered output was read back in a browser, and the result is locked with a committed regression suite.

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.

Result

Support rose — 22 switched no→yes versus 8 yes→no, χ²(1) = 5.63, p = .018 — a significant shift toward support.

How you'd report it (APA)

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 outcome
    Sibling 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

Hypotheses

H₀: P(Time 1 = yes, Time 2 = no) = P(Time 1 = no, Time 2 = yes) — the marginal proportions are equal (no net change between the two measurements)
Hₐ: The marginal proportions are NOT equal — the proportion classified as 'yes' differs between the two measurements

Parameter tested: difference in marginal proportions (or equivalently, ratio of discordant cells b:c)

Assumptions (and what to do if they fail)

Sufficient discordant pairs (b + c ≥ 25 for the asymptotic test)medium

Check: Read off b and c from the 2×2 table.

If violated: Few discordant pairs make the chi-square approximation unreliable.

Concordant pairs do not dominate the table to the point of zero discordant cellslow

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 →