Test for paired nominal data using 2×2 contingency tables. Ideal for before/after studies and matched pairs.
Enter counts for paired categorical outcomes:
McNemar's test is a statistical test for paired nominal data (binary outcomes). It determines if a change occurs between two related observations within the same subjects.
Hypothesis: H₀: No change between paired observations | H₁: Change detected
The 2×2 Contingency Table:
Key Insight: McNemar's test ignores concordant pairs (a and d) and focuses only on discordant pairs (b and c). If there's no change, b and c should be roughly equal.
When to Use: Paired categorical data, before/after studies, matched case-control, repeated measurements on the same subjects.
Count observations in all four cells. Rows = Before outcome, Columns = After outcome.
Extract b (Before +, After −) and c (Before −, After +). Ignore a and d.
χ² = (|b − c| − 1)² / (b + c). This asymptotically follows chi-square distribution with df = 1.
z = √χ². For large samples, use standard normal distribution; z-table gives p-value.
p = 2 × P(Z ≥ |z|). Compare to α = 0.05 for significance testing.
Study: Testing a new smoking cessation program 80 smokers' status recorded before and after treatment 2x2 Table: After Quit After Still Smoke Before Quit 20 5 (b=5: quit before, smoking after) Before Smoke 15 60 (c=15: smoking before, quit after) Discordant pairs: b = 5, c = 15 chi2 = (|5 - 15| - 1)^2 / (5 + 15) = (10 - 1)^2 / 20 = 81 / 20 = 4.05 z = sqrt(4.05) ~= 2.012 p-value (two-tailed) ~= 0.044 Result: p = 0.044 (Significant at a = 0.05) Interpretation: The program significantly increased smoking cessation. More people quit (c=15) than relapsed back to smoking (b=5).
Related Tools