Skip to main content
v2026.11,772 entries · CC-BY 4.0

McNemar’s Test: The Discordant-Cell Test for Paired Binary Data

A guide to McNemar’s test for paired binary outcomes: why a chi-square test of independence is the wrong tool for before/after and matched-pairs designs, the discordant-cell (b, c) logic, a worked 2×2 example, the continuity-corrected and exact-binomial versions, when to use Cochran’s Q or the Stuart-Maxwell test instead, and how to report the result.

Ask CASRAI · included with Regulatory Radar

Ask about McNemar’s Test: The Discordant-Cell Test for Paired Binary Data

Ask CASRAI answers research-administration questions about this guide and cites the passages behind every claim — and says so when the corpus does not cover something, instead of guessing. It comes with a Regulatory Radar subscription at $29 a month, alongside the daily digest of regulatory changes and the dashboard of what changed.

150 questions a day, on this site, over the API, or inside your own tools through the CASRAI MCP server.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Written and maintained by CASRAI Editorial Board

Last updated

If your data come from the same subjects measured twice on a yes/no outcome — before an intervention and after it, or two raters classifying the same cases — a standard chi-square test of independence is the wrong tool, even though the data still look like a 2×2 table. The chi-square test assumes every observation is independent; here, each subject contributes two correlated observations, not two independent ones. McNemar’s test is built specifically for this paired-binary design. It ignores the subjects who didn’t change and tests only the ones who did.

Why a Chi-Square Test Gets Paired Data Wrong

A standard chi-square test of independence is designed to compare two independent groups — smokers vs. non-smokers, treatment vs. control arm, each subject appearing in exactly one cell. Feed it a before/after or matched-pairs table instead, and it silently ignores the pairing: it treats the “before” count of 40 smokers and the “after” count of 30 smokers as if they came from 70 different people, when in reality some of the same people appear in both counts. That inflates the effective sample size the test thinks it has, and the reported p-value is generally too small — the test finds “significance” more often than it should.

The tell that you’re looking at a McNemar situation rather than a chi-square-of-independence situation: can you draw a straight line from each row in your “before” data to the matching row in your “after” data? If yes — same subject, same matched pair, same rater on the same case — you have paired data, and McNemar’s test, not the standard chi-square test, is the correct tool.

The Paired 2×2 Table: Concordant vs. Discordant Cells

A McNemar table looks like an ordinary 2×2 table, but the rows and columns mean something different from a standard contingency table. Instead of “Group A” and “Group B,” the rows and columns are the same subjects’ classification at Time 1 and at Time 2 (or Rater 1 and Rater 2):

After: Positive After: Negative
Before: Positive a (stayed positive) b (positive → negative)
Before: Negative c (negative → positive) d (stayed negative)

Cells a and d are the concordant pairs — subjects who gave the same answer both times. They carry no information about change and McNemar’s test does not use them at all. Cells b and c are the discordant pairs — subjects who switched category between the two measurements. McNemar’s test is entirely a comparison of b against c: if the true rate of switching is the same in both directions, b and c should be roughly equal; a real effect shows up as an imbalance between them.

The McNemar Test Statistic

The classic (large-sample) McNemar statistic is:

χ² = (b − c)² / (b + c), with 1 degree of freedom.

A continuity-corrected version is standard practice, particularly with smaller discordant counts:

χ² = (|b − c| − 1)² / (b + c)

Both versions use only the discordant cells. If b and c are equal, the statistic is exactly zero, no matter how large a and d are — a McNemar test genuinely cannot detect an effect from subjects who didn’t change.

Worked Example: A Before/After Design

Illustrative example, not a real study. Suppose 100 participants in a smoking-cessation program are classified as “smoker” or “non-smoker” immediately before the program starts and again three months later:

After: Smoker After: Non-smoker
Before: Smoker a = 25 b = 15
Before: Non-smoker c = 5 d = 55

A naive read of the marginal totals (40 smokers before, 30 smokers after) might look like “10 fewer smokers,” but that number alone can’t tell you whether the program actually changed anyone’s behavior in a systematic direction versus just balancing an equal amount of quitting and starting. The discordant cells settle it: b = 15 people quit (smoker → non-smoker) and c = 5 people started or relapsed (non-smoker → smoker). The concordant cells (a = 25 who kept smoking, d = 55 who stayed non-smokers) contribute nothing to the test.

Uncorrected statistic: χ² = (15 − 5)² / (15 + 5) = 100 / 20 = 5.00, df = 1, p ≈ .025.
Continuity-corrected statistic: χ² = (|15 − 5| − 1)² / 20 = 81 / 20 = 4.05, df = 1, p ≈ .044.

Both versions land below the conventional .05 threshold here: quitting (b) happened significantly more often than starting/relapsing (c) among the participants whose status actually changed. Note that both p-values move together only because the discordant counts (15 and 5) are large enough for the chi-square approximation to hold reasonably well — that stops being true with small counts, covered next.

