McNemar's test
McNemar’s test (McNemar, 1947) is the yes/no version of the paired t-test. It asks whether the proportion answering “yes” changed between two occasions for the same people.
Why only the changers count
Arrange the paired answers in a 2×2 table:
| Time 2: yes | Time 2: no | |
|---|---|---|
| Time 1: yes | a (stayed yes) | b (switched to no) |
| Time 1: no | c (switched to yes) | d (stayed no) |
People who gave the same answer both times tell you nothing about change. If there’s no real shift, switches in each direction (b and c) should be about equal. The test statistic is χ² = (|b − c| − 1)² / (b + c), with continuity correction and 1 df.
Worked example: presidential approval
A classic example from Agresti’s Categorical Data Analysis: 1,600 adults rated the US president’s performance in two surveys a month apart. Did disapproval change?
Category counted: Disapprove N: 1600 Proportion (survey1): 0.4100 Proportion (survey2): 0.4500 Discordant (first only): 86 Discordant (second only): 150 Both: 570 Neither: 794 P-value method: chi-square with continuity correction Chi-square statistic: 16.8178 df: 1 P-value: 4.115e-05 Odds ratio: 0.5733 95% CI: [0.4346, 0.7523] Rows excluded for missing values: 0 of 1600
The statistic and p-value match R’s mcnemar.test().
Interpretation
- Disapproval rose from 41% to 45%.
- Of 236 people who changed their answer, 150 moved to disapproval and 86 moved away from it.
- χ²(1) = 16.82, p < .001: strong evidence that disapproval increased.
- The paired odds ratio, 0.57 (86/150), 95% CI [0.43, 0.75], expresses the imbalance between the two kinds of switcher.
APA write-up
A McNemar test showed that disapproval of the president increased between the first (41%) and second (45%) surveys, χ²(1, N = 1,600) = 16.82, p < .001. Of the 236 respondents who changed their rating, 150 moved to disapproval.
Exact version
When b + c is small, the chi-square approximation is unreliable. The exact version is a binomial test of whether b and c split 50:50. Analytika uses the exact version when there are fewer than 25 discordant pairs.
Related tests
- Three or more occasions: Cochran’s Q test.
- Independent groups: the chi-square test or Fisher’s exact test.
References
- Agresti, A. (1990). Categorical data analysis. Wiley.
- McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2), 153–157.
More in Categorical data
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.