Exact McNemar's Test (small-sample binary paired)

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…

Exact binomial form of McNemar's paired-samples test for dichotomous outcomes.

Conditions on the discordant pair count b + c and tests whether b is drawn from Binomial(b + c, 0.5) under the null of no marginal change. Concordant pairs (both yes or both no) are uninformative and are conditioned out — power is driven entirely by b + c. Always valid; strictly preferred over the asymptotic χ² whenever b + c < 25 or when a defensible exact verdict is needed for regulatory / reviewer audiences. Reports the exact two-sided p plus the marginal-difference 95% CI.

Worked example

Did a paired binary outcome change, with few discordant pairs?

The exact McNemar test uses the exact binomial on discordant pairs — for when the χ² approximation is unsafe (small counts).

Result

Support shifted: 9 no→yes versus 2 yes→no, exact p = .033.

How you'd report it (APA)

An exact McNemar test showed a significant change (9 no→yes vs 2 yes→no), p = .033.

When to use it

  • Small paired binary study (b + c < 25)
    A pilot evaluation of a training programme asks 18 employees to attempt a safety task before and after the programme.
  • Diagnostic-test agreement (two tests on same patients)
    60 patients undergo both Test A and Test B for the same condition.

When NOT to — use instead

Hypotheses

H₀: the marginal proportions of the binary outcome are equal at the two measurements — p₁ = p₂, equivalently b/(b+c) = 0.5.
Hₐ: the marginal proportions differ — b/(b+c) ≠ 0.5.

Parameter tested: p₁ − p₂ (difference in marginal proportions) or equivalently b/(b+c) − 0.5

Assumptions (and what to do if they fail)

At least one discordant pair exists (b + c ≥ 1); otherwise the test is undefined.high

Check: Report b, c, and b + c.

If violated: All pairs are concordant (no change between measurements) — the test cannot detect a marginal shift.

Exact binomial is appropriate regardless of b + c; especially recommended when b + c < 25.medium

Check: Report b + c; compare to the 25 guideline.

If violated: If b + c is large (≥ 25), the exact binomial and the continuity-corrected χ² agree closely; the exact form remains valid but the asymptotic form is also defensible.

Ready to run a Exact McNemar's Test (small-sample binary paired) on your own data?

Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.

Run this test →