McNemar Chi-Squared Test Calculator
Analyze paired binary outcomes in a 2 by 2 table with the uncorrected McNemar chi-squared statistic and asymptotic p value.
About the McNemar chi-squared test
McNemar's test evaluates paired binary outcomes. Common applications include before-and-after responses from the same people, matched case-control pairs, and two diagnostic tests applied to the same subjects. The data form a 2 by 2 table. Cell a counts pairs positive at both measurements, d counts pairs negative at both, b counts changes from positive to negative, and c counts changes from negative to positive. Pairing is essential because the two observations within each pair are not independent. The null hypothesis says the two discordant directions are equally likely. For that reason only b and c contribute to the test statistic. Concordant pairs in a and d provide useful descriptive context but no evidence about directional change. This uncorrected asymptotic version computes chi squared as the squared difference between b and c divided by their sum. Under the null and with enough discordant pairs, it is compared with a chi-squared distribution having one degree of freedom. A small p value indicates that the imbalance between the two change directions would be unusual if their probabilities were equal. For example, b equal to 10 and c equal to 20 produces an uncorrected statistic of about 3.333 and a two-sided p value near 0.0679. That result does not cross a conventional 0.05 threshold, although thresholds should be chosen before viewing data and interpreted with study design, effect size, and uncertainty. The uncorrected statistic is often used when the total number of discordant pairs is reasonably large. With few discordant observations, its chi-squared approximation can be inaccurate. An exact binomial McNemar test is then preferable. Some references instead apply Yates continuity correction, subtracting one from the absolute difference before squaring. The separate McNemar Test Calculator in this collection reports that corrected approximation. Do not use an ordinary Pearson chi-squared independence test on paired observations; it ignores within-pair dependence and answers a different question. Also avoid treating repeated measurements as separate participants. Report all four table cells, the chosen corrected or uncorrected method, the statistic, degrees of freedom, p value, and a directional effect estimate so readers can understand both statistical and practical importance.
McNemar chi-squared examples
| Discordant cells | Result | Interpretation |
|---|---|---|
| b = 10, c = 20 | Chi squared = 3.3333, p = 0.0679 | There are twice as many negative-to-positive changes. |
| b = 12, c = 12 | Chi squared = 0, p = 1 | The change directions are perfectly balanced. |
| b = 5, c = 25 | Chi squared = 13.3333, p about 0.00026 | The directional imbalance is strong. |
How to run McNemar's test
- Count pairs positive at both measurements and enter cell a.
- Enter positive-to-negative changes in b and negative-to-positive changes in c.
- Enter pairs negative at both measurements in d.
- Select Calculate Chi-Squared Test and interpret the p value with the discordant count.
McNemar chi-squared FAQ
Why do only b and c affect the statistic?
They are the pairs whose binary outcome changed. The test asks whether the two possible directions of change occur equally often.
What are the degrees of freedom?
The asymptotic McNemar statistic uses one degree of freedom. Its p value is taken from that chi-squared reference distribution.
When is an exact test better?
An exact binomial test is safer when the discordant total is small. It avoids relying on the large-sample chi-squared approximation.
Is this the continuity-corrected version?
No, this calculator reports the direct uncorrected statistic. The corrected variant subtracts one from the absolute discordant difference before squaring.
Can I use this for independent groups?
No, McNemar's test specifically requires paired or matched binary observations. Independent groups require a different proportion or contingency-table test.