Open StatClinic →
📈 Non-Parametric Tests

McNemar Test in Medical Research:
Complete Guide for Paired Categorical Data

🕑 25 min read 📅 July 2026 ✅ Peer-reviewed content 📚 3600+ words
S
StatClinic Editorial Team Statistical content for medical researchers and clinicians
A clinical trial compares the proportion of patients with hypertension before and after a 12-week antihypertensive regimen. Both measurements come from the same patients. The research team runs a Chi-Square test and reports a significant result — but reviewers reject the paper, noting a fundamental methodological error. The Chi-Square test assumes independent groups; applying it to paired, repeated measurements on the same subjects is statistically invalid and inflates the false positive rate. The correct tool here is the McNemar test — specifically designed for exactly this scenario. It is one of the most commonly misapplied tests in clinical research, and understanding when and how to use it correctly is essential for every medical researcher, clinician-scientist, and thesis writer.

What Is the McNemar Test?

The McNemar test is a non-parametric statistical test for paired nominal (categorical) data with a dichotomous outcome. It was developed by American psychologist Quinn McNemar in 1947 and remains the standard method for testing whether the marginal proportions of a binary outcome change significantly between two related measurements.

The core question the McNemar test answers is: "Has the proportion of subjects with a positive outcome changed significantly between condition A and condition B?" The conditions might be two time points (before and after), two diagnostic tests applied to the same patient, or two matched individuals (a case and their paired control).

Crucially, the McNemar test focuses exclusively on the discordant pairs — subjects (or matched pairs) whose outcome status differs between the two conditions. Subjects who were positive on both measurements (concordant positive) or negative on both (concordant negative) do not change the marginal proportions and therefore contribute no information to the test. This elegant feature is what makes the McNemar test both powerful and statistically correct for paired designs.

When to Use the McNemar Test

The McNemar test is the appropriate choice whenever all three of the following conditions are met:

  1. The outcome variable is binary (dichotomous): yes/no, positive/negative, present/absent, cured/not cured, improved/not improved
  2. The data are paired: each observation in condition A is matched to a specific observation in condition B
  3. You want to test whether the proportions differ: not just whether categories differ, but whether the marginal probability of a positive outcome has changed

The Most Common Study Designs

When NOT to use the McNemar test: If your groups are independent (e.g., comparing responder rates between a drug group and a separate placebo group who never received the other treatment), use the Chi-Square test or Fisher's Exact test instead. The McNemar test requires that each row in condition A be physically paired with a specific row in condition B.

Assumptions of the McNemar Test

The McNemar test has relatively few assumptions, which contributes to its robust applicability in clinical research:

  1. Binary outcome: The outcome variable must be dichotomous (two categories only). For three or more ordered categories, use the Stuart-Maxwell test (marginal homogeneity test) instead.
  2. Paired observations: Each subject (or matched pair) must contribute exactly one measurement to each condition. The pairing must be natural and pre-specified, not post-hoc.
  3. Random sampling: Subjects should be a representative sample (or a randomized cohort) from the population of interest. The McNemar test does not correct for selection bias.
  4. Large enough discordant pairs (for chi-square approximation): The standard McNemar chi-square statistic assumes that b + c ≥ 25 (where b and c are the two discordant cells). For smaller samples, use the exact binomial McNemar test.
