McNemar's Test Calculator

Enter your 2×2 contingency table values (A, B, C, D) from a matched pairs study and get the McNemar's test statistic, p-value, and statistical significance instantly. Designed for paired binomial data — such as matched case-control studies or before/after experiments where the same subjects receive two treatments.

Number of pairs where both case and control are positive (concordant positive).

Number of pairs where the case is positive but the control is negative (discordant).

Number of pairs where the case is negative but the control is positive (discordant).

Number of pairs where both case and control are negative (concordant negative).

Continuity correction reduces Type I error when B+C is small.

Results

P-Value

--

McNemar's Chi-Square Statistic

--

Statistical Significance

--

Total Pairs (n)

--

Discordant Pairs (B + C)

--

Odds Ratio (B / C)

--

Contingency Table Pair Distribution

Frequently Asked Questions

What is McNemar's test used for?

McNemar's test is used to compare paired proportions from a 2×2 contingency table. It is appropriate for matched case-control studies, before-and-after experiments, or any design where two related measurements are taken on the same or matched subjects. The test evaluates whether the marginal proportions for two dichotomous outcomes differ significantly.

What do the values A, B, C, and D represent?

Each value represents a count of pairs, not individual subjects. A = pairs where both are positive; B = pairs where the case is positive but the control is negative; C = pairs where the case is negative but the control is positive; D = pairs where both are negative. The total number of subjects is twice the sum of all four values.

Why does the calculation only depend on B and C?

McNemar's test focuses on the discordant pairs — those where the two members of a pair differ. Concordant pairs (A and D) provide no information about whether there is a difference between the two conditions, so only B and C drive the chi-square statistic and p-value.

When should I apply Yates' continuity correction?

Yates' continuity correction is generally recommended when the number of discordant pairs (B + C) is small, typically fewer than 25. It reduces the tendency of the chi-square approximation to be anti-conservative (i.e., give p-values that are too small). For large samples, the correction makes little practical difference.

What p-value threshold indicates statistical significance?

By convention, a p-value less than 0.05 is considered statistically significant, meaning there is less than a 5% probability of observing the result if the null hypothesis (no difference in proportions) were true. Some fields use stricter thresholds such as 0.01 or 0.001. Always interpret p-values in the context of your study design and effect size.

How is the odds ratio interpreted in McNemar's test?

In the context of matched pairs, the odds ratio is computed as B divided by C. A value greater than 1 suggests the exposure is more common among cases; a value less than 1 suggests it is more common among controls. An odds ratio of 1 indicates no difference between the matched groups.

What is the minimum sample size required for McNemar's test?

There is no strict minimum, but the chi-square approximation used in McNemar's test becomes unreliable when the total number of discordant pairs (B + C) is very small — generally fewer than 10. In such cases, consider using the exact binomial test instead of the chi-square approximation.

Can McNemar's test be used for before-and-after studies?

Yes. McNemar's test is well-suited for before-and-after (pre-post) study designs where the same subjects are measured under two conditions and each outcome is binary (e.g., positive/negative, improved/not improved). Each subject contributes one pair of measurements to the 2×2 table.

More Statistics Tools