Skip to content
Omnikalc

McNemar test: did the proportion change between two paired measurements?

Enter the 2 × 2 table of paired yes/no results, before and after or test A and test B, to get the McNemar chi-square, the exact p-value and both proportions.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Method for the main p-value

Results

p-value

0.04417

Statistically significant: p is below α, so reject the null hypothesis
McNemar χ² with continuity correction
4.050
McNemar χ² without correction
5.000
Exact binomial p-value (two-tailed)
0.04139
Proportion of yes, first measurement
45.0%
Proportion of yes, second measurement
35.0%
Change in proportion (second − first)
-10.0%
Paired odds ratio b ÷ c
3.00
Fewer than 25 discordant pairs: the exact p-value is the safer choice

What the McNemar test does

The McNemar test compares two proportions measured on the same subjects: the share of people who answer yes before and after a campaign, the positive rate of two diagnostic tests applied to the same patients, or the pass rate of students on two exams. Because the measurements are paired, the usual chi-square test for two independent proportions does not apply.

The 2 × 2 table

Second: yes Second: no
First: yes a b
First: no c d

Only the discordant pairs b and c carry information about a change: subjects in a and d gave the same answer twice.

The formulas

  • With the continuity correction (Edwards): χ² = (|b − c| − 1)² ÷ (b + c), 1 degree of freedom.
  • Without correction: χ² = (b − c)² ÷ (b + c).
  • Exact test: under the null hypothesis, b follows Binomial(b + c, ½), so p = 2 × P(X ≤ min(b, c)).

Example

100 people are asked whether they would buy a product, before and after seeing an ad: a = 30, b = 15, c = 5, d = 50.

  • yes before: 45%; yes after: 35%, a drop of 10 points;
  • χ² with correction = (10 − 1)² ÷ 20 = 4.05, p ≈ 0.044;
  • without correction: χ² = 5, p ≈ 0.025;
  • exact p ≈ 0.041.

All three methods agree that the change is significant at α = 0.05: the ad reduced purchase intent.

Which p-value to report?

  • With fewer than about 25 discordant pairs, use the exact binomial p-value.
  • With more, the corrected chi-square is standard; the uncorrected version is slightly less conservative and is also widely used.

Effect size

The paired odds ratio b ÷ c (here 3) says how many more subjects switched in one direction than the other. The difference in proportions (c − b) ÷ N is the change in percentage points.

Limits

  • The test ignores the concordant pairs, so a large a or d does not add power.
  • It applies to two measurements only. For three or more paired measurements of a yes/no outcome, use Cochran’s Q test.

Frequently asked questions

When do I use the McNemar test?

To compare two proportions measured on the same subjects, such as before and after, or two tests on the same patients.

Why does the McNemar test ignore concordant pairs?

Subjects who gave the same answer twice say nothing about a change; only the discordant pairs b and c do.

Should I use the continuity correction?

With few discordant pairs, use the exact binomial test. With more, the corrected chi-square is the usual choice.

What is the McNemar test formula?

χ² = (|b − c| − 1)² ÷ (b + c) with continuity correction, compared with chi-square with 1 degree of freedom.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.