Hypothesis Testing Categorical Data Paired Proportions 24 min read July 18, 2026
BY: Statistics Fundamentals Team
Reviewed By: Minsa A (Senior Statistics Editor)

McNemar's Test: Comparing Paired Proportions

A physician tests two diagnostic methods on the same 80 patients and wants to know whether the methods agree at different rates. A researcher surveys 120 voters before and after a debate to see whether opinion on a policy shifted. A clinical trial records treatment response in matched pairs. All three need McNemar's Test — the go-to procedure for comparing two proportions from the same subjects.

This guide explains what McNemar's Test is, when to use it, how to calculate the test statistic by hand, when to switch to the exact version, how to run it in R, Python, and SPSS, and how to write up results in APA format. Three fully worked examples walk through the arithmetic step by step.

What You'll Learn
  • ✓ The definition of McNemar's Test and what discordant pairs are
  • ✓ The formula and 5-step calculation procedure
  • ✓ How to read a 2×2 contingency table correctly
  • ✓ Three worked examples from healthcare, social science, and marketing
  • ✓ Exact McNemar's Test and the continuity correction
  • ✓ How McNemar's Test compares to the Chi-Square Test, Fisher's Exact Test, and Cochran's Q
  • ✓ Code examples in R, Python (SciPy), and SPSS
  • ✓ APA-format reporting and a live calculator

What Is McNemar's Test? (Definition)

Definition — McNemar's Test
McNemar's Test is a non-parametric statistical test for comparing two paired proportions measured from the same subjects under two conditions or at two time points. It tests whether the marginal proportions of a binary outcome are equal by focusing exclusively on the subjects whose outcome changed — the discordant pairs.
H₀: P(b) = P(c)  |  χ² = (b − c)² / (b + c)

Quinn McNemar introduced the test in 1947 in the journal Psychometrika. Its core insight is economical: if you want to know whether a treatment shifted outcomes, subjects who stayed positive throughout (cell a) or stayed negative throughout (cell d) give you no information about the direction or magnitude of change. Only the subjects who switched tell the story — those who went from positive to negative (cell b) and those who went from negative to positive (cell c).

The test asks a straightforward question: under the null hypothesis, should we expect roughly equal numbers of each switching direction? If b and c are close, there is no net shift. If one far exceeds the other, the proportions changed. The test statistic measures how asymmetric that split is, relative to sampling variability.

1947
Year Quinn McNemar published the test in Psychometrika
b + c
Discordant pairs only — what the statistic is built from
χ²(1)
Degrees of freedom for the asymptotic version
< 10
Use exact test when b + c falls below this threshold
📌
Featured Snippet — One-Paragraph Definition

McNemar's Test is a non-parametric statistical test for paired binary data. It compares two proportions from the same subjects measured twice — before and after a treatment, under two diagnostic methods, or in a matched-pairs design. The test statistic χ² = (b − c)² / (b + c) is calculated from the discordant cells of a 2×2 contingency table, where b and c count subjects who changed outcome in each direction. A significant result means the probability of changing one way differs from the probability of changing the other way, indicating a real shift in the population proportion.

The 2×2 Contingency Table

McNemar's Test operates on a 2×2 contingency table where the rows represent the outcome under Condition 1 (or Time 1) and the columns represent the outcome under Condition 2 (or Time 2). Every subject contributes one cell to this table based on their pair of outcomes.

Condition 2 (or Time 2) Row Total
Condition 1 (or Time 1) Positive (+) Negative (−)
Positive (+) a b a + b
Negative (−) c d c + d
Column Total a + c b + d n

Reading the four cells:

  • Cell a (blue): Subjects positive under both conditions — concordant pair. Ignored by the test.
  • Cell b (yellow): Subjects positive under Condition 1 but negative under Condition 2. These are discordant — they changed from + to −.
  • Cell c (pink): Subjects negative under Condition 1 but positive under Condition 2. These changed from − to +.
  • Cell d (green): Subjects negative under both conditions — concordant pair. Also ignored.
