Interactive module guide
McNemar Test Calculator — Paired 2×2 Analysis
This McNemar test calculator evaluates paired binary outcomes through the discordant pairs, with an exact small-sample version and a chi-square version.
Free · No sign-up · Calculations stay in your browser
The McNemar test evaluates paired binary outcomes, asking whether changes in one direction are as probable as changes in the other.
Only the discordant pairs, the units that switched, carry information.
This calculator runs the exact binomial version when there are fewer than 25 discordant pairs and the χ² = (b−c)²/(b+c) version with one degree of freedom otherwise, states which version ran, and reports the discordant odds ratio b/c.
Use the McNemar test calculator for paired binary outcomes measured twice on the same units; only the discordant pairs inform the test.
When to use this McNemar test calculator
Use it when
- Use it when the same units are measured twice on a binary outcome, such as symptom present or absent before and after treatment, or task success under an old and a new interface for the same participants.
- It also fits matched-pair designs where each case is deliberately paired with a similar control and both members receive the binary classification; the pair, not the individual, is the unit.
- Choose it when the question is whether the marginal proportion changed between the two occasions, for example whether support rose after a debate among the same panel of respondents.
Choose another method when
- Do not use it for two independent groups; without pairing, the two-proportion z-test or Fisher’s exact test is the design-matched choice, and applying McNemar there answers no meaningful question.
- It does not measure agreement. A table can show excellent agreement with asymmetric changes or poor agreement with symmetric ones; questions about rater agreement belong to statistics such as Cohen’s kappa.
- Avoid it for more than two occasions or more than two categories; extensions such as Cochran’s Q or Bowker’s test cover those designs and are not implemented here.
Interactive tool
The calculator loads as you approach this section so the guide remains fast on mobile connections.
Example preview
Before-and-after binary outcome
- Inputs
- Paired table a=20, b=3, c=9, d=18; twelve discordant pairs.
- Representative result
- Exact two-sided p≈0.146; the discordant split 3 versus 9 is compatible with symmetric change.
Illustrative only. Load the interactive tool to enter your own values and review assumptions.
Watch the explanation
4:44 minThe player loads only after you press play. You can also watch on YouTube.
Read the complete transcript
The McNemar Test. Some patients lose a symptom after treatment, while others gain it. This paired binary test asks whether those two directions of change are equally probable. Build one paired table. Cell a is yes then yes, b is yes then no, c is no then yes, and d is no then no. The diagonal cells never changed. Only b and c disagree across occasions, so only those discordant pairs can reveal a direction of change. Under marginal homogeneity, each discordant pair is equally likely to move either way. Conditional on b plus c, one direction follows a fair binomial distribution. When fewer than twenty-five pairs are discordant, Distri Scope uses the exact two-sided binomial result. It doubles the inclusive tail through the smaller count. At twenty-five discordant pairs or more, the page uses b minus c squared over b plus c, compared with chi square on one degree of freedom. That large-sample branch has no continuity correction. The report names which branch ran, so the calculation can be reproduced without guessing.
Pairing is the design, not a table decoration. Each row and column classification must come from the same person or one deliberately matched unit. Different pairs must remain independent. Households, clinics, or repeated pairs from one person require a model that represents that dependence. This procedure tests marginal change, not agreement. A large stable diagonal can coexist with asymmetric change, while poor agreement can still have symmetric directions. The discordant odds ratio is b divided by c. Values below one mean no-to-yes changes outnumber yes-to-no changes under this orientation. Reverse the occasions or the change labels and that ratio reciprocates. Keep the table orientation visible before interpreting its direction. If c equals zero, the page flags the ratio as undefined. It supplies no confidence interval, so a finite ratio still has unquantified precision. Without pairing, use an independent-group test. More occasions, more categories, clustered pairs, and agreement questions each need a different method.
Consider fifty patients measured before and after treatment. Twenty are yes both times, three move yes to no, nine move no to yes, and eighteen stay no. Thirty-eight pairs are concordant, but the directional evidence is the three-versus-nine discordant split. Their sum is twelve. Because twelve is below twenty-five, let X follow a binomial distribution with twelve trials and probability one half. The smaller count is three. The inclusive probability from zero through three is zero point zero seven two nine nine eight. Doubling it gives zero point one four five nine nine six. That exact p-value exceeds alpha point zero five, so fail to reject marginal homogeneity. The data do not establish unequal directions of change. The discordant odds ratio is three divided by nine, or zero point three three three. It describes the observed direction but does not rescue weak evidence. For contrast, twenty-five versus forty discordant pairs triggers the uncorrected chi-square branch. The statistic is three point four six two and p is about zero point zero six two eight.
The method switch is strict: twenty-four discordant pairs use exact binomial probabilities, while twenty-five use the uncorrected chi-square approximation. With no discordant pairs, the calculator stops. A perfectly stable diagonal contains no information about which change direction is more likely. Validate four nonnegative whole counts, at least one discordant pair, and alpha strictly between zero and one. Count pairs, not separate measurements. Specify the two occasions, positive category, direction labels, analysis rule, and alpha before looking at the split. Reversing labels afterward changes the claim. Route three or more occasions to a repeated binary method, larger square tables to a paired categorical method, and clustered pairs to dependence-aware modeling. Report all four cells, total pairs, b and c, selected branch, alpha, p-value, discordant odds ratio, design limits, and guarded conclusion. Map paired binary changes, inspect the discordant evidence, and run the matching calculator free at Distri Scope dot com.
How to read the result
Read the p-value as the probability of a discordant split at least as lopsided as the one observed if change were directionless. The concordant counts do not move it at all.
The discordant odds ratio b/c summarizes direction: values below one mean the second occasion gained relative to the first. With few discordant pairs it is unstable, and it is flagged as undefined when c = 0.
How to use the McNemar test calculator
Enter the four paired counts: both-yes (a), yes then no (b), no then yes (c), and both-no (d). Each pair of measurements on one unit contributes to exactly one cell.
Only b and c enter the statistic. The concordant cells a and d establish context and the total sample size, but units that never changed cannot inform a question about the direction of change.
The calculator refuses to run when b + c = 0, because with no changes at all the data contain no information about asymmetry, whatever the sample size.
Formula, hypotheses, and assumptions
Conditions to review
- Each pair of outcomes comes from the same subject or matched unit
- Pairs are independent of one another
- The question concerns marginal homogeneity, not agreement
Calculator parameters
- Yes → Yes (a): default 20.
- Yes → No (b): default 3.
- No → Yes (c): default 9.
- No → No (d): default 18.
- Significance Level (α): default 0.05.
What the method is doing
Under marginal homogeneity, each discordant pair is equally likely to change in either direction, so b follows a Binomial(b + c, 0.5) distribution. With fewer than 25 discordant pairs the calculator evaluates that binomial two-sidedly and exactly, avoiding a fragile approximation.
With 25 or more discordant pairs it uses χ² = (b − c)²/(b + c) with one degree of freedom, the uncorrected version; the report names the version used so results can be reproduced precisely elsewhere.
Worked example: symptom change after treatment
Fifty patients are classified for a symptom before and after treatment: a = 20 had it both times, b = 3 had it before but not after, c = 9 gained it, and d = 18 never had it. There are 12 discordant pairs, so the exact version runs at α = 0.05.
- 1Enter the four cells. The discordant pairs split 3 versus 9, and under the null each of the 12 would flip a fair coin for direction.
- 2The exact two-sided p-value doubles the tail probability of the smaller count: p = 2·P(X ≤ 3) for X ~ Binomial(12, 0.5), which is ≈ 0.146.
- 3Read the discordant odds ratio 3/9 ≈ 0.333, and note the report says the exact version was used because 12 < 25. For contrast, a large study with b = 25 and c = 40 would use χ² = (25−40)²/65 ≈ 3.46 with p ≈ 0.063.
Interpretation
A 3-to-9 split leans toward symptom gain, but among only twelve changed patients such an imbalance occurs about 15% of the time by chance, so the study does not establish an asymmetric change. The 38 concordant patients, however reassuringly stable, contribute nothing to this question; a longer follow-up that accumulates more discordant pairs is what would sharpen the answer.
Common mistakes
- Feeding an unpaired 2×2 table into McNemar, or a paired table into the independence chi-square, are mirror-image errors; the design determines the test.
- Reading a non-significant result as proof of no change overlooks that only the discordant pairs count; a study can be large overall yet nearly uninformative here.
- Confusing marginal change with agreement leads to contradictory write-ups; report kappa for agreement and McNemar for change, not one in place of the other.
Limits and independent validation
The calculator covers one binary outcome at two occasions with an uncorrected asymptotic version and an exact small-sample version; continuity corrections, Cochran’s Q for three or more occasions, and confidence intervals for the odds ratio are not provided.
Pairs must be independent of each other; households, clinics, or repeated pairs from the same person violate that and are not detectable from the table.
Before using the result
- Confirm that both measurements come from the same or deliberately matched units, that every pair appears in exactly one cell, and that the four counts sum to the number of pairs, not the number of measurements.
- Recompute the statistic by hand from b and c alone, and note which version, exact or chi-square, the report names so an independent package can be set to match it.
Related modules and resources
Explore Other Hypothesis Tests
- One Sample Z-Test Calculator
- One Sample T-Test Calculator
- Two Sample Z-Test Calculator
- Two Sample T-Test Calculator
- Paired T-Test Calculator
- One-Way ANOVA Calculator
- Two-Way ANOVA with Replication
- Chi-Square Test Calculator
- Chi-Square Goodness-of-Fit Test
- F-Test Calculator
- One-Proportion Z-Test
- Two-Proportion Z-Test
- Exact Binomial Test
- Fisher’s Exact Test
- McNemar Test
- Mann-Whitney U Test
- Wilcoxon Signed-Rank Test
- Sign Test
- Kruskal-Wallis Test
- Friedman Test
- Pearson Correlation Test
- Spearman Correlation Test
- Kendall Tau Test
- Levene Test
- Brown-Forsythe Test
- Welch ANOVA
- Repeated Measures ANOVA
- TOST Equivalence Test
- Power & Sample Size
- Confidence Interval Calculator
- Critical Value Lookup
See every option in the Statistical Hypothesis Test Calculator or review the DistriScope methodology. Educational information; last reviewed 2026-08-09. Verify consequential calculations independently.