McNemar Test Calculator

Assess paired nominal responses with options for asymptotic chi-square, Edwards continuity correction, and exact binomial p-values. Enter the 2x2 table for pre/post or matched designs and receive the test statistic, p-value, effect size, and interpretation.

1. Enter Paired 2x2 Table

Focus on discordant pairs

Discordant focus

McNemar's test compares the off-diagonal counts \(b\) and \(c\) in the paired table:

\\[ \begin{bmatrix} a & b \\ c & d \end{bmatrix} \\]

The null hypothesis assumes \(b = c\), meaning the treatment or time shift has no effect on the binary outcome.

Method
Alternative hypothesis

Formula Reference

Asymptotic chi-square

\\[ \chi^2 = \frac{(b - c)^2}{b + c} \\]

Use when \(b + c \ge 25\) or the sample size is otherwise large enough for the chi-square approximation.

Edwards correction

\\[ \chi^2 = \frac{(|b - c| - 1)^2}{b + c} \\]

Applies a continuity correction to reduce Type I error when discordant counts are modest.

Exact binomial

\\[ X \sim \text{Binomial}(b + c, 0.5) \\]

Two-sided p-values are computed by doubling the smaller tail probability and capping at 1.

Effect metrics

\\[ \text{Diff} = b - c, \quad \Delta_p = \frac{b - c}{n}, \quad \phi = \frac{b - c}{\sqrt{n (b + c)}} \\]

Here \(n = a + b + c + d\) is the total number of pairs.

Step-by-Step Guide

  1. Collect paired responses and tabulate the 2x2 contingency table.
  2. Identify discordant counts \(b\) and \(c\); the null expects them to be equal.
  3. Select the desired method (asymptotic, continuity corrected, or exact) and alternative hypothesis.
  4. Compute the test statistic and corresponding p-value, comparing to the chosen alpha level.
  5. Report the effect size (difference and phi) alongside the decision for practical interpretation.

References

  • McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2), 153-157.
  • Edwards, A. L. (1948). Note on the "correction for continuity" in testing the significance of the difference between correlated proportions. Psychometrika, 13(3), 185-187.
  • Agresti, A. (2018). Statistical Methods for the Social Sciences (5th ed.). Pearson.