⚠️
Why concordant pairs are excluded

Cells a and d do not change between conditions. They carry no information about whether Condition 1 or Condition 2 produces a higher positive rate. Only subjects who switched (b and c) can reveal whether one condition genuinely differs from the other in terms of its proportion of positive outcomes.

Assumptions of McNemar's Test

McNemar's Test has four assumptions. Checking them before running the test prevents misapplication and misleading conclusions.

🔗

1. Paired observations (within-subjects design)

Each subject contributes exactly two observations — one per condition or time point. The pairs must be linked: the same patient tested with two diagnostic methods, the same voter surveyed before and after a debate, the same product rated by the same reviewer twice. If the two groups are independent, use the Chi-Square Test instead.

2. Binary (dichotomous) outcome variable

The response variable must have exactly two categories — yes/no, positive/negative, pass/fail, agree/disagree. For outcomes with three or more ordered categories assessed across two conditions, use the McNemar-Bowker Test (a generalization). For more than two time points or conditions, consider Cochran's Q Test.

👤

3. One pair per subject

Each subject appears in exactly one cell of the 2×2 table. Subjects cannot appear in multiple rows or contribute data to more than two conditions (if they do, the data structure is no longer a 2×2 McNemar table).

📊

4. Sufficient discordant pairs (b + c ≥ 10 for the asymptotic test)

The chi-square approximation becomes unreliable when b + c < 10. In that case, switch to the exact McNemar's Test, which uses the binomial distribution directly. This threshold is widely cited in biostatistics textbooks, including Alan Agresti's Categorical Data Analysis.

McNemar's Test Formula

Standard (Asymptotic) Formula

McNemar's Test Statistic — Asymptotic Version
χ² = (b − c)² / (b + c)
with 1 degree of freedom
Critical value at α = 0.05: χ²(1) = 3.841
b = cell b: changed from + to − c = cell c: changed from − to + b + c = total discordant pairs df = 1 = degrees of freedom

The formula squares the difference between b and c to make it positive, then divides by the total number of discordant pairs to scale the result. When b and c are equal, the numerator is zero — no evidence of a net shift. As the imbalance between b and c grows, the test statistic grows, eventually exceeding the critical value.

Edwards's Continuity-Corrected Formula

McNemar's Test — Yates/Edwards Continuity Correction
χ² = (|b − c| − 1)² / (b + c)
Subtract 1 from the absolute difference before squaring
Use when b + c is small (10–25) Makes the test more conservative Reduces Type I error rate

Exact McNemar's Test

Exact McNemar's Test — Binomial Approach
b ~ Binomial(n = b + c, p = 0.5) under H₀
Use when b + c < 10
p-value = 2 × P(X ≤ min(b, c))
No chi-square approximation needed X = min(b, c) observed P from Binomial(b+c, 0.5)

Under H₀, if the total number of switchers is n = b + c, then each switcher is equally likely to go in either direction (probability 0.5 each). Cell b follows a Binomial(n, 0.5) distribution. The exact p-value is twice the probability of observing a value as extreme as or more extreme than the smaller of b and c.

Formula references: McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2), 153–157. doi:10.1007/BF02295996 — Available via Springer.

How to Perform McNemar's Test: 5 Steps

1

State the hypotheses

H₀: The marginal proportions are equal — P(Condition 1 positive) = P(Condition 2 positive). Equivalently, the number of + → − changes equals the number of − → + changes in the population (b = c). H₁: The marginal proportions differ (two-tailed) or one exceeds the other (one-tailed). Most applied work uses the two-tailed version.

2

Construct the 2×2 contingency table

Tally each subject's pair of outcomes into cells a, b, c, d. Confirm that each subject appears exactly once. Record b (+ to −) and c (− to +) separately — they are the discordant pairs that drive the test. Verify b + c ≥ 10 before proceeding with the asymptotic formula; otherwise use the exact test.

