McNemar's Test
Perform McNemar's test for paired proportions on a 2x2 contingency table. Supports standard, Edwards/Yates correction, exact binomial, and mid-p approaches with charts.
About This Calculator
McNemar's test is a non-parametric statistical test used on paired binomial data to determine if there is a significant difference between paired proportions. It is widely used in before-after studies, matched case-control designs, crossover trials, and any research setting where subjects serve as their own control. Researchers in medicine, public health, social sciences, and market research rely on this test to evaluate treatment effects, intervention outcomes, and preference changes.
The test works with a 2x2 contingency table derived from paired observations. The table has four cells: a (both before and after positive), b (before negative, after positive), c (before positive, after negative), and d (both before and after negative). Only the discordant pairs (b and c) contribute to the test statistic. The standard McNemar's test statistic follows a chi-squared distribution with 1 degree of freedom, calculated as χ² = (b - c)² / (b + c). For small samples where b + c < 25, the exact binomial test is recommended over the chi-squared approximation.
Regional Notes: McNemar's test is a universal statistical method used globally with no region-specific variations. Researchers in India (ICMR guidelines), the United States (FDA/CDC), and the United Kingdom (NICE/MRC) all apply the same methodology. The significance level (typically α = 0.05) and interpretation are consistent worldwide. Medical journals in all regions, including the Indian Journal of Medical Research, JAMA, BMJ, and The Lancet, regularly publish studies using McNemar's test.
This calculator supports five versions of the test: the standard McNemar's test, the test with Edwards continuity correction (subtracts 1 from |b-c|), the Yates continuity correction (subtracts 0.5 from |b-c|), the exact binomial test (for small samples), and the mid-p binomial test (a less conservative alternative to the exact test).
Frequently Asked Questions
What is McNemar's test used for?
McNemar's test is a statistical test used on paired binomial data to determine whether there is a significant difference in paired proportions. It is commonly applied to before-after studies, matched case-control designs, and crossover trials where each subject serves as their own control.
What are the null and alternative hypotheses in McNemar's test?
The null hypothesis (H0) of McNemar's test is that the marginal distributions are equal — i.e., the proportions of the two paired groups do not differ. In terms of the 2x2 contingency table, this simplifies to H0: b = c, where b and c are the discordant pairs. The alternative hypothesis (H1) is that the marginal distributions differ (H1: b ≠ c).
How is McNemar's test statistic calculated?
The standard McNemar's test statistic is χ² = (b - c)² / (b + c), where b and c are the discordant pairs from the 2x2 contingency table. Under the null hypothesis, this follows a chi-squared distribution with 1 degree of freedom when b + c is sufficiently large.
What is the difference between Edwards and Yates correction in McNemar's test?
Both Edwards and Yates corrections are continuity corrections applied to McNemar's test. Edwards correction uses χ² = (|b - c| - 1)² / (b + c), subtracting 1 from the absolute difference. Yates correction uses χ² = (|b - c| - 0.5)² / (b + c), subtracting 0.5. Edwards correction is more commonly used and is the default in some statistical packages.
When should I use the exact binomial version of McNemar's test?
The exact binomial test should be used when the number of discordant pairs (b + c) is small, typically less than 25. In such cases, the chi-squared approximation may be unreliable. The exact test computes the p-value directly from the binomial distribution with p = 0.5, avoiding approximation errors.
What does a significant McNemar's test result mean?
A significant result (p < 0.05) indicates that the paired proportions differ significantly. This means the treatment or intervention had a measurable effect on the outcome. For example, in a before-after study, a significant result suggests the proportion of positive outcomes changed after the treatment.
Can McNemar's test be used for matched case-control studies?
Yes, McNemar's test is commonly used in matched case-control studies. In this context, each case is matched with one or more controls, and the test evaluates whether the proportion of exposure differs between cases and controls. The matched pairs form the 2x2 contingency table.
What is the mid-p value in McNemar's test?
The mid-p value is a modification of the exact p-value that reduces the conservatism of exact tests. It is calculated by subtracting half the probability of the observed outcome from the exact two-sided p-value. The mid-p approach offers better control of type I error rates while maintaining the advantages of exact inference.