mcnemar calculator

McNemar Test Calculator (Paired 2×2 Table)

Use this calculator for paired nominal data, such as before/after responses from the same people, matched case-control pairs, or two diagnostic tests measured on the same subject.

After: Positive After: Negative
Before: Positive a b
Before: Negative c d

McNemar’s test uses only the discordant cells b and c.

What is McNemar’s test?

McNemar’s test checks whether there is a significant change in paired binary outcomes. It is commonly used when each participant is measured twice (for example, before and after an intervention) or when two matched observations are collected for each pair.

When should you use this calculator?

  • Before/after studies: same people, yes/no response at two time points.
  • Matched-pair designs: paired observations with binary outcomes.
  • Diagnostic comparison: two tests on the same subjects (positive/negative).

If your data are independent (not paired), this is not the right test. In that case, use a chi-square test of independence or Fisher’s exact test, depending on sample size.

How the McNemar statistic is computed

1) Uncorrected chi-square version

χ² = (b − c)² / (b + c)

This statistic follows an approximate chi-square distribution with 1 degree of freedom when the number of discordant pairs is reasonably large.

2) Continuity-corrected version (Edwards)

χ²cc = (|b − c| − 1)² / (b + c)

This version is more conservative for smaller samples.

3) Exact binomial version

For small discordant counts, an exact test is preferred. Under the null hypothesis, the discordant outcomes are equally likely, so b can be modeled as Binomial(n = b + c, p = 0.5). This page reports a two-sided exact p-value.

How to interpret the output

  • p-value < α: reject the null; there is evidence of asymmetric change.
  • p-value ≥ α: fail to reject the null; observed difference may be due to random variation.
  • Small discordant total (b + c): rely more on the exact p-value.

Practical example

Suppose 100 participants answer a yes/no question before and after a workshop. If 12 change from yes to no (b = 12) and 4 change from no to yes (c = 4), McNemar’s test examines whether that imbalance (12 vs 4) is larger than expected by chance.

Assumptions and cautions

  • Data are paired and each pair is independent of other pairs.
  • Outcome is binary in both measurements.
  • Only discordant pairs affect the test statistic.
  • If b + c is small, use the exact p-value for more reliable inference.

FAQ

Why don’t cells a and d affect the test?

Because a and d are concordant pairs (no change). McNemar’s test specifically evaluates directional change, which is captured by b and c.

Can I use McNemar’s test for more than two categories?

Not directly. For multi-category paired outcomes, consider alternatives such as Bowker’s test of symmetry or Cochran’s Q test (for repeated binary outcomes across more than two conditions).

Is this calculator suitable for publication?

It is useful for quick analysis and learning. For formal reporting, verify results with statistical software and document whether you used the uncorrected, continuity-corrected, or exact method.

🔗 Related Calculators