3

Calculate the test statistic

Apply χ² = (b − c)² / (b + c). If b + c is between 10 and 25 and you prefer a conservative approach, use Edwards's continuity-corrected version: χ² = (|b − c| − 1)² / (b + c). The result follows a chi-square distribution with 1 degree of freedom under H₀.

4

Find the p-value

Compare your χ² value to the critical value from the chi-square table with df = 1. At α = 0.05, the critical value is 3.841. Alternatively, read the exact p-value from software. If using the exact method, compute the two-tailed binomial p-value directly.

5

State the conclusion

If p < α: reject H₀ and conclude that the two marginal proportions differ statistically. If p ≥ α: fail to reject H₀ — the data do not provide sufficient evidence of a net shift. Report the test statistic, degrees of freedom, sample size, p-value, and direction of the observed difference (which of b or c was larger).

Worked Examples

Example 1 — Diagnostic Test Comparison (Healthcare)

Worked Example 1 — Diagnostic Accuracy

Problem: A hospital evaluates two screening tests for a disease. Both tests are applied to the same 100 patients. Test A classifies 62 patients as positive. Test B classifies 55 as positive. The 2×2 breakdown by paired results is shown below. At α = 0.05, do the two screening tests differ in their positive rate?

Test B Total
Test A Positive Negative
Positive 50 (a) 12 (b) 62
Negative 5 (c) 33 (d) 38
Total 55 45 100
1

Hypotheses: H₀: The positive rates of Test A and Test B are equal in the population (b = c). H₁: The positive rates differ (two-tailed).

2

Identify discordant pairs: b = 12 (positive on Test A, negative on Test B). c = 5 (negative on Test A, positive on Test B). Total discordant pairs = b + c = 17. Since 17 ≥ 10, the asymptotic formula is appropriate.

3

Calculate the test statistic:
χ² = (b − c)² / (b + c) = (12 − 5)² / (12 + 5) = 49 / 17 = 2.882

4

Find p-value: χ²(1) = 2.882. The critical value at α = 0.05 with df = 1 is 3.841. Since 2.882 < 3.841, p > 0.05 (exact p ≈ 0.090).

5

Decision: Fail to reject H₀. Although Test A gave 7 more positive results than Test B (62 vs. 55), the difference in discordant pairs is not statistically significant at the 5% level.

✅ Conclusion: There is insufficient evidence at α = 0.05 to conclude that the two screening tests differ in their population positive rate, χ²(1, N = 100) = 2.88, p = .090. A larger sample may be needed to detect this magnitude of difference.

Example 2 — Before-and-After Survey (Social Science)

Worked Example 2 — Opinion Change Study

Problem: Researchers survey 200 registered voters on their support for a policy before and after a public information campaign. The table below shows their responses. Did the campaign produce a statistically significant change in support at α = 0.01?

After Campaign Total
Before Campaign Support Oppose
Support 85 (a) 15 (b) 100
Oppose 45 (c) 55 (d) 100
Total 130 70 200
1

Hypotheses: H₀: The proportion supporting the policy before the campaign equals the proportion supporting it after (b = c in the population). H₁: The proportions differ (two-tailed).

2

Discordant pairs: b = 15 (switched from support to oppose). c = 45 (switched from oppose to support). b + c = 60. Net change: 45 − 15 = 30 more people moved toward support than away from it.

3

Test statistic:
χ² = (b − c)² / (b + c) = (15 − 45)² / 60 = (−30)² / 60 = 900 / 60 = 15.00

4

p-value: χ²(1) = 15.00. The critical value at α = 0.01 with df = 1 is 6.635. Since 15.00 > 6.635, p < 0.001.

5

Decision: Reject H₀. The campaign shifted voter support — many more people moved from oppose to support (c = 45) than from support to oppose (b = 15).