Independence between pairs: While the two measurements within each pair are correlated (that's the point), different pairs must be independent of each other. Do not use the McNemar test if the same patient appears in more than one pair, or if pairs are clustered within families or centres without adjustment.

The McNemar Formula and the 2×2 Table

Every McNemar analysis begins with constructing a 2×2 contingency table that cross-tabulates the outcome at condition A (rows) against the outcome at condition B (columns):

Condition B: PositiveCondition B: NegativeRow Total
Condition A: Positivea (concordant +)b (A+ → B−)a + b
Condition A: Negativec (A− → B+)d (concordant −)c + d
Column Totala + cb + dn (total)

Cells a and d are concordant pairs (no change in status). Cells b and c are the discordant pairs. Under the null hypothesis of marginal homogeneity, b and c should be approximately equal (each patient is equally likely to change in either direction by chance alone).

χ² = (b − c)² / (b + c)
McNemar chi-square statistic — degrees of freedom = 1
Valid when b + c ≥ 25
b = subjects positive in A, negative in B (worsened or lost positive status)
c = subjects negative in A, positive in B (improved or gained positive status)
b + c = total discordant pairs (the only pairs that matter)
p-value = from chi-square distribution with df = 1

Exact Binomial McNemar Test

When b + c < 25, the chi-square approximation is unreliable. The exact test treats the number of "improvements" (c) as a binomial random variable with n = b + c trials and p = 0.5 under H₀. The two-tailed p-value is computed from the exact binomial distribution and reported directly by software (SPSS Exact Tests module, R's mcnemar.test(correct = FALSE), or Stata's mcci).

Effect Size: Odds Ratio for Discordant Pairs

The chi-square statistic from McNemar tells you whether the change is statistically significant, but not how large the effect is. The most interpretable effect size is the discordant-pair odds ratio: OR = b / c. An OR > 1 means that more subjects changed from negative to positive (improved) than from positive to negative (worsened). Report the OR with its 95% confidence interval alongside the McNemar statistic.

Clinical Examples

1
Antibiotic Therapy and H. pylori Eradication
A gastroenterology clinic tests 120 patients for H. pylori before and four weeks after a 14-day triple-antibiotic regimen. The outcome is binary: H. pylori positive or negative. The research question: did the proportion of positive patients change significantly after treatment?

Step 1: Build the 2×2 table

Post: H. pylori +Post: H. pylori −
Pre: H. pylori +a = 8 (still positive)b = 74 (positive → negative)
Pre: H. pylori −c = 4 (negative → positive)d = 34 (still negative)
Discordant pairs b + c = 74 + 4 = 78 ≥ 25 → use chi-square approximation McNemar chi-square χ² = (b − c)² / (b + c) = (74 − 4)² / (74 + 4) = (70)² / 78 = 4900 / 78 = 62.82 P-value (df = 1) p < 0.001 Effect size (odds ratio) OR = b / c = 74 / 4 = 18.5
Result: χ²(1) = 62.82, p < 0.001, OR = 18.5 (95% CI: 6.8–50.2)
Interpretation: The proportion of H. pylori positive patients decreased from 82/120 (68.3%) before treatment to 12/120 (10.0%) after treatment — a statistically significant and clinically large improvement. Patients were 18.5 times more likely to be eradicated (lose positive status) than to gain a new H. pylori infection during the study period. This is a powerful demonstration of the therapy's efficacy at the group level.
2
Two Mammography Protocols for Breast Cancer Screening
A radiology department evaluates two mammography protocols — standard 2D and newer 3D tomosynthesis — on the same 200 women attending a screening clinic. The outcome is binary: recall (positive) or no recall (negative). The research question: do the two protocols produce significantly different recall rates in the same women?

Step 1: Build the 2×2 table

3D: Recall3D: No Recall
2D: Recalla = 22 (both recall)b = 18 (2D+ only)
2D: No Recallc = 9 (3D+ only)d = 151 (neither)
Discordant pairs b + c = 18 + 9 = 27 ≥ 25 → chi-square approximation valid McNemar chi-square χ² = (18 − 9)² / (18 + 9) = 81 / 27 = 3.00 P-value (df = 1) p = 0.083 Effect size OR = b / c = 18 / 9 = 2.0
Result: χ²(1) = 3.00, p = 0.083 (not significant at α = 0.05)
Interpretation: Recall rates were 20.0% for 2D and 15.5% for 3D tomosynthesis. Although the odds ratio suggests the 2D protocol was twice as likely as 3D to trigger a unique recall (among discordant pairs), this difference did not reach statistical significance (p = 0.083). The study may be underpowered — with only 27 discordant pairs, the 80% power threshold for detecting an OR of 2 requires approximately 39 discordant pairs. The researchers should consider a larger validation study before concluding equivalence.
3
Matched Case-Control Study: Maternal Diabetes and Childhood Obesity
A matched case-control study pairs 85 obese children (cases) with 85 non-obese children of the same age, sex, and socioeconomic status (controls). The exposure is: was the child's mother diagnosed with gestational diabetes? The research question: is gestational diabetes exposure significantly more common in obese children than in their matched non-obese controls?

Step 1: Build the 2×2 table

Control: Exposed (GDM)Control: Unexposed
Case: Exposed (GDM)a = 11 (both exposed)b = 31 (case only exposed)
Case: Unexposedc = 9 (control only exposed)d = 34 (neither exposed)
Discordant pairs b + c = 31 + 9 = 40 ≥ 25 → chi-square approximation valid McNemar chi-square χ² = (31 − 9)² / (31 + 9) = (22)² / 40 = 484 / 40 = 12.10 P-value (df = 1) p = 0.001 Matched-pair odds ratio OR = b / c = 31 / 9 = 3.44 (95% CI: 1.62–7.31)
Result: χ²(1) = 12.10, p = 0.001, matched OR = 3.44 (95% CI: 1.62–7.31)
Interpretation: Obese children were 3.44 times more likely to have been exposed to gestational diabetes mellitus than their matched non-obese controls (p = 0.001). The use of the McNemar test is mandatory here — using a standard Chi-Square test would ignore the matched structure and produce a biased, overly optimistic p-value. The matched-pair OR of 3.44 is the appropriate effect size for this design and should be reported in the results section.

McNemar Test vs Chi-Square Test

The most common error in paired categorical data analysis is using the Chi-Square test when the McNemar test is required. Understanding why this matters prevents a very common and peer-review-rejected methodological mistake:

✓ McNemar Test (Correct for Paired Data)

  • Accounts for within-subject correlation
  • Tests only discordant pairs — where the real information lies
  • Preserves correct Type I error rate (α = 0.05)
  • Correct for matched case-control, before-after, crossover
  • Every pair must come from the same subject or matched unit

✗ Chi-Square Test (Wrong for Paired Data)

  • Assumes independence between all observations
  • Treats each measurement as a separate subject
  • Inflates Type I error (too many false positives)
  • Correct only for independent groups (RCT arms, cohort groups)
  • Mixing paired and Chi-Square is a reportable methodological flaw
Why does the Chi-Square test inflate errors? When you apply Chi-Square to paired data, you double-count observations (each subject appears in both rows of the marginal table). The effective sample size appears larger than it really is, the standard error shrinks, and the resulting test statistic is inflated — leading to far more "significant" results than the true underlying effects warrant. In matched case-control studies, the inflation can be severe, particularly when concordant pairs are numerous.

Extensions of the McNemar Test

McNemar Test with Continuity Correction (Yates)

Some textbooks present a continuity-corrected version: χ² = (|b − c| − 1)² / (b + c). However, this correction is overly conservative and generally not recommended by modern biostatisticians. Use the exact binomial test when b + c < 25; use the uncorrected McNemar when b + c ≥ 25.

Stuart-Maxwell Test (Generalised McNemar)

For nominal or ordinal outcomes with three or more categories measured twice on the same subjects, the Stuart-Maxwell test (also called the marginal homogeneity test) generalises the McNemar framework to k×k tables. This is the correct method when your outcome is a Likert scale (strongly disagree to strongly agree), a disease severity grade (mild/moderate/severe), or any other multi-category variable measured at two time points.

McNemar-Bowker Test

The Bowker test extends McNemar to test symmetry in a square k×k table. While Stuart-Maxwell tests marginal homogeneity (the most common clinical question), Bowker tests complete symmetry (a stricter condition). Available in SPSS and R's DescTools package (BowkerTest()).

Thesis and Research Reporting Recommendations

When writing up the McNemar test in a thesis, dissertation, or journal manuscript, follow these evidence-based reporting practices:

State Your Design Explicitly

Before presenting the statistical results, clearly describe the paired structure of your data: "Each participant was assessed at baseline and at 12-week follow-up. Because the same patients contributed data at both time points, we used McNemar's test for paired dichotomous outcomes rather than the Chi-Square test, which assumes independence between groups."

Present the Full 2×2 Table

Always include the complete 2×2 table showing all four cells (a, b, c, d) in your results section. Reviewers and readers need to see both concordant and discordant cells to understand the data structure and verify your calculation. Label rows as "Baseline" and columns as "Follow-up" (or whichever conditions apply).

Report All Required Statistics

Model Reporting Sentence
"The proportion of patients with eczema flares decreased from 61.7% (n = 74/120) at baseline to 15.0% (n = 18/120) at 8-week follow-up. McNemar's test confirmed a statistically significant change in symptom status (χ²(1) = 38.4, p < 0.001). Among discordant pairs, 56 patients improved while 6 worsened, yielding a discordant-pair odds ratio of 9.3 (95% CI: 4.0–21.6), indicating a clinically substantial treatment effect."

The elements to always include: marginal proportions at both time points (with denominators), the McNemar chi-square value, degrees of freedom (always 1), p-value, number of discordant pairs in each direction, and the effect size (OR with 95% CI).

Interpret the Clinical Meaning

Never end your results section with just a p-value. Translate the finding: state the direction of the change, the magnitude (odds ratio), and what this means for patients or clinical practice. A p < 0.001 tells the reader that the change is real; the odds ratio tells them how large it is.

Common Mistakes Researchers Make

Mistake 1: Using Chi-Square for Paired Data

The most frequent error: applying the Pearson Chi-Square test to before-after data from the same subjects, or to matched case-control data. The independence assumption is violated, the Type I error rate is inflated, and the paper will be flagged by competent peer reviewers.

Fix: Always ask "Is each measurement from the same subject (or a matched pair)?" If yes, use McNemar — not Chi-Square or Fisher's Exact test.

Mistake 2: Reporting Only the P-Value Without Effect Size

The p-value alone does not indicate clinical importance. A study with 2,000 matched pairs might detect a trivially small change (e.g., from 50.1% to 49.9%) as highly significant (p < 0.001) because the test is very powerful at that sample size. The discordant-pair odds ratio contextualises the finding.

Fix: Always report the discordant-pair OR and 95% CI alongside the McNemar chi-square and p-value.

Mistake 3: Ignoring the Exact Test When Discordant Pairs Are Few

When b + c < 25, the chi-square approximation is unreliable. Researchers sometimes report a McNemar chi-square value even when only 8 or 12 discordant pairs are available, producing inaccurate p-values that cannot be trusted.

Fix: Count b + c before analysis. If b + c < 25, request the exact binomial McNemar test from SPSS Exact Tests, R (mcnemar.test(correct = FALSE)), or Stata.

Mistake 4: Applying McNemar to Unpaired Data with Post-Hoc Matching

Some researchers collect independent groups and then retrospectively match subjects on confounders to "use the more powerful McNemar test." This is statistical manipulation: McNemar requires pre-specified pairing based on the study design, not post-hoc data reshuffling.

Fix: The pairing structure must be defined before data collection and grounded in the study design. Matched case-control pairings must be pre-specified in the study protocol.

Mistake 5: Using McNemar for Continuous or Ordinal Data

The McNemar test is only valid for binary outcomes. Using it on a 5-point Likert scale (by arbitrarily dichotomising at a cutpoint) discards information and reduces power unnecessarily.

Fix: Use the Wilcoxon signed-rank test for paired ordinal data. Use the Stuart-Maxwell test if you have a nominal/ordinal variable with 3+ categories measured at two time points.

Mistake 6: Omitting the 2×2 Table From the Results Section

Reporting only the chi-square statistic and p-value without the full 2×2 table prevents readers from verifying the analysis and understanding the concordant-vs-discordant structure of the data — a significant transparency deficit.

Fix: Always include the complete 2×2 cross-tabulation table in your results section, either in the text or as a labelled table.

Scientific Paper Reporting Recommendations

The following guidelines synthesise recommendations from APA 7th Edition, CONSORT 2010 (for RCTs), and STROBE (for observational studies):

Practical Tips for Medical Researchers

Plan for Discordant Pairs, Not Total N

Sample size calculations for McNemar are based on the expected number of discordant pairs (b + c), not the total sample size. You need to estimate what proportion of subjects will change status. A common mistake is planning for total N without considering that concordant pairs contribute nothing to the test.

Pre-Specify the Pairing Variable

In your study protocol and ethics application, document the exact pairing structure — whether it's temporal (same patient at two times), geographic (case and matched community control), or design-based (crossover sequence). Auditors and peer reviewers will ask.

Check for Missing Pairs Before Analysis

If a subject has data at baseline but not at follow-up (or vice versa), their pair is incomplete. The McNemar test can only use complete pairs. Document how many pairs were excluded due to missing data and perform a sensitivity analysis if the proportion excluded exceeds 10%.

Use Software for Exact P-Values

Manual calculation of the McNemar chi-square is straightforward, but exact p-values for small samples require software. In SPSS: Analyze → Nonparametric Tests → Legacy Dialogs → 2 Related Samples → McNemar. In R: mcnemar.test(matrix(c(a,b,c,d),2,2)).

Report Concordant Pairs for Transparency

Even though concordant pairs don't affect the McNemar statistic, report the counts in cells a and d. They inform the reader about the overall prevalence and the proportion of stable outcomes — important for understanding the clinical context.

Consider Stratified Analysis for Subgroups

If your study has pre-specified subgroups (e.g., males vs females, age <50 vs ≥50), run separate McNemar tests within each stratum. Do not combine subgroups and run a single analysis if the treatment effect plausibly differs between groups.

Frequently Asked Questions

When should I use the McNemar test instead of the Chi-Square test? +
Use the McNemar test whenever your binary categorical outcome is measured twice on the same subjects (paired data). The classic scenarios are: (1) before-and-after designs where the same patients are measured at two time points, (2) matched case-control studies where each case is paired with a control, and (3) studies comparing two diagnostic tests applied to the same patients. The Chi-Square test is for independent groups; applying it to paired data violates the independence assumption and inflates the Type I error rate.
What is a discordant pair in the McNemar test? +
Discordant pairs are the subject pairs where the outcome differs between the two conditions. In the 2×2 McNemar table, the discordant pairs are in cells b (positive at baseline → negative at follow-up) and c (negative at baseline → positive at follow-up). Concordant pairs (cells a and d) show no change and contribute no information to the test. The McNemar test is entirely based on whether the two types of discordant pairs are approximately equal (H₀: b ≈ c).
How many subjects do I need for the McNemar test? +
The standard McNemar chi-square approximation is valid when the total number of discordant pairs (b + c) is at least 25. When b + c < 25, use the exact binomial McNemar test. For sample size planning, you need to estimate the expected proportions changing in each direction (p_b and p_c) based on pilot data or published literature. The pwr package in R and many online calculators can compute the required total N to achieve 80% power at α = 0.05.
Can the McNemar test handle more than two categories? +
The standard McNemar test is for dichotomous (binary) outcomes. For ordinal or nominal outcomes with 3 or more categories measured twice on the same subjects, use the Stuart-Maxwell test (marginal homogeneity test). The Bowker test is another generalisation that tests symmetry in a k×k table. Both are available in SPSS (Nonparametric → Related Samples → Marginal Homogeneity) and in R's DescTools package.
Do I need to apply Yates' continuity correction to the McNemar test? +
Yates' continuity correction (χ² = (|b−c|−1)²/(b+c)) is overly conservative and reduces power unnecessarily. Most modern methodologists recommend using the exact binomial McNemar test instead of Yates' correction when b + c < 25. For b + c ≥ 25, the uncorrected McNemar statistic performs well and the correction is not needed.
How do I report the McNemar test in a thesis or journal paper? +
Report the four cell frequencies, both marginal proportions, the chi-square statistic, degrees of freedom (always 1), p-value, and the discordant-pair odds ratio with 95% CI. Example: "The proportion with hypertension decreased from 72% to 41% (McNemar χ²(1) = 14.2, p < 0.001; discordant-pair OR = 3.9, 95% CI 1.9–8.0)." Always include the full 2×2 table in the results section.
What effect size should I report with the McNemar test? +
The most interpretable effect size is the discordant-pair odds ratio (OR = b/c). An OR > 1 means more subjects gained positive status (improved) than lost it. You can also report the absolute difference in marginal proportions with its 95% CI, or McNemar's phi coefficient. The APA 7th edition and CONSORT guidelines both require an effect size measure with every inferential test.
Can I use the McNemar test in SPSS? +
Yes. Go to Analyze → Nonparametric Tests → Legacy Dialogs → 2 Related Samples. Select both variables (before and after), check 'McNemar' under Test Type, and click OK. SPSS reports the 2×2 contingency table and the chi-square approximation. For exact p-values when b + c < 25, use Analyze → Exact Tests → McNemar (requires the Exact Tests add-on module). Newer SPSS versions also offer this under Analyze → Nonparametric Tests → Related Samples.
What is the difference between the McNemar test and the Wilcoxon signed-rank test? +
Both tests analyse paired data, but for different variable types. The McNemar test is for dichotomous (binary) categorical outcomes — variables with exactly two values (yes/no, positive/negative). The Wilcoxon signed-rank test is for continuous or ordinal outcomes. If your outcome is binary, use McNemar. If it is continuous (e.g., blood pressure), use the paired t-test (if normally distributed) or Wilcoxon signed-rank (if non-normal).
What is the p-value significance threshold for McNemar? +
The standard threshold is p < 0.05. A p < 0.05 means the imbalance between discordant pairs (b vs c) is unlikely to be due to chance alone. When conducting multiple McNemar tests in the same study (e.g., testing five different binary endpoints before and after treatment), apply Bonferroni correction or FDR adjustment to control the false discovery rate and avoid inflation of the family-wise error rate.

Run the McNemar Test Online

Use StatClinic's built-in McNemar calculator to analyse your paired categorical data instantly. Enter your 2×2 table, get the chi-square statistic, exact p-value, and discordant-pair odds ratio with confidence intervals — formatted for thesis and journal submission.

Open McNemar Calculator →