The Exact (Binomial) Version, for Small Discordant Counts

The chi-square formula is a large-sample approximation. When the discordant total (b + c) is small — a commonly cited rule of thumb is fewer than 25 — that approximation gets unreliable, and the standard fix is the exact McNemar test: a two-sided exact binomial test of b against (b + c) trials under the null that each discordant pair is equally likely to switch in either direction (p = .5), equivalent to testing whether b ~ Binomial(b + c, 0.5).

The gap between the approximation and the exact test can matter in practice. Take a smaller matched-pairs study with only 10 discordant pairs: b = 2, c = 8.

  • Uncorrected chi-square: χ² = (2 − 8)² / 10 = 3.60, p ≈ .058 — just misses conventional significance.
  • Continuity-corrected chi-square: χ² = (|2 − 8| − 1)² / 10 = 2.50, p ≈ .114.
  • Exact two-sided binomial test (k = 2, n = 10, p = .5): p ≈ .109.

The three methods don’t agree, and the exact test and the continuity-corrected chi-square agree with each other far better than either agrees with the uncorrected formula — which is exactly why the uncorrected version is the wrong default once discordant counts get small. Most statistical software (R’s mcnemar.test() with correct = TRUE by default, or exact2x2 for the binomial version; SPSS’s McNemar option under paired-samples nonparametric tests; Stata’s mcc/mcci commands) will compute the exact version on request — check the discordant total before trusting the chi-square approximation’s p-value at face value.

When to Use McNemar’s Test — and When Not To

  • Use it when: the same subjects (or genuinely matched pairs) are classified on a binary/dichotomous outcome at two time points or under two conditions — before/after designs, crossover studies, two raters scoring the same cases, test-retest agreement on a yes/no criterion.
  • Use a standard chi-square test of independence instead when: the two groups being compared are made up of different, independent subjects — that’s the ordinary contingency-table case McNemar’s test is not needed for.
  • Use Cochran’s Q test instead when: there are more than two paired measurements of the same binary outcome (e.g., the same subjects assessed at three or more time points) — Cochran’s Q is the direct repeated-measures generalization of McNemar’s test.
  • Use the Stuart-Maxwell test instead when: the paired outcome has more than two categories (not just positive/negative) — it extends the same discordant-cell logic from a 2×2 table to an r×r table.
  • Use a paired t-test or the Wilcoxon signed-rank test instead when: the paired outcome is continuous rather than binary — McNemar’s test only applies to dichotomous outcomes.

Reporting the Result

A standard APA-style report states the statistic, degrees of freedom, sample size, and p-value, and should specify which version was used:

“McNemar’s test (continuity-corrected) indicated a significant change in smoking status following the intervention, χ²(1, N = 100) = 4.05, p = .044.”

When the exact binomial version was used instead, report it as an exact test rather than implying a chi-square approximation was run: “An exact McNemar test showed no significant difference in the discordant switching rates, p = .109.” It’s also worth reporting the discordant counts themselves (b and c) alongside the test statistic — they’re what the test is actually about, and they let a reader judge the direction and size of the change directly, not just whether it cleared a significance threshold.

Frequently Asked Questions

What is McNemar’s test used for?

Testing whether a binary (yes/no) outcome changed in a systematic direction between two paired measurements on the same subjects — most commonly a before/after design, but also matched case-control comparisons or inter-rater agreement on the same cases.

What’s the difference between McNemar’s test and a chi-square test?

A standard chi-square test of independence assumes every observation is independent and compares two separate groups. McNemar’s test is for paired/matched data — the same subjects measured twice — and uses only the discordant (changed) pairs; running the ordinary chi-square test on paired data ignores the pairing and generally overstates significance.

What are the discordant cells in McNemar’s test?

In the 2×2 paired table, the discordant cells (conventionally labeled b and c) are the subjects whose classification switched between the two measurements. The concordant cells (a and d) are subjects who gave the same answer both times; McNemar’s test does not use them.

When should I use the exact version of McNemar’s test instead of the chi-square approximation?

When the discordant total (b + c) is small — a common rule of thumb is fewer than 25. Below that, the chi-square approximation becomes unreliable and the exact binomial test (or at minimum the continuity-corrected chi-square) is the more defensible choice.

Can McNemar’s test be used for more than two categories or more than two time points?

Not directly. For more than two categories in a paired outcome, the Stuart-Maxwell test extends the same logic to an r×r table. For more than two repeated measurements of a binary outcome, Cochran’s Q test is the direct generalization.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →

Regulatory Radar

Stop finding out after the fact

$29/month, cancel anytime. Daily digest updates from our analysis, a dashboard holding the same items, and a cited assistant for everything they raise.

  • Federal Register, Federal Register+, Grants.gov, Regulations.gov, NSF News, UKRI, plus CASRAI’s own published content.
  • 44,322 indexed passages, and every answer cites the ones it drew on.