McNemar Test Calculator Formula

Understand the math behind the mcnemar test calculator. Each variable explained with a worked example.

Formulas Used

McNemar chi-sq (continuity)

chi2 = pow(abs(b_cell - c_cell) - 1, 2) / (b_cell + c_cell)

McNemar chi-sq (no continuity)

chi2_no_cc = pow(b_cell - c_cell, 2) / (b_cell + c_cell)

Total Discordant

total_disc = b_cell + c_cell

Variables

VariableDescriptionDefault
b_cellDiscordant b (+ then -)15
c_cellDiscordant c (- then +)5

How It Works

McNemar Test

chi2 = (|b-c|-1)^2 / (b+c)

For paired binary outcomes. Only discordant pairs matter.

Worked Example

b=15, c=5.

b_cell = 15c_cell = 5
  1. 01chi2 = 81/20 = 4.05
  2. 02df=1, significant at 0.05

Ready to run the numbers?

Open McNemar Test Calculator