McNemar's Test Calculator
Calculate discordant totals, test statistics, p-values, odds ratio, and significance based on paired outcome counts and significance level. McNemar's Test Calculator helps researchers, analysts, and students evaluate changes between paired binary measurements.
Highlights
- Compare paired binary outcomes using McNemar’s statistical test.
- Analyze discordant pairs and measure changes in both directions.
- Calculate matched-pairs odds ratios and discordant count differences.
- Get asymptotic and exact two-sided p-values for reliable significance testing.
- Choose your significance level and apply or disable continuity correction.
Table of Contents
How McNemar's Test Works?
McNemar's test evaluates whether two paired binary measurements have the same proportion of positive outcomes. It focuses only on pairs whose outcomes disagree, called discordant pairs. In this calculator, b counts pairs that changed from first positive to second negative, while c counts pairs that changed from first negative to second positive.
| Second measurement | First positive | First negative |
|---|---|---|
| Positive | Concordant | c |
| Negative | b | Concordant |
The total number of discordant pairs is the sum of the two directional changes:
The calculator reports the share of discordant pairs moving in each direction, the signed difference between the directions, and the matched-pairs odds ratio:
The asymptotic McNemar statistic compares the two discordant counts. Without continuity correction, it is:
When continuity correction is selected, the calculator subtracts 1 from the absolute discordant difference before squaring:
Both asymptotic calculations use one degree of freedom. The asymptotic two-sided p-value is obtained from the upper tail of the chi-square distribution with one degree of freedom. The exact two-sided p-value instead treats the number of changes in one direction as a binomial random variable with n trials and probability 0.5 under the null hypothesis. The selected significance level is converted to a proportion, . The calculator compares each p-value with this level and reports whether the corresponding test rejects the null hypothesis of no directional change. The critical chi-square value is the upper-tail cutoff for one degree of freedom at the selected significance level.
Practical Use Cases
Clinical researchers can compare whether the same patients test positive or negative before and after a treatment, using the discordant counts to determine whether the treatment is associated with a statistically significant change.
Public-health analysts can assess paired screening results collected at two time points, such as before and after an intervention, while distinguishing individuals who changed from positive to negative from those who changed in the opposite direction.
Medical diagnosticians can compare two binary diagnostic methods applied to the same subjects. McNemar's test evaluates directional disagreement, while the matched-pairs odds ratio summarizes which method or assessment produces more positive classifications among discordant cases.
Survey researchers can examine paired yes-or-no responses from the same participants before and after an information campaign, policy change, or questionnaire revision.
Quality-improvement teams can compare pass-or-fail outcomes for the same cases before and after a process change. The exact p-value is especially useful when the number of discordant cases is small.
Statistics students and analysts can use the calculator to see how continuity correction affects the asymptotic chi-square statistic and how the asymptotic and exact conclusions compare at a chosen significance level.
Accuracy and Limitations
The calculator applies the standard McNemar formulas to integer discordant counts and reports both the continuity-corrected or uncorrected asymptotic chi-square result and an exact two-sided binomial result. The asymptotic approximation can be unreliable when b + c is small, so the exact p-value is generally more appropriate in that situation. The test assumes genuinely paired observations, one binary outcome per measurement, and independent pairs; it does not adjust for covariates, clustering, missing pairs, or more than two outcome categories. Percentages are undefined when there are no discordant pairs, and the matched-pairs odds ratio is undefined when b or c is zero; such boundary cases should be interpreted using the directional counts and p-values rather than a finite ratio.
Quick Examples
Example #1: Balanced paired outcomes
Evaluate whether similar numbers of participants change from positive to negative and from negative to positive.
Example #2: Strong directional change
Assess whether paired outcomes show a significant shift from positive to negative more often than the reverse.
Example #3: Small-sample exact comparison
Compare a small number of discordant pairs using an uncorrected asymptotic statistic and a stricter significance level.