McNemar's Test Calculator
McNemar's test instantly calculates results using a, a b sum, a c sum. Use the calculator above for instant answers in your browser.
Welcome to the McNemar's Test Calculator, a specialized tool designed to evaluate paired categorical data and measure changes before and after a specific intervention. Researchers, medical professionals, and data scientists rely on this calculator to determine if row and column marginal frequencies are significantly different within a 2x2 contingency table. By automating complex chi-square and p-value computations, this tool saves valuable time and ensures statistical accuracy in your research.
How McNemar's Test Works
McNemar's test is a non-parametric statistical method used on paired nominal data, typically from 2x2 contingency tables with matched pairs. The test focuses exclusively on the discordant pairs (cells b and c), where the outcome changed between the two measurements. The test statistic follows a chi-square distribution with 1 degree of freedom and is calculated using the formula: Chi-square = ((|b - c| - 1)^2) / (b + c) when applying continuity correction, or without the minus-one term for standard asymptotic calculations. The resulting chi-square value is then converted into a p-value based on your chosen tail distribution to test your null hypothesis.
Worked Example: Evaluating a Medical Treatment
Imagine a clinical trial testing a new therapeutic cream for skin rashes on 100 patients. Each patient is evaluated before treatment and after treatment, categorized as either 'Rash Present' (Positive) or 'Rash Absent' (Negative). Suppose our 2x2 table yields the following discordant pairs: b = 24 patients had a rash before treatment but cleared up after (Positive to Negative), and c = 8 patients developed a rash after treatment despite being clear before (Negative to Positive). To calculate McNemar's test, we take the absolute difference between b and c (|24 - 8| = 16), square it (256), and divide by the sum of discordant pairs (24 + 8 = 32), resulting in a chi-square statistic of 8.0. This yields a p-value significantly below the standard 0.05 threshold, allowing researchers to reject the null hypothesis and conclude that the treatment effect is statistically significant.
Practical Tips for Paired Data Analysis
Ensure your data consists strictly of matched or paired observations, such as pre-test and post-test scores from the exact same subjects. Pay close attention to the discordant pairs (b and c), as concordant pairs (a and d) do not contribute to the McNemar test statistic numerator. If your total number of discordant pairs (b + c) is small, typically less than 25, consider using the binomial exact test version instead of the standard asymptotic chi-square approximation to maintain analytical validity.
FAQs
What is McNemar's test and when should I use it?
McNemar's test is a statistical test used for paired nominal data. It is primarily applied to 2x2 contingency tables with dichotomous traits matched across two conditions, such as before-and-after studies on the same subjects. It helps researchers determine if marginal proportions have changed significantly over time or following an intervention.
How do I construct the contingency table for McNemar's test?
A McNemar contingency table organizes paired data into a 2x2 grid. The rows typically represent the first measurement (e.g., pre-test) and the columns represent the second measurement (e.g., post-test). Cells 'a' and 'd' represent concordant pairs where subjects remained in the same category, while cells 'b' and 'c' represent discordant pairs where subjects changed categories between measurements.
Why do I need the contingency table in McNemar's test?
The contingency table is essential because McNemar's test specifically evaluates the discordant pairs (cells b and c) found within it. Without structuring your paired data into this 2x2 format, you cannot isolate the shifts in categorical outcomes needed to compute the chi-square statistic and the associated p-value.
When should I use McNemar's exact test instead of the standard version?
You should use McNemar's exact test when the total number of discordant pairs (b plus c) is small, usually fewer than 25. The standard asymptotic chi-square approximation relies on large sample theory and can yield inaccurate p-values with small sample sizes, whereas the exact test calculates probabilities directly using the binomial distribution.
Formula verified against Statistical methodology standards — all calculations use deterministic, standards-based formulas.
Related calculators
5★ rating average
Instantly calculate 5★ rating average using average rating, r1, r2. Free, accurate statistics calculator with real-world examples.
Statistics
Dice probability
Instantly calculate dice probability using advantage option, dice probability, dice type. Free, accurate statistics calculator with real-world examples.
Statistics
Critical value
Instantly calculate critical value using f both1, f both2, f left. Free, accurate statistics calculator with real-world examples.
Statistics
Coin flip probability
Instantly calculate coin flip probability using game rules, heads, n flips. Free, accurate statistics calculator with real-world examples.
Statistics
p-value
Instantly calculate p-value using fdf2, alpha, alt. Free, accurate statistics calculator with real-world examples.
Statistics