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: Yes | After: No | |
|---|---|---|
| Before: Yes | a | b |
| Before: No | c | d |
The test statistic is based only on the discordant pairs (b and c):
with 1 degree of freedom.
For small samples (b + c < 25), the continuity correction by Edwards is recommended:
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: Yes | After: No | |
|---|---|---|
| Before: Yes | 80 | 10 |
| Before: No | 30 | 80 |
- Discordant pairs: b = 10, c = 30
- 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:
Alternatively, the phi coefficient or Cohen's g can be used:
| Effect Size | Cohen's g |
|---|---|
| Small | 0.05 |
| Medium | 0.15 |
| Large | 0.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.