Skip to content
FiftyCalc Free calculators for all 50 states

McNemar's Test Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter the two discordant counts of a paired 2 × 2 table (pairs that changed in one direction or the other) to test whether the change is significant.

Result

Sample figures

p-value (chi-square, 1 df)—

McNemar chi-square, (b − c)² ÷ (b + c) —

  • Chi-square with continuity correction—
  • p-value with continuity correction—
  • Exact two-sided p-value (binomial)—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

McNemar's Test Calculator

Pairs positive before and negative after (b): enter 0 or more. Prefilled example: 15.

Pairs negative before and positive after (c): enter 0 or more. Prefilled example: 5.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Pairs positive before and negative after (b): enter 0 or more.
  2. Pairs negative before and positive after (c): enter 0 or more.
  3. Read the result: p-value (chi-square, 1 df); the panel also shows McNemar chi-square, (b − c)² ÷ (b + c), Chi-square with continuity correction, p-value with continuity correction and Exact two-sided p-value (binomial).

How this calculator works

McNemar's test (Psychometrika, 1947) compares two paired proportions, for example the same people before and after, or two tests on the same subjects. Only the discordant pairs matter: b changed one way and c the other.

Statistic χ² = (b − c)² ÷ (b + c), compared with a chi-square distribution with 1 degree of freedom. Edwards' continuity correction uses (|b − c| − 1)² ÷ (b + c). When b + c is small (under about 25), the exact test is preferred: two-sided p = 2 × P(X ≤ min(b, c)) for X binomial with n = b + c and p = 0.5, capped at 1.

The formula

  1. Chi=(b−c)2b+c
  2. P=1−chi2cdf⁡(Chi,1)
Symbols used in the formula
SymbolMeaning
bPairs positive before and negative after
cPairs negative before and positive after
ChiMcNemar chi-square, (b − c)² ÷ (b + c)
Pp-value (chi-square, 1 df)
chi2cdf(x, k)the probability that a chi-square variable with k degrees of freedom is at most x.

Worked example

Pairs positive before and negative after (b)15
Pairs negative before and positive after (c)5
McNemar chi-square, (b − c)² ÷ (b + c)5
Chi-square with continuity correction4.05
p-value with continuity correction0.0442
Exact two-sided p-value (binomial)0.0414
  1. Chi=(15−5)215+5=5
  2. P=1−chi2cdf⁡(5,1)=0.0253473

p-value (chi-square, 1 df) 0.0253

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

Why are the concordant pairs not used?

Pairs that gave the same answer both times carry no information about a change; under the null hypothesis, changes in each direction are equally likely.

Is b = 15 and c = 5 significant?

χ² = 100 ÷ 20 = 5, p ≈ 0.0253 at the 5% level; with the continuity correction p ≈ 0.0442, and the exact test gives p ≈ 0.0414.

Questions answered

Related calculators