Ask Mallard
Analysis method

McNemar’s test

4 min read

McNemar’s test compares paired binary outcomes by counting pairs that change in opposite directions.

Fit

When to use it, and when not to

Use it when

  • Each person has two binary outcomes, or observations form prespecified matched pairs.
  • You ask whether the two marginal probabilities are equal.

Not when

Before you start

What you need

Decide these first
  1. Counts for all four paired outcome combinationsLabel both time points or conditions. Distinguish the two discordant directions.
  2. The test variant chosen in advanceExact conditional, asymptotic and mid-p versions have different small-sample properties.
  3. The number and reasons for incomplete pairsMissing pairs may differ from complete pairs. State the missing-data assumption.
It rests on these
  1. Separate pairs are independent.How to check: Shared wards or several pairs from one person require a more suitable model.
  2. Each paired outcome has the same two defined categories.How to check: Use consistent thresholds at both measurements.
  3. Under the null, the two discordant directions are equally likely.How to check: Conditioning on the discordant total gives an exact binomial test with probability one half.

Plain language

How it works

Arrange each pair by its two outcomes. Concordant pairs have the same outcome both times; discordant pairs change. The null gives the two discordant directions equal probability. The exact conditional variant uses a binomial distribution for their split.

What the sources show

Fagerland and colleagues compare test variants and paired-proportion intervals. Exact conditional p-values can be conservative. Report the chosen variant and a paired effect estimate with an interval; do not substitute independent-proportion intervals.

The method at a glance
McNemar’s test: Complete binary pairs. Then Two discordant directions only. Then Conditional binomial comparison.McNemar’s testComplete binary pairsTwo discordant directionsonlyConditional binomialcomparison
Conceptual diagram. It shows the structure of the idea, not data from any study.

Worked example

A worked example

Invented for illustration
Setting
A clinic records a binary symptom before and after care in 100 complete pairs.
Question
Did the marginal symptom probability change?
Approach
Both positive: 30; positive to negative: 17; negative to positive: 3; both negative: 50.
Result
There are 20 discordant pairs. The exact conditional two-sided p = 0.002577. Symptom counts change from 47 to 33, a difference of -14 per 100.
What it means
This is evidence of marginal change, not proof the care caused it. The exact conditional test can be conservative.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

McNemar’s test uses discordant pairs. It tests marginal change, not agreement or causation; independent-group chi-square and Fisher tests discard the pairing.

  • Using all pairs as the binomial denominator.Instead: Only the two discordant cells determine the McNemar test statistic.
  • Treating a nonsignificant result as proof of agreement.Instead: Equal marginal rates can coexist with many discordant pairs.

Inside Mallard

How Mallard uses this

Mallard has no dedicated McNemar calculator. The method registry links this method to its published analysis article and code.

Code example in Mallard: McNemar's test for a paired binary outcome (mcnemar-paired-binary).
Atlas node analysis.mcnemar, the id a plan cue records.
Code for this method
Loading…

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. The McNemar test for binary matched-pairs data: mid-p and asymptotic are better than exact conditional (opens in a new tab) · BMC Med Res Methodol · doi 10.1186/1471-2288-13-91
  2. Recommended tests and confidence intervals for paired binomial proportions (opens in a new tab) · Stat Med · doi 10.1002/sim.6148
Prepared with AI assistance. Source records verified by PMID, title, authors, year and DOI on 2026-11-06. No independent professional approval is claimed. Both primary methodological studies evaluate paired binary inference. The worked example deliberately uses the exact conditional variant, while the sources explain its conservatism.
Last source review: 2026-11-06
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.