McNemar Test for Paired Binary Data
The McNemar Test analyses paired binary data — typically the same subjects measured before and after an intervention with a yes/no outcome.
Step 1 — Choose input method
| Mode | What it does |
|---|---|
| Manual entry | Fill the four cells directly |
| Upload | Upload Excel file with raw paired data |
Sample Data Generator also available.
Step 2 — Enter the paired 2x2 table
| Cell | Symbol | Meaning |
|---|---|---|
| Before+/After+ | a | Stable positives |
| Before+/After- | b | Lost positive (discordant) |
| Before-/After+ | c | Gained positive (discordant) |
| Before-/After- | d | Stable negatives |
The off-diagonal cells (b and c) are what McNemar tests.
Step 3 — Calculate
Results panel shows:
- Chi-square statistic with df = 1
- p-value (NEJM-style)
- Continuity correction status
- Odds Ratio (b/c) with 95% CI
- Before proportion — (a+b)/N
- After proportion — (a+c)/N
- Discordant proportion — (b+c)/N
- Sample size adequacy with power estimate
Step 4 — Multiple analyses
Each calculation logged with timestamp. Download Excel exports all analyses.
Materials and Methods block provides auto-generated text.
A UniversalChatBot is available below.
Statistical methods used
Test statistic — adaptive continuity correction
| Condition | Formula |
|---|---|
| b+c < 25 | `chi2 = ( |
| b+c >= 25 | chi2 = (b-c)^2 / (b+c) (without correction) |
| b+c = 0 | chi2 = 0, p = 1 |
Hypothesis statement
- H0: Marginal proportions are equal (b = c)
- H1: Marginal proportions differ (two-tailed)
- alpha = 0.05
Odds Ratio (paired)
OR = b / c with SE_logOR = sqrt(1/b + 1/c).
Sample adequacy
- Total N >= 30
- Discordant pairs (b+c) >= 10
- Estimated power >= 0.80