Standard categorical tests (like the Chi-Square test) are designed to compare two completely different groups of people. But what happens if you want to survey a single group of voters, show them a political ad, and then survey that exact same group a second time? Because the data is linked to the same individuals, standard statistical models fail.
Our free online McNemar’s Test Calculator is specifically engineered for paired nominal data. By isolating the subjects who actually changed their minds between Test 1 and Test 2, the calculator generates an exact p-value to prove if your intervention (the ad, the drug, the training) had a statistically significant impact.
Understanding Concordant vs. Discordant Pairs
When tracking “Before and After” data in a 2×2 contingency table, McNemar’s Test completely ignores the people who didn’t change their minds. It focuses entirely on the “Discordant Pairs”—the people who flipped their answers.
| Data Cell | Subject Behavior | Role in McNemar’s Test |
|---|---|---|
| Cell A (Concordant) | Voted “Yes” before, Voted “Yes” after. | Ignored. They did not change their minds, so they provide no insight into the intervention. |
| Cell B (Discordant) | Voted “Yes” before, Voted “No” after. | Calculated. A critical data point showing a shift away from the baseline. |
| Cell C (Discordant) | Voted “No” before, Voted “Yes” after. | Calculated. A critical data point showing a shift toward the baseline. |
| Cell D (Concordant) | Voted “No” before, Voted “No” after. | Ignored. They were completely unmoved by the intervention. |
The Math Behind the Calculator
Because McNemar’s Test evaluates the distribution of a single categorical variable across two paired measurements, the resulting test statistic follows a Chi-Square (χ²) distribution with 1 degree of freedom. The standard formula is: χ² = (b - c)² / (b + c).
| Equation Element | Mathematical Logic | What it Actually Does |
|---|---|---|
| The Numerator | (b - c)² |
Calculates the absolute difference between the people who flipped “Yes-to-No” vs “No-to-Yes.” Squaring it ensures the number is positive. |
| The Denominator | (b + c) |
Calculates the total aggregate number of people who changed their minds (the total Discordant pool). |
| Continuity Correction | (|b - c| - 1)² / (b + c) |
If the total number of discordant pairs is small, an Edwards’ continuity correction (-1) is automatically applied to prevent false positives. |
If your experimental groups are completely independent (not paired), you should not use this calculator. Instead, use our standard Hypothesis Testing Calculator. If you have independent groups with extremely small sample sizes (less than 5 per cell), utilize our Fisher’s Exact Test Calculator.
Frequently Asked Questions (FAQ)
What is the difference between McNemar’s Test and the Chi-Square Test?
The standard Pearson’s Chi-Square Test assumes that every single data point comes from a separate, independent person. McNemar’s Test is used exclusively for dependent (paired) data, where the exact same subject is measured twice (Before vs. After, Pre-Test vs. Post-Test).
What does “Marginal Homogeneity” mean?
The null hypothesis for McNemar’s Test states that there is “marginal homogeneity.” In plain English, this means the probability of a person flipping from Yes-to-No is exactly equal to the probability of someone flipping from No-to-Yes. If your test generates a significant p-value (p < 0.05), you have proven that marginal homogeneity does not exist, and your intervention caused a specific directional shift.
What happens if cells B and C are very small?
If the total sum of your discordant pairs (b + c) is less than 25, the standard McNemar approximation becomes inaccurate. In these cases, the calculator will automatically apply the Edwards’ Continuity Correction or compute an Exact Binomial probability to ensure your final p-value is mathematically sound.