Durgical
EN
Open the app

McNemar test

  • Statistical test

It compares two proportions measured in the same people (before and after) or in matched pairs. Only the pairs that change count.

Updated

What it is

The McNemar test compares paired proportions: the same binary outcome measured twice in the same people, two diagnostic tests applied to the same patients, or matched cases and controls. Pairs that agree (yes-yes, no-no) say nothing about change; the test uses only the discordant pairs and compares how many change one way against the other.

When to use it

  • A binary outcome measured twice in the same people (before and after).
  • Two diagnostic tests applied to the same patients.
  • One-to-one matched case-control studies.

Worked example

  1. Data: 100 smokers receive counselling; smoking is recorded before and 6 months later.
  2. 50 still smoke; 20 quit (b); 5 started or went back to smoking (c); 25 did not smoke at either time.
  3. The 50 + 25 = 75 concordant pairs are not used in the test.
  4. χ² = (20 − 5)² / (20 + 5) = 225 / 25 = 9.0 with 1 df.
  5. It exceeds 3.84; p ≈ 0.003. With continuity correction: (15 − 1)² / 25 = 7.84; p ≈ 0.005.
  6. Share of smokers: before (50 + 20) / 100 = 70%; after (50 + 5) / 100 = 55%.
  7. Reading: the net shift toward quitting is larger than chance would explain; with no control group, it does not prove counselling caused it.

The example’s paired table (the same 100 people)

Before / afterAfter: smokesAfter: does not smokeTotal
Before: smokes5020 (b)70
Before: does not smoke5 (c)2530
Total5545100

Markers

  • b
  • c
  • χ²
  • discordant pairs

Assumptions and pitfalls

  • Applying the χ² test of independence to paired data.
  • Including the concordant pairs in the calculation.
  • Using the large-sample version with very few discordant pairs (use the exact one).

Test yourself

Think of the answer, then tap the question to see it.

When is the McNemar test used?

To compare two paired proportions: a binary outcome measured twice in the same people, or in matched pairs.

Which cells of the table does the test use?

Only the discordant pairs (b and c); concordant pairs carry no information about change.

With b = 12 and c = 4, what is the uncorrected McNemar χ²?

(12 − 4)² / (12 + 4) = 64 / 16 = 4.0, above 3.84: significant at α = 0.05.

In a 1:1 matched case-control study, how is the OR calculated?

As b / c: pairs where only the case was exposed divided by pairs where only the control was exposed.

Add to my cards (4)

Connections

← All of epidemiology

Educational content on epidemiological and statistical methods; the examples use made-up numbers to teach the calculation. Not a clinical or legal guide: current Colombian rules are in the official sources.

Sources: How can we compare the results of classifying according to several categories? (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012); What are statistical tests? (NIST/SEMATECH e-Handbook of Statistical Methods, National Institute of Standards and Technology, 2012).

Spotted a mistake?We are always improving for the community. Tell us what is wrong and our team will review it.Report a mistake

Representative model, for educational purposes only.