mcnemar test calculator

McNemar Test Calculator (Paired 2×2 Data)

Enter counts from a paired binary outcome table (before/after, test A/test B, rater 1/rater 2). This tool reports the asymptotic McNemar p-value, continuity-corrected p-value, and exact binomial p-value.

After / Method B
Positive (Yes) Negative (No)
Before / Method A: Positive (Yes)
Before / Method A: Negative (No)
Formulas used:
McNemar χ² (uncorrected): (b − c)² / (b + c)
McNemar χ² (continuity corrected): (max(|b − c| − 1, 0))² / (b + c)
Exact two-sided p-value: 2 × P(X ≤ min(b, c)), where X ~ Binomial(n = b + c, p = 0.5)

What is the McNemar test?

The McNemar test is used for paired nominal data with two categories (usually yes/no, positive/negative, success/failure). It is designed for situations where the same subjects are measured twice or where two diagnostic methods are compared on the same subjects.

Unlike a regular chi-square test of independence, McNemar focuses only on the discordant pairs—the cases that changed from one category to the other.

When should you use this calculator?

  • Before vs after intervention outcomes on the same people.
  • Comparing two raters scoring the same subjects into binary categories.
  • Comparing two diagnostic tests run on the same sample of patients.
  • Any matched-pair 2×2 table where observations are not independent across rows.

Understanding the 2×2 table

Cell meanings

  • a: Yes at time/test A and Yes at time/test B.
  • b: Yes at A, No at B (discordant).
  • c: No at A, Yes at B (discordant).
  • d: No at A and No at B.

Only b and c drive the McNemar statistic. Large imbalance between b and c suggests a systematic change between paired measurements.

Which p-value should you report?

Asymptotic (chi-square) McNemar

This is common for larger samples. It is quick and usually fine when the number of discordant pairs (b + c) is reasonably large.

Continuity-corrected version

This is more conservative and can reduce false positives for moderate sample sizes.

Exact binomial McNemar

Recommended when discordant counts are small (often b + c < 25). It does not rely on the chi-square approximation and is typically preferred for small samples.

Interpretation tips

  • If p-value < alpha: evidence of a difference in paired proportions.
  • If p-value ≥ alpha: not enough evidence to claim a change.
  • Statistical significance does not automatically imply clinical or practical significance.

Assumptions and limitations

  • Data are paired/matched.
  • Outcome is dichotomous.
  • Pairs are independent of other pairs.
  • McNemar does not quantify effect size by itself; add confidence intervals or paired odds ratio context if needed.

Quick example

Suppose 87 participants are classified as pass/fail before and after a training module. If 12 moved from pass to fail (b) and 5 moved from fail to pass (c), the discordant counts are imbalanced. The test evaluates whether that imbalance is larger than expected by chance under a 50/50 null among discordant pairs.

Bottom line

Use this McNemar test calculator when your binary data are paired. Enter the full 2×2 table, review exact and asymptotic p-values, and report the method that best fits your sample size and study design.

🔗 Related Calculators