Test paired binary data with the McNemar χ² (asymptotic, Yates-corrected, exact binomial, and mid-p), the Newcombe 95% CI for the paired difference in proportions, conditional odds ratio, and Cohen's kappa. Includes the McNemar-Bowker symmetry test and Stuart-Maxwell marginal homogeneity test for k × k paired tables. Reproducible R, Python, and APA output.
Cells label the paired binary outcomes (Test 1 across rows, Test 2 across columns). b and c are the discordant cells; the test depends only on them.
a (concordant +)
b (1+ / 2−)
c (1− / 2+)
d (concordant −)
Risk difference (marginal change)
Conditional odds ratio
Agreement statistics
McNemar tests change; κ measures agreement. A high κ with a significant McNemar's test means the two raters/tests agree often but on a biased margin.
Quinn McNemar published his test for paired binary data in 1947 as a note in Psychometrika. The motivation was practical: psychologists running pre-post studies on the same participants needed a test of changed proportions that did not pretend the two measurements were independent. McNemar's insight was that the concordant pairs (both positive or both negative) carry no information about a change in the marginal proportions; only the discordant pairs do. Conditional on the number of discordant pairs, the count favouring the first measurement follows a Binomial(b + c, 0.5) distribution under the null hypothesis. From that single observation the asymptotic chi-square form (b − c)² / (b + c) follows immediately, and the exact binomial form follows directly from the conditional distribution.
Edwards (1948) proposed the continuity correction (|b − c| − 1)² / (b + c) to align the asymptotic chi-square with the exact binomial at small discordant counts. The Yates-Edwards correction was the default for half a century, but Monte-Carlo work by Fagerland, Lydersen and Laake (2013) showed it overshoots into conservatism. Modern practice is to use the uncorrected asymptotic test when b + c ≥ 25 and the exact binomial or its mid-p variant (Lancaster 1961; Hirji, Tan and Elashoff 1991) when b + c is smaller. The calculator reports all four p-values so you can match whichever convention your reviewer expects.
A McNemar p-value tells you that two paired proportions differ; it does not say by how much. Three effect sizes complete the picture. The conditional odds ratio is simply OR = b / c, with a log-Wald 95% CI from log(OR) ± 1.96 × √(1/b + 1/c). The paired risk difference is RD = (b − c)/N, and Newcombe (1998) Method 10 builds its 95% CI from the two Wilson score halves, the standard approach in clinical biostatistics. Cohen's kappa, also computed automatically, quantifies the test-retest or inter-rater agreement underlying the paired table. Together, an OR, an RD with Newcombe CI, and a κ give reviewers the full story behind the p-value.
When the paired classification is on more than two categories, the test generalises. Bowker (1948) extended McNemar to a full symmetry test of the k × k table on k(k − 1)/2 degrees of freedom. Stuart (1955) and Maxwell (1970) developed the marginal-homogeneity test on k − 1 degrees of freedom, which tests only whether the row and column marginals are equal (the weaker but usually more interesting hypothesis). The calculator implements both: Bowker for symmetry, Stuart-Maxwell for marginal homogeneity. For ordinal categories, Tango's (1998) test exploits the ordering and is more powerful; that extension lives in the statistical analysis service rather than this in-browser calculator.
The McNemar family sits inside the broader categorical-data surface. For independent 2 × 2 data, the matched-pairs design is replaced by the Fisher's exact test or the larger-sample chi-square test of independence. For an unpaired effect-size summary alongside, the odds ratio and relative risk calculators apply. For paired continuous outcomes, the paired t-test is the counterpart. And for a publication-ready APA paired-categorical section by a PhD statistician with the McNemar test, conditional OR, Newcombe paired-difference CI, and κ integrated into one results paragraph, the statistical analysis service handles it end-to-end.
McNemar 2 × 2 is the default for paired binary data; switch to McNemar-Bowker for full k × k symmetry or Stuart-Maxwell for marginal homogeneity.
For 2 × 2 enter a, b, c, d cells; for k × k modes paste the matrix with optional row/column header.
Asymptotic uncorrected χ² is the default; Yates-corrected, exact binomial, and mid-p are reported alongside for full transparency.
Conditional odds ratio with 95% log-Wald CI, paired risk difference with Newcombe Method 10 CI, and Cohen's kappa for paired agreement.
Bowker's symmetry test and the Stuart-Maxwell marginal homogeneity test extend McNemar to any number of paired categories.
Reproducible snippets paste into RStudio (stats::mcnemar.test, exact2x2::mcnemar.exact, irr::kappa2) or Jupyter (statsmodels.stats.contingency_tables.mcnemar), plus an APA sentence.
Next step
A PhD statistician adds exact and mid-p McNemar inference, conditional and unconditional odds ratios, Newcombe paired-difference CIs, McNemar-Bowker and Stuart-Maxwell for k × k tables, Tango's ordinal extension, GEE for clustered paired data, and a publication-ready APA results section.
Our promise: Free re-run and re-write if reviewers question the analysis or reporting.
Timeline
Most projects deliver in under 2 weeks. We confirm an exact date in your quote.
If reviewers push back
If reviewers question the analysis, assumptions, or reporting, we re-run and re-write free.
Confidentiality
NDA available on request before any project discussion. Your data, study design, and manuscript stay private either way.
Want a PhD methodologist to handle the whole project?
Get a complete paired-categorical workup with exact and mid-p McNemar tests, conditional and unconditional odds ratios, Newcombe paired-difference CIs, McNemar-Bowker and Stuart-Maxwell for k × k, Tango ordinal extensions, generalised estimating equations for clustered paired data, and APA-formatted reporting by a PhD statistician. Free re-run and re-write if reviewers question the analysis or reporting. Pay only after you approve your quote.
χ² = (b − c)² / (b + c), df = 1
Uncorrected chi-square form. Accurate when discordant pairs b + c ≥ 25. The paired analogue of the chi-square test of independence.
χ² = (|b − c| − 1)² / (b + c)
Edwards (1948) correction. Brings the asymptotic statistic closer to the exact binomial at small b + c. Now considered conservative; modern guidance prefers exact or mid-p.
p = 2 × min(P(X ≤ min(b,c)), P(X ≥ max(b,c)), 0.5) X ~ Binomial(b + c, 0.5)
Exact under the null. Always valid; recommended whenever b + c < 25.
p_mid = p_exact − 0.5 × P(X = b)
Lancaster (1961) mid-p halves the boundary probability. Less conservative than the exact test; closer to the nominal Type I error rate.
OR = b / c SE(log OR) = √(1/b + 1/c)
Maximum-likelihood estimate for the matched-pairs design. 95% CI = exp(log(OR) ± 1.96 × SE).
RD = (b − c) / N, CI built from Wilson score halves
Newcombe (1998) recommended interval for the paired difference in proportions; reported in clinical biostatistics journals.
χ² = Σ_{i<j} (nᵢⱼ − nⱼᵢ)² / (nᵢⱼ + nⱼᵢ), df = k(k − 1)/2
Bowker (1948) generalisation. Tests whether the full off-diagonal is symmetric.
χ² = d′ V⁻¹ d, df = k − 1
Stuart (1955) / Maxwell (1970). Tests only whether row and column marginals match, weaker but usually more interesting than full symmetry.
The McNemar test (Quinn McNemar, 1947) is a statistical test for paired binary data. It compares two related proportions, for example the same patients tested before and after an intervention, or the same images judged by two diagnostic tests. The test focuses on discordant pairs only (cases where the two measurements disagree), because concordant pairs carry no information about a change in proportions. The classical formula is χ² = (b − c)² / (b + c) on 1 degree of freedom, where b and c are the two off-diagonal counts of a 2 × 2 paired table. The McNemar test is the paired analogue of the chi-square test of independence and is required whenever the two samples are not independent.
Use McNemar when the two groups being compared are matched or repeated measurements on the same subjects. Examples: before-after exposure in the same patients, two diagnostic tests applied to the same case series, two raters classifying the same set of images, twin pairs where one twin is exposed. Use the ordinary chi-square test of independence only when the two samples are independent (e.g., cases versus controls drawn from different patients). Treating paired data as if it were independent inflates the Type I error rate because the standard chi-square ignores the within-pair correlation.
In a McNemar 2 × 2 table, the rows represent the first measurement and the columns represent the second measurement (or rater A and rater B). The four cells are: a = both positive, b = first positive and second negative, c = first negative and second positive, d = both negative. Cells a and d are the concordant pairs (the two measurements agree); cells b and c are the discordant pairs (the two measurements disagree). The McNemar test asks whether b and c differ from each other by more than chance; equivalently, whether the marginal probability of being positive has changed between the two measurements.
Edwards (1948) proposed the continuity correction χ² = (|b − c| − 1)² / (b + c) to bring the asymptotic chi-square closer to the exact binomial p-value when b + c is small. The correction was the default for decades. Modern guidance (Fagerland, Lydersen and Laake 2013) recommends the exact binomial or mid-p when b + c < 25 and the uncorrected asymptotic when b + c ≥ 25; the Yates correction is now seen as overly conservative. The calculator reports both the corrected and uncorrected statistics so you can match whichever convention your reviewer prefers.
The exact McNemar test computes a two-sided p-value directly from the binomial distribution Binomial(b + c, 0.5), with no asymptotic approximation. Conditional on the total number of discordant pairs (n = b + c), the count b follows a Binomial(n, 0.5) under the null hypothesis that the two marginal probabilities are equal. The exact p-value is 2 × min(P(X ≤ min(b, c)), P(X ≥ max(b, c)), 0.5). Use the exact test whenever b + c < 25 or when reporting in a clinical context where conservative inference is preferred. The calculator returns the exact two-sided p and one-sided p separately.
Lancaster (1961) and Hirji, Tan and Elashoff (1991) showed that the conservatism of the exact test can be reduced by subtracting half of the boundary-point probability before doubling; this is the mid-p adjustment. Mid-p = exact p − 0.5 × P(X = b). The mid-p value is between the exact and the asymptotic uncorrected value, and Monte-Carlo studies (Fagerland, Lydersen and Laake 2013) show that mid-p controls the Type I error rate at closer to the nominal level than either alternative. The calculator reports the asymptotic, exact, and mid-p p-values side by side.
When the paired measurement is on more than two categories, the McNemar test generalises to the McNemar-Bowker symmetry test (Bowker, 1948). It tests whether the entire off-diagonal of the k × k table is symmetric, that is, whether nᵢⱼ = nⱼᵢ for every pair i ≠ j. The statistic is χ² = Σᵢ<ⱼ (nᵢⱼ − nⱼᵢ)² / (nᵢⱼ + nⱼᵢ) on k(k − 1)/2 degrees of freedom. Use it for ordinal or nominal repeated-measures classifications (e.g., disease stage at baseline versus follow-up). Switch to Stuart-Maxwell if you only care about the marginal totals, not full symmetry.
The Stuart-Maxwell test (Stuart 1955; Maxwell 1970) tests marginal homogeneity in a k × k paired table, whether the row marginal proportions equal the column marginal proportions. Bowker tests the stronger hypothesis that the entire table is symmetric. If only the marginal counts shifted (e.g., the overall positive rate changed but the pattern of discordance is asymmetric), Bowker will reject but Stuart-Maxwell may not, and the marginal shift is usually what investigators care about. Stuart-Maxwell uses the (k − 1) × (k − 1) variance matrix of the marginal differences and has k − 1 degrees of freedom.
For a McNemar 2 × 2 table, the conditional odds ratio is simply OR = b / c, the ratio of the two discordant cell counts. This is the maximum-likelihood estimate of the conditional odds ratio in the matched pairs design. The asymptotic 95% CI uses log(OR) with SE = √(1/b + 1/c), giving exp(log(OR) ± 1.96 × SE). When either b or c is zero, the calculator adds 0.5 to each cell (Haldane-Anscombe continuity correction) before taking logs. Pair the OR with the absolute risk difference (Newcombe Method 10 paired CI) so reviewers see both a relative and an absolute effect.
APA example for a 2 × 2 McNemar: 'A McNemar test indicated that the proportion of patients reporting symptom relief increased significantly from baseline (62%) to follow-up (78%), χ²(1, N = 120) = 6.40, p = .011, with 32 discordant pairs (b = 24, c = 8). The conditional odds ratio was 3.00, 95% CI [1.35, 6.69], and the paired risk difference was 13.3%, 95% CI [4.8%, 21.6%] (Newcombe Method 10). Cohen's κ for test-retest agreement was 0.61, 95% CI [0.47, 0.74].' Always include N, b, c, both effect sizes, and the agreement statistic. McNemar tells you that things changed; the OR, RD, and κ tell you by how much.
For independent 2 × 2 categorical data, switch to the Fisher's exact test calculator (small samples) or the chi-square test of independence (larger samples). For matched-pairs agreement instead of change detection, see the Cohen's kappa calculator. For paired binary effect sizes alongside the p-value, the odds ratio calculator and the relative risk calculator cover the unpaired counterparts. For paired diagnostic-accuracy comparisons, see the diagnostic accuracy calculator. For sample-size planning on a McNemar test, see the sample size calculator.
Reviewed by
Dr. Sarah Mitchell holds a PhD in Biostatistics from Johns Hopkins Bloomberg School of Public Health and has over 15 years of experience in systematic review methodology and meta-analysis. She has authored or co-authored 40+ peer-reviewed publications in journals including the Journal of Clinical Epidemiology, BMC Medical Research Methodology, and Research Synthesis Methods. A former Cochrane Review Group statistician and current editorial board member of Systematic Reviews, Dr. Mitchell has supervised 200+ evidence synthesis projects across clinical medicine, public health, and social sciences. She reviews all Research Gold tools to ensure statistical accuracy and compliance with Cochrane Handbook and PRISMA 2020 standards.
From data cleaning and assumption checks to the full analysis and a publication-ready results section, we handle the numbers so you can focus on the science.
Our promise: Free re-run and re-write if reviewers question the analysis or reporting.
Your project is led by a named PhD methodologist with real credentials and published work.
4.9 / 5 across 1,194+ delivered projects