Overview

McNemar's test checks whether a yes-or-no answer really changed between two measurements on the same people, such as before and after a campaign.

Enter how many people changed in each direction. People who gave the same answer both times don't affect the test.

Worked examples

InputsResult
Changed from yes to no (b)6Changed from no to yes (c)15Significance level5%p-value: 0.0809Chi-square: 3.048 with continuity correction, 1 degree of freedomNot significant at the 5% level.With fewer than 25 changes, an exact binomial test is more reliable.
Show 1 more example
Changed from yes to no (b)40Changed from no to yes (c)18Significance level5%p-value: 0.00583Chi-square: 7.603 with continuity correction, 1 degree of freedomSignificant at the 5% level: the change is unlikely to be chance.

How it works

Only the people who changed their answer carry information about a shift. If nothing really changed, those switches should split about evenly in each direction. The statistic measures how far they are from an even split, and the p-value comes from a chi-square distribution with 1 degree of freedom.

The formula

χ² = (|b − c| − 1)² ÷ (b + c)
bPeople who changed from yes to no
cPeople who changed from no to yes

Practical tips

  • The test is for paired data, where the same people are measured twice.
  • With fewer than 25 changes in total, use an exact binomial test instead.
  • Report the size of the change as well as the p-value.

Frequently asked questions

Why are the people who didn't change ignored?

They say nothing about whether answers shifted in one direction more than the other.

When should I use McNemar's test instead of chi-square?

When the two measurements come from the same people. The standard chi-square test needs independent groups.

What does the continuity correction do?

It subtracts 1 to adjust for using a smooth distribution with whole-number counts.