McNemar's Test Calculator

Test paired proportions in a 2 by 2 contingency table with the continuity-corrected McNemar statistic and two-sided p value.

Paired proportions table
Enter the four matched binary outcome counts.

About McNemar's test

McNemar's test compares two paired proportions when every pair produces a binary outcome at two occasions or under two methods. Examples include the same respondents answering yes or no before and after an intervention, matched patients receiving two diagnostic classifications, or paired products passing and failing two inspection systems. The four counts belong in a 2 by 2 contingency table, but the pairing means an ordinary independence test is inappropriate. Cell a contains pairs positive in both conditions and cell d contains pairs negative in both. These concordant pairs did not change. Cell b contains positive-to-negative changes, while cell c contains negative-to-positive changes. The null hypothesis states that both directions of change have the same probability. Consequently, McNemar's statistic depends only on b and c. A large difference between those discordant counts supplies evidence of a systematic shift. This calculator applies the common continuity correction. It subtracts one from the absolute difference between b and c, squares the result, and divides by b plus c. The correction makes a continuous chi-squared approximation more conservative for discrete count data. The resulting statistic is compared with a chi-squared distribution with one degree of freedom to obtain a two-sided p value. For b equal to 10 and c equal to 20, the corrected statistic is 2.7 and the p value is about 0.1003. Continuity correction is not universally preferred. It can be overly conservative, especially with modest discordant totals. An uncorrected asymptotic statistic or an exact two-sided binomial test may be specified by a protocol or software package. When b plus c is small, exact inference is generally the clearest choice. Always identify the method in reports so another analyst can reproduce the p value. Statistical significance does not describe the magnitude or value of a change. Examine the discordant difference, direction, total paired sample, and confidence interval for an effect measure. Verify that pairs are genuinely matched and independent of other pairs. Report all table cells, missing-pair handling, correction choice, statistic, p value, and substantive interpretation rather than reducing the conclusion to a threshold alone.

Corrected McNemar examples

Discordant cellsCorrected resultInterpretation
b = 10, c = 20Chi squared = 2.7000, p = 0.1003The correction is more conservative than the uncorrected test.
b = 12, c = 12Chi squared = 0, p = 1With equal discordant counts there is no directional evidence.
b = 5, c = 25Chi squared = 12.0333, p about 0.00052A large imbalance remains significant after correction.

How to calculate McNemar's test

  1. Enter the number of pairs positive in both conditions.
  2. Enter the positive-to-negative and negative-to-positive counts in their labeled fields.
  3. Enter the pairs negative in both conditions.
  4. Select Calculate McNemar Test and report that continuity correction was used.

McNemar's test FAQ

What does McNemar's test compare?

It compares the two directions of change among matched binary observations. The null hypothesis says those discordant probabilities are equal.

Why use continuity correction?

The correction adjusts a continuous chi-squared approximation for discrete counts. It generally increases the p value and makes the test more conservative.

What if there are no discordant pairs?

There is no observed change to test, so the statistic's denominator is zero. Describe the complete agreement rather than interpreting an asymptotic p value.

When should I use an exact McNemar test?

Use exact binomial inference when the number of discordant pairs is small or a protocol requires it. Exact inference does not depend on the chi-squared approximation.

Do cells a and d matter?

They describe agreement and total sample composition but do not enter the test statistic. Include them in reporting so readers can understand the full paired table.