✅ Conclusion: Support for the policy changed significantly following the campaign, χ²(1, N = 200) = 15.00, p < .001. Support increased from 50% (100/200) before the campaign to 65% (130/200) after, with 45 opponents converting to supporters compared to 15 supporters reversing their position.

Example 3 — Exact McNemar's Test (Small Sample)

Worked Example 3 — Exact McNemar's Test

Problem: A pilot study tests a new drug in 20 patients with a matched design. Each patient is rated for symptom improvement (Yes/No) before and after the drug. Only 8 patients changed their response. Is there evidence the drug changed response rates? (b = 2, c = 6, b + c = 8 < 10 → use exact test.)

After Drug Total
Before Drug Improved Not Improved
Improved 5 (a) 2 (b) 7
Not Improved 6 (c) 7 (d) 13
Total 11 9 20
⚠️
Switch to exact test

b + c = 2 + 6 = 8 < 10. The chi-square approximation is unreliable here. Use the exact binomial test instead.

1

Hypotheses: H₀: p = 0.5 (under H₀, discordant pairs split 50/50). H₁: p ≠ 0.5.

2

Set up binomial: Under H₀, b ~ Binomial(n = 8, p = 0.5). We observed b = 2 (the smaller discordant count; c = 6 is the larger).

3

Exact p-value calculation:
p-value (two-tailed) = 2 × P(X ≤ 2) where X ~ Binomial(8, 0.5)
P(X=0) = C(8,0)(0.5⁸) = 1/256 ≈ 0.0039
P(X=1) = C(8,1)(0.5⁸) = 8/256 ≈ 0.0313
P(X=2) = C(8,2)(0.5⁸) = 28/256 ≈ 0.1094
P(X≤2) = (1+8+28)/256 = 37/256 ≈ 0.1445
Two-tailed p = 2 × 0.1445 = 0.289

4

Decision: p = 0.289 > α = 0.05. Fail to reject H₀. With only 8 discordant pairs, the sample size is too small to reliably detect even a substantial imbalance.

✅ Conclusion: Using the exact McNemar's Test, there is insufficient evidence to conclude that the drug changed response rates in the population, exact p = .289 (two-tailed). The pilot study should be used to estimate sample size for a larger confirmatory trial.

McNemar's Test vs. Similar Tests

Choosing the right test depends on your study design, number of groups, and data type. The table below shows when each test applies versus McNemar's.

Feature McNemar's Test Chi-Square Test Fisher's Exact Test Cochran's Q Test
Study design Paired (within-subjects) Independent groups Independent groups Paired (within-subjects)
Outcome type Binary Categorical (any) Binary Binary
Number of groups 2 conditions 2 or more 2 groups 3 or more conditions
Sample size requirement b + c ≥ 10 (or use exact) Expected cell ≥ 5 Any (exact) Larger samples preferred
Handles small samples ✓ (exact version)
Accounts for pairing
Common application Before/after, matched pairs, diagnostic accuracy Survey responses, frequencies by group Small-sample 2×2 tables Crossover trials, repeated measures

McNemar's Test vs. Chi-Square Test: The Critical Distinction

The most common mistake in analyzing paired binary data is applying the Pearson Chi-Square Test instead of McNemar's Test. These two tests answer different questions:

🚫
Do not use Chi-Square on paired data

Using the Pearson Chi-Square Test on paired binary data treats subjects as independent when they are not. This violates the independence assumption and produces an inflated Type I error rate — meaning you will find "significant" results far more often than your chosen α warrants. If the same subjects were measured twice, use McNemar's Test.

The Chi-Square Test compares the observed and expected frequencies across all four cells of the 2×2 table. McNemar's Test discards cells a and d entirely, focusing only on the b and c cells. The two tests can give dramatically different conclusions on the same data, and McNemar's is always correct for the paired design.

When to Use McNemar's Test: Decision Guide

Which Test for Categorical Paired Data?

