Analyze · Nonparametric

McNemar's Test

Tests whether a paired binary outcome changed between two conditions (e.g.

In the menus Analyze › Nonparametric › McNemar's Test

Also searched as mcnemar paired proportions matched pairs categorical before after proportions

When to use it

You have a yes/no outcome measured twice on the same subjects (before vs after, test A vs test B) and want to know whether the proportion of 'yes' changed.

When not to: The two measurements are on independent, unpaired groups (use the ordinary chi-square test of independence instead), more than two outcome categories are involved on paired data (use the Stuart-Maxwell / marginal-homogeneity test), or there are more than two related conditions on a continuous/ordinal outcome (use the Friedman test).

Step by step

  1. Open it from the menu

    Click Analyze in the menu bar; under Nonparametric choose McNemar's Test.

  2. Fill in the form

    Choose the columns: Before (yes/no), After (yes/no). The form lists only columns whose type fits each field.

  3. Check the options

    The options start at their defaults: Alpha, Test method, Continuity correction. Change one only when your question needs it.

  4. Run the analysis

    Press Run analysis. The Result Card opens on its Results tab.

What to choose in the form

Fields of the McNemar's Test form
Before (yes/no) Var1 requiredOne binary or categorical column. First (e.g. 'before') binary measurement.
After (yes/no) Var2 requiredOne binary or categorical column. Second (e.g. 'after') paired binary measurement.
AlphaSignificance threshold. Default: 0.05.
Test methodExact binomial, asymptotic χ², or auto (exact when discordant pairs < 25). Default: auto.
Continuity correctionApply Edwards' continuity correction to the asymptotic χ². Default: on.

How to read the card

The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.

What it assumes

Independence of observations

If it does not hold: McNemar's test assumes different subjects/pairs are independent of one another; correlated pairs (e.g. subjects from the same family or cluster) invalidate the test's standard error.

How to check: Not checked by KernelStats: assumed from the study design; stated directly as a standing reminder.

A worked example

Surveying 200 customers' product approval (yes/no) before and after watching a demo: 140 said yes both times, 30 said no both times, 22 switched from no to yes, 8 switched from yes to no.

Result: b=22, c=8, n_discordant=30 (>= 25, asymptotic route with continuity correction), chi2(1) = (|22 - 8| - 1)^2 / 30 = 5.63, p = .018; discordant odds ratio = 2.75; Cohen's g = 0.23 (approaching large).

Of the 30 customers whose answer changed after watching the demo, 22 switched from disapproving to approving and 8 the other way: the data give evidence that more changed in one direction than the other (p = .018), and the effect (Cohen's g near 0.25) is substantial among those who did switch; the 170 customers whose opinion never changed contributed nothing to this result, exactly as the test is designed.

From the Statistics Library.

The code tabs

Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.

Understand the statistics

Ask Oobi

Type one of these into Ask Oobi beside your data:

  • Did the share of customers who approve of a product change after they watched a demo?
  • Explain the McNemar's test in plain words.
  • What does odds ratio mean?

Last reviewed November 16, 2026.

Report an unclear step