What this calculator does
McNemar test is for paired binary data: the same subjects measured twice, or matched pairs. It uses only the discordant pairs, those that changed, and ignores everyone whose result stayed the same.
With 10 changing one way and 22 the other, the corrected chi-square is 3.781 with p = 0.0518 and the uncorrected version is 4.500 with p = 0.0339. Those two straddle the conventional threshold, so the choice of correction decides the verdict. That is uncomfortable, and it is the honest situation for a result this marginal.
The formula
The statistic is the squared difference between the two discordant counts divided by their sum, on one degree of freedom. The continuity-corrected version subtracts 1 from the absolute difference before squaring, which compensates for approximating a discrete distribution with a continuous one. Concordant pairs, those that did not change, carry no information about change and are excluded.
| Term | Meaning |
|---|---|
| Discordant pairs | Pairs where the two measurements disagree. Only these enter the calculation. |
| Concordant pairs | Pairs that agree. They are ignored entirely, which surprises people. |
| Continuity correction | A downward adjustment for using a continuous distribution on discrete counts. |
| Paired design | The same subjects measured twice, or subjects matched into pairs. |
The inputs explained
| Field | What to enter |
|---|---|
| Discordant pairs: positive → negative (b) | Pairs that went from positive to negative. |
| Discordant pairs: negative → positive (c) | Pairs that went from negative to positive. |
When to use it
Before and after a treatment
The same patients tested twice, where the question is whether the rate changed.
Comparing two tests on the same samples
Where both tests are applied to every sample, the results are paired rather than independent.
Matched case-control studies
Cases matched to controls produce pairs, which must be analysed as pairs.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How does the discordant split affect the result?
A range of counts changing in the other direction.
| Negative → positive (c) | Continuity-corrected χ² (df = 1) | p-value (corrected) | p-value (uncorrected) |
|---|---|---|---|
| c = 10 | 0 | 1.0000 | 1.0000 |
| c = 15 | 0.6400 | 0.4237 | 0.3173 |
| c = 22 | 3.781 | 0.0518 | 0.0339 |
| c = 30 | 9.025 | 0.0027 | 0.0016 |
Questions
Why are the concordant pairs ignored?
Because they carry no information about whether a change occurred. A subject negative both times and one positive both times both tell you nothing about the direction of change. Only the pairs that moved can distinguish a real shift from chance.
Should I use the continuity correction?
Opinion is divided. The correction makes the test more conservative and is the traditional default, but many statisticians consider it over-conservative. Where the two disagree, as here, the honest conclusion is that the evidence is borderline rather than that one answer is right.
When should I use McNemar instead of a chi-square test?
Whenever the data is paired. Using an ordinary chi-square test on paired data ignores the pairing, which throws away the design advantage and gives the wrong answer. If the same subjects appear in both columns, McNemar is the correct test.
What if the discordant counts are very small?
Below about 25 discordant pairs in total, the chi-square approximation becomes unreliable and an exact binomial test should be used instead. That test asks directly whether the split between b and c is consistent with a fair coin.
For independent rather than paired proportions, see the two-proportion z-test calculator. For small counts in a 2x2 table, see the Fisher’s exact test calculator.