Is your outcome variable binary (two categories)?
→ No
Consider ordinal tests or McNemar-Bowker (3+ ordered categories)
Are the same subjects measured under two conditions or at two time points?
→ No
Use Chi-Square Test or Fisher's Exact Test (independent groups)
Are there only 2 conditions (not 3 or more)?
→ No
Use Cochran's Q Test (3+ paired binary conditions)
Is b + c ≥ 10?
→ No
Use Exact McNemar's Test (binomial method)
All conditions met ✓
✅ Use McNemar's Test: χ² = (b − c)² / (b + c)

Real-World Applications

🏥

Diagnostic Test Comparison

Evaluate whether two diagnostic tests applied to the same patients differ in their positive detection rates. A standard use case in clinical epidemiology.

💊

Treatment Efficacy

Measure whether a drug or intervention shifts patient status from negative to positive (or from disease to remission) more than it shifts in the opposite direction.

🗳️

Public Opinion Surveys

Test whether a policy debate, advertisement, or information campaign changed voter or consumer preferences among the same panel of respondents.

📚

Educational Research

Determine whether students' pass/fail status on a topic changed after a teaching intervention by comparing pre-test and post-test outcomes within the same student group.

🧬

Genetic Concordance Studies

Compare genetic test results from two methods or labs applied to the same biological samples to detect systematic disagreement in classification.

📈

A/B Testing (Marketing)

In crossover designs where the same users experience both versions of a product or webpage, McNemar's Test compares conversion rates between versions.

🔬

Vaccine and Screening Studies

Compare seroconversion or screening positivity rates in matched pairs from vaccine trials, including case-control studies with matched subjects.

⚖️

Inter-Rater Agreement Research

Two raters classify the same items on a binary scale. McNemar's Test checks whether the rates of disagreement are symmetric — a different question from Cohen's Kappa.

Case Study

Vaccine Effectiveness: Matched Serology Study

In a matched cohort study, 150 pairs of vaccinated and unvaccinated individuals are tested for antibody presence (positive/negative). Cell a = 95 (both positive), b = 30 (vaccinated positive, unvaccinated negative), c = 10 (vaccinated negative, unvaccinated positive), d = 15 (both negative).

χ² = (30 − 10)² / (30 + 10) = 400 / 40 = 10.00, p = 0.0016. This is a statistically significant difference — the vaccinated group tested positive at a higher rate than the matched unvaccinated group, confirming a seropositivity advantage.

McNemar's Test in R, Python, and SPSS

# McNemar's Test in R
# Construct the 2x2 contingency table
# Rows = Condition 1, Columns = Condition 2

table_data <- matrix(
  c(85, 15, 45, 55),   # a, b, c, d
  nrow = 2,
  dimnames = list(
    "Before" = c("Support", "Oppose"),
    "After"  = c("Support", "Oppose")
  )
)

# Run McNemar's Test (with continuity correction by default)
mcnemar.test(table_data)

# Without continuity correction
mcnemar.test(table_data, correct = FALSE)

# Exact McNemar's Test (for small samples, b+c < 10)
# install.packages("exact2x2")
library(exact2x2)
mcnemar.exact(table_data)
# McNemar's Test in Python using SciPy
from scipy.stats import chi2
import numpy as np

# Cell counts: a=85, b=15, c=45, d=55
b = 15
c = 45

# Standard McNemar statistic (no continuity correction)
chi2_stat = (b - c)**2 / (b + c)
p_value = 1 - chi2.cdf(chi2_stat, df=1)

print(f"χ² = {chi2_stat:.4f}")
print(f"p-value = {p_value:.4f}")

# With continuity correction (Edwards's formula)
chi2_cc = (abs(b - c) - 1)**2 / (b + c)
p_cc = 1 - chi2.cdf(chi2_cc, df=1)
print(f"χ² (corrected) = {chi2_cc:.4f}, p = {p_cc:.4f}")

# Exact McNemar's Test via statsmodels
from statsmodels.stats.contingency_tables import mcnemar
import numpy as np

table = np.array([[85, 15], [45, 55]])
result = mcnemar(table, exact=True)  # exact=False for asymptotic
print(result)
* McNemar's Test in SPSS via menus:
* Analyze → Descriptive Statistics → Crosstabs
* Move Condition1 to Row, Condition2 to Column
* Click "Statistics" → check "McNemar"
* Click Continue → OK

* SPSS crosstabs syntax for McNemar's Test:
CROSSTABS
  /TABLES = Condition1 BY Condition2
  /FORMAT = AVALUE TABLES
  /STATISTICS = MCNEMAR
  /CELLS = COUNT
  /COUNT ROUND CELL.

* Output: SPSS labels the test "McNemar Test"
* and reports p-value under "Exact Sig. (2-tailed)"
Manual calculation in Excel:

Step 1: Enter b and c in cells B1 and C1
  B1 = 15   (b: switched from + to −)
  C1 = 45   (c: switched from − to +)

Step 2: Chi-square statistic (no correction)
  D1 = (B1-C1)^2 / (B1+C1)
  Result: 15.00

Step 3: p-value using CHISQ.DIST.RT()
  E1 = CHISQ.DIST.RT(D1, 1)
  Result: 0.000108

Step 4: With continuity correction
  F1 = (ABS(B1-C1)-1)^2 / (B1+C1)
  G1 = CHISQ.DIST.RT(F1, 1)

Note: Excel has no built-in McNemar function.
Use the formula approach above for manual work.

How to Report McNemar's Test in APA Format

APA 7th Edition Reporting Template
McNemar's test indicated a statistically significant change in [outcome], χ²(1, N = [total n]) = [χ² value], p = [p-value]. The proportion of [positive outcome] increased from [Time 1 proportion] to [Time 2 proportion], with [c value] participants changing from [negative to positive] compared to [b value] participants who changed from [positive to negative].

Applied APA Example (from Example 2)

Completed APA Report
McNemar's test indicated a statistically significant change in voter support for the policy following the information campaign, χ²(1, N = 200) = 15.00, p < .001. The proportion of voters supporting the policy increased from 50% before the campaign to 65% after, with 45 participants shifting from opposition to support compared to 15 who shifted from support to opposition.
APA reporting checklist

Include: (1) test name and formula type (standard or exact), (2) degrees of freedom df = 1, (3) total N, (4) χ² test statistic rounded to 2 decimal places, (5) exact p-value (or p < .001 if very small), (6) direction and magnitude of the observed change, and (7) the contingency table as a Table in the manuscript.

McNemar's Test Quick Reference

Term Definition / Value
Test purposeCompare two paired proportions from the same subjects with binary outcomes
Null hypothesisH₀: p_b = p_c (the probability of + → − equals the probability of − → +)
Alternative hypothesisH₁: p_b ≠ p_c (two-tailed) or directional (one-tailed, rare)
Test statistic formulaχ² = (b − c)² / (b + c), df = 1
With continuity correctionχ² = (|b − c| − 1)² / (b + c)
Exact versionb ~ Binomial(b + c, 0.5); p = 2 × P(X ≤ min(b, c))
Critical value (α = 0.05)χ²(1) = 3.841
Critical value (α = 0.01)χ²(1) = 6.635
Critical value (α = 0.001)χ²(1) = 10.828
When to use exact testb + c < 10
Discordant pairsSubjects who changed outcome: b (+ → −) and c (− → +)
Concordant pairsSubjects who did not change: a (+ to +) and d (− to −). Not used in the test.
Effect size (odds ratio)OR = c / b (ratio of the two types of discordant pairs)
R functionmcnemar.test(table)
Python (statsmodels)mcnemar(table, exact=False)
SPSS menuAnalyze → Crosstabs → Statistics → McNemar
Named afterQuinn McNemar, American psychologist and statistician (1900–1986)

Common Mistakes and Misconceptions

Misconception Wrong Thinking Correct Approach
Using Chi-Square on paired data My data is in a 2×2 table, so Chi-Square works If the same subjects were measured twice, use McNemar's Test — paired structure requires a paired test
Ignoring the exact test Chi-square approximation is always fine When b + c < 10, the chi-square approximation breaks down; use the exact binomial version
Including concordant pairs All four cells should factor into the calculation Cells a and d (subjects who did not change) contribute zero information about directional change and are deliberately excluded
Interpreting significance as a large effect p < 0.05 means a large or important difference Statistical significance depends on sample size. Report the odds ratio (c/b) alongside the p-value to convey effect magnitude
Using McNemar's for 3+ time points I can run McNemar's between each pair of time points For three or more repeated binary measures, use Cochran's Q Test to maintain the family-wise error rate
Treating b and c as row/column marginals b is the total positives at Time 2 b is the count of subjects who switched from + (Time 1) to − (Time 2). It is one off-diagonal cell, not a marginal total

McNemar's Test Calculator

McNemar's Test Calculator

Enter the four cell counts from your 2×2 contingency table. The calculator shows the asymptotic test statistic and p-value; if b + c < 10 it will alert you to use the exact test.

Frequently Asked Questions

McNemar's Test compares two proportions from the same subjects measured under two conditions. It uses only the discordant pairs (subjects whose responses changed) and tests whether significantly more subjects changed in one direction than the other. The test statistic is χ² = (b − c)² / (b + c), which follows a chi-square distribution with 1 degree of freedom.
Yes, although the two-tailed version is reported in most research studies. A one-tailed McNemar's Test is appropriate only when a directional hypothesis is specified before collecting the data. For the exact binomial version, the one-tailed p-value is obtained by calculating the probability of observing the predicted direction of change or something more extreme.
The most commonly reported effect size is the odds ratio, calculated as OR = c / b. An odds ratio greater than 1 indicates that more participants changed from the negative category to the positive category than vice versa. Researchers may also report the absolute change in the marginal proportions as an easily interpreted measure of practical significance.
The McNemar-Bowker Test, also called the Bowker Test of Symmetry, extends McNemar's Test to square contingency tables larger than 2 × 2. It is used when paired categorical outcomes have more than two categories and tests whether the table is symmetric across the main diagonal.
McNemar's Test is the binary-data counterpart of the paired t-test. Both analyze paired observations collected from the same subjects under two conditions. The paired t-test is used for continuous outcomes, whereas McNemar's Test is designed for binary outcomes. Converting continuous data into binary categories before analysis generally reduces statistical power.
The required sample size depends on the expected proportion of discordant pairs, the anticipated effect size, the significance level, and the desired statistical power. A common guideline is to have at least b + c ≥ 25 discordant pairs for reliable large-sample inference. Formal power analysis provides a more accurate sample size estimate for a specific study.

References and Further Reading

The following primary sources and reference texts support the methods described on this page.

McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2), 153–157. doi:10.1007/BF02295996 — Original paper introducing the test.
Agresti, A. (2013). Categorical Data Analysis (3rd ed.). Wiley. ISBN 978-0-470-46363-5 — Chapter 10 covers McNemar's Test and its generalizations, including the McNemar-Bowker extension. Available from Wiley.
Fleiss, J. L., Levin, B., & Paik, M. C. (2003). Statistical Methods for Rates and Proportions (3rd ed.). Wiley. — Covers exact McNemar methods and power calculations for paired proportions.
Altman, D. G. (1991). Practical Statistics for Medical Research. Chapman & Hall/CRC. — Chapter 10 includes McNemar's Test in the context of diagnostic research. BMJ Statistics Square One provides an accessible online companion.
NIST/SEMATECH e-Handbook of Statistical Methods. Section 7.4: Contingency Table Analysis. Available at https://www.itl.nist.gov/div898/handbook/.
R Core Team (2024). mcnemar.test {stats}. R documentation. rdocumentation.org.
SciPy documentation: statsmodels.stats.contingency_tables.mcnemar. statsmodels.org.