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 pairsDiscordant 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.
Test Results
Results readyKey Values
- Method
- Statistic
- p-value
- Alpha
- Alternative
Effect Size
- Discordant difference
- Proportion difference
- Phi coefficient
Decision
Observed Table
| Column 1 | Column 2 | Row total | |
|---|---|---|---|
| Row 1 | |||
| Row 2 | |||
| Column total |
Step-by-Step Workflow
Why the exact test?
When \(b + c\) is small, the chi-square approximation becomes liberal. The exact binomial test uses \(X \sim \text{Binomial}(b + c, 0.5)\) to deliver valid p-values even with very small samples.
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
- Collect paired responses and tabulate the 2x2 contingency table.
- Identify discordant counts \(b\) and \(c\); the null expects them to be equal.
- Select the desired method (asymptotic, continuity corrected, or exact) and alternative hypothesis.
- Compute the test statistic and corresponding p-value, comparing to the chosen alpha level.
- 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.