Test for changes in proportions in paired nominal data. Used for before-after studies or matched-pair designs with binary outcomes.
The McNemar test is a non-parametric statistical test used to analyze paired binary data—situations where the same subjects are measured twice on a dichotomous outcome. Developed by Quinn McNemar in 1947, it determines whether the proportion of subjects who changed from one category to another is significantly different from what would be expected by chance. It is essentially a test of symmetry in a 2×2 contingency table for matched pairs.
Use the McNemar test when you have paired or matched binary data. Common scenarios include: comparing a diagnostic test result before and after treatment, evaluating whether a training program changes pass/fail rates, testing if an intervention changes behavior (yes/no), or comparing two diagnostic methods applied to the same patients. The test focuses exclusively on the discordant pairs—subjects who changed their response between the two measurements.
| Feature | McNemar | Chi-Square | Cochran's Q |
|---|---|---|---|
| Data type | Paired binary | Independent categorical | Paired binary (≥3 timepoints) |
| Samples | Matched pairs | Independent | Matched (3+ measures) |
| Groups compared | 2 (before/after) | 2 or more | 3 or more |
| Focuses on | Discordant pairs | All cells | Changes across conditions |
A researcher tests whether a training program changes employee certification pass rates. 100 employees take the certification exam before and after training.
| After: Pass | After: Fail | Total | |
|---|---|---|---|
| Before: Pass | 40 | 12 | 52 |
| Before: Fail | 5 | 43 | 48 |
| Total | 45 | 55 | 100 |
The discordant pairs are b = 12 (passed before, failed after) and c = 5 (failed before, passed after). Since b + c = 17 < 25, the exact binomial test is used.
Results
McNemar's exact test, p = .143
There was no statistically significant change in pass rates after the training program. While 5 employees improved and 12 worsened, this difference was not significant at the .05 level.
The McNemar test requires the following assumptions to be met:
1. Paired/Matched Binary Data
Each subject must be measured twice (e.g., before and after), and the outcome must be binary (e.g., yes/no, pass/fail, positive/ negative). The data form a 2×2 table of matched pairs.
2. Mutually Exclusive Categories
Each subject must fall into exactly one of the four cells of the 2×2 table. The categories must be exhaustive and mutually exclusive at each time point.
3. Random Sampling
Subjects should be randomly selected from the population of interest, or randomly assigned to conditions. The matched pairs should be independent of each other (one pair's outcome should not influence another pair's outcome).
The standard McNemar test uses a chi-square statistic with one degree of freedom. Because the binomial distribution (which underlies the test) is discrete, a continuity correction of 1 is applied: χ² = (|b − c| − 1)² / (b + c). This correction makes the chi-square approximation more accurate for moderate sample sizes. For small samples (discordant pairs < 25), StatMate automatically uses the exact binomial test instead, which does not require any approximation.
Report the test statistic, degrees of freedom, and p-value. If the exact test was used, note this in the report:
Asymptotic Test Template
McNemar's test indicated [a significant/no significant] change in [outcome] from [time 1] to [time 2], χ²(1) = X.XX, p = .XXX.
Exact Test Template
McNemar's exact test indicated [a significant/no significant] change in [outcome] from [time 1] to [time 2], p = .XXX.
Note: Use the exact test when the total number of discordant pairs (b + c) is less than 25. Report p-values to three decimal places, using p < .001 when below that threshold. Include descriptive statistics about the discordant pairs.
StatMate's McNemar test calculations have been validated against R's mcnemar.test() function and SPSS output. The implementation uses the continuity- corrected chi-square statistic and the jstat library for probability distributions. For small samples (discordant pairs < 25), the exact two-tailed binomial test is used. All results match R output to at least 4 decimal places.
T-Test
Compare means between two groups
ANOVA
Compare means across 3+ groups
Chi-Square
Test categorical associations
Correlation
Measure relationship strength
Descriptive
Summarize your data
Sample Size
Power analysis & sample planning
One-Sample T
Test against a known value
Mann-Whitney U
Non-parametric group comparison
Wilcoxon
Non-parametric paired test
Regression
Model X-Y relationships
Multiple Regression
Multiple predictors
Cronbach's Alpha
Scale reliability
Logistic Regression
Binary outcome prediction
Factor Analysis
Explore latent factor structure
Kruskal-Wallis
Non-parametric 3+ group comparison
Repeated Measures
Within-subjects ANOVA
Two-Way ANOVA
Factorial design analysis
Friedman Test
Non-parametric repeated measures
Fisher's Exact
Exact test for 2×2 tables
mcnemar.discordantHint
Enter your data and click Calculate
or click "Load Example" to try it out