PickMyTest

McNemar's Test

Tests whether the frequencies of a binary variable differ significantly between paired samples

McNemar's Test#

McNemar's test tests whether the distribution of a dichotomous variable (e.g., yes/no) has changed significantly between two related measurements. It is commonly used for before-and-after comparisons with binary data.

When to Use#

Use McNemar's test when you want to:

  • Compare paired binary data (e.g., the same subject at two time points)
  • Test whether a change in the frequency of a binary characteristic has occurred
  • You have a 2x2 contingency table with dependent samples

Assumptions#

  • Data are paired (e.g., before-after on the same subject)
  • The dependent variable is binary (dichotomous)
  • The observation pairs are independent of each other
  • Sufficient number of discordant pairs (b + c β‰₯ 25 for the normal approximation)

Formula#

The basis is the 2x2 contingency table of paired observations:

After: YesAfter: No
Before: Yesab
Before: Nocd

The test statistic is based only on the discordant pairs (b and c):

Ο‡2=(bβˆ’c)2b+c\chi^2 = \frac{(b - c)^2}{b + c}

with 1 degree of freedom.

For small samples (b + c < 25), the continuity correction by Edwards is recommended:

Ο‡corr2=(∣bβˆ’cβˆ£βˆ’1)2b+c\chi^2_{\text{corr}} = \frac{(|b - c| - 1)^2}{b + c}

Example#

Practical Example: Campaign Effectiveness

A company wants to know whether an advertising campaign changed purchase intention. 200 people are surveyed before and after the campaign (purchase intention: yes/no).

After: YesAfter: No
Before: Yes8010
Before: No3080
  • Discordant pairs: b = 10, c = 30
  • Ο‡2=(10βˆ’30)2/(10+30)=400/40=10.0\chi^2 = (10 - 30)^2 / (10 + 30) = 400 / 40 = 10.0
  • p < 0.01 (significant)

Interpretation: The campaign led to a significant change in purchase intention. More people switched from "No" to "Yes" (30) than vice versa (10).

Effect Size#

The effect size is calculated using the odds ratio of the discordant pairs:

OR=bcOR = \frac{b}{c}

Alternatively, the phi coefficient or Cohen's g can be used:

g=∣bb+cβˆ’0.5∣g = \left| \frac{b}{b+c} - 0.5 \right|
Effect SizeCohen's g
Small0.05
Medium0.15
Large0.25

Note: McNemar's test only considers the discordant pairs (b and c). The concordant pairs (a and d) do not enter the test statistic.

Further Reading

  • McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2), 153–157.
  • Field, A. (2018). Discovering Statistics Using IBM SPSS Statistics (5th ed.). SAGE.