When the same people supply a before and an after pass-or-fail result, keep the paired outcomes. Build a table showing who passed both times, failed both times, improved or worsened. McNemar's test compares the two directions of change; an independent-groups conversion test discards the relationship between each person's results.
“Twenty-two passed before and sixteen passed afterward” establishes a drop of six passes. It does not tell you whether six people worsened and nobody improved, or whether eight worsened while two improved. Those records have the same totals and different evidence.
Check that the record is paired
Consider a wholly fictional audit of thirty people, each assessed once before and once after a process change. Both assessments use the same fixed pass criterion and comparable task scope. Every person has both results; no missing, duplicate or reassigned record enters the calculation.
The thirty people are independent comparable units for the stated model. Each person's two results may be related. There are no team clusters, repeated follow-up attempts or additional outcomes being selected after analysis.
This is an observational before-and-after comparison. The change was not randomly assigned against a concurrent control. Calendar conditions, familiarity, workload and other changes remain possible explanations. The test below does not identify what caused the difference.
The controlled-comparison guide examines assignment and causal claims. Here the narrower question is how to analyze the matched binary record that actually exists.
Put the joint outcomes in four cells
Use rows for the before result and columns for the after result. Keep “pass” first on both axes. The complete thirty-person record is:
- Fourteen pass both before and after.
- Eight pass before but fail afterward.
- Two fail before but pass afterward.
- Six fail both times.
Each person appears in exactly one cell. The table contains thirty paired people, not sixty independent participants. Row totals describe before outcomes; column totals describe after outcomes.
| Before result | After pass | After fail | Before total |
|---|---|---|---|
| Pass | 14 | 8 | 22 |
| Fail | 2 | 6 | 8 |
| After total | 16 | 14 | 30 |
Before, 22/30, approximately 73.33%, pass. Afterward, 16/30, approximately 53.33%, pass. The after-minus-before difference is −6/30 = −20 percentage points.
It is not a finding that exactly six people worsened. Eight did, while two improved. The net change is two minus eight, or negative six. Retain both directions beside the net total.
Locate the discordant pairs
The fourteen pass-pass and six fail-fail records are concordant: each person has the same label both times. The eight pass-fail and two fail-pass records are discordant: each has changed labels.
The University of Amsterdam's explanation frames McNemar's test around those discordant directions. For the comparison of equal marginal pass probabilities, the question is whether pass-fail is as likely as fail-pass.
Conditional on the ten discordant pairs, the null model gives either direction probability one-half. Under the stated independent-pair assumptions, the number changing in one chosen direction follows a binomial distribution with ten trials and probability one-half.
The twenty concordant pairs remain part of the thirty-person record and the observed pass rates. They simply do not contribute a direction to this conditional test. “Not used in this test's tail count” does not mean they should be deleted from the audit.
Calculate the two-sided exact result
The analysis plan for this fictional audit specifies one two-sided exact conditional McNemar test after all thirty pairs are complete, at a significance level of 0.05. No early result triggers stopping, and no other primary comparison is searched for a favorable finding.
The statsmodels documentation distinguishes its exact binomial calculation from the large-sample chi-squared approximation. We can reconstruct the exact calculation without relying on a software label.
Among ten independent equally likely binary directions, there are 2¹⁰ = 1,024 possible direction sequences under the null model. Having at most two in the less frequent direction includes:
- Zero: one sequence.
- One: ten sequences, choosing which pair has that direction.
- Two: forty-five sequences, choosing two of the ten pairs.
The lower tail contains 1 + 10 + 45 = 56 sequences. The equally extreme opposite tail contains another fifty-six. They do not overlap here.
The two-sided exact p-value is therefore 112/1,024 = 7/64 = 0.109375. It exceeds 0.05, so this specified test does not reject equal marginal pass probabilities.
That result does not erase the observed twenty-point drop. It also does not prove equality, show that the process is harmless or establish a 10.9375% probability that the null is true. The calculation describes a tail probability under the null and the model, not the probability assigned to a business explanation.
Show why the margins cannot recover the test
Consider a separate thirty-person record with sixteen pass-pass, six pass-fail, zero fail-pass and eight fail-fail. It still has twenty-two passes before and sixteen afterward.
The marginal rates and twenty-percentage-point decline are unchanged. But there are now six discordant pairs, all in the worsening direction, instead of ten split eight to two.
Under the same kind of conditional null, there are 2⁶ = sixty-four possible direction sequences. Only the all-one-direction sequence and its opposite are as extreme. The two-sided exact probability is 2/64 = 0.03125.
This separate record rejects equal marginal pass probabilities at 0.05 under its planned test. It does not have a larger observed net decline; it has a different pattern of within-person changes.
The two marginal totals alone cannot distinguish these tables. If a report retained only “22 before, 16 after,” the lost pairing cannot be reconstructed by choosing a more sophisticated calculator.
Name the approximation if you use it
For the original eight-versus-two discordances, the uncorrected McNemar chi-squared statistic is (8 − 2)² / (8 + 2) = 3.6.
A continuity-corrected version instead uses (|8 − 2| − 1)² / 10 = 2.5. These are statistics for approximate reference calculations, not the exact p-value of 0.109375.
The published statsmodels implementation makes the choices explicit: its exact branch uses the binomial distribution; the continuity-correction setting applies to the approximate branch. This guide follows the preselected exact calculation rather than switching methods after seeing their results.
Software output can also label its statistic differently in the exact branch. Read the method and settings before comparing a displayed “2” with a displayed “2.5” and assuming one program is wrong.
The independent A/B guide works with different people assigned to separate groups. Its pooled two-proportion calculation is not a substitute for retaining these paired observations.
Do not use the test to measure effect size
For a separate diagnostic, add three hundred genuinely different independent people to the original record: one hundred fifty pass both times and one hundred fifty fail both times. This is a new supplied sample, not copied rows presented as new evidence.
The table now has 164 pass-pass, eight pass-fail, two fail-pass and 156 fail-fail pairs, totaling 330. Before passes total 172 and after passes total 166. The net change remains six fewer passes, but the observed difference is now −6/330, approximately −1.8182 percentage points, rather than minus twenty.
The conditional discordance test still sees ten changing pairs split eight to two, so its exact p-value remains 0.109375. That agreement does not mean the two samples have the same observed effect. Concordant pairs affect the marginal rates and paired difference even though they contribute no direction to this particular conditional test.
If every person instead keeps the same label, the number of discordant pairs is zero. Report that no changes were observed. The usual exact conditional calculation returns one, while a formula dividing by the discordant count cannot be used. Neither result establishes population equivalence or rules out a meaningful difference that a larger or different study might reveal.
Keep missing pairs and repeated attempts visible
Suppose three people lack an after result. They do not automatically become after failures, and they cannot be paired with three convenient replacement people. The complete-case table would answer a narrower question about those with both outcomes.
Investigate why the results are missing. If the absent people are disproportionately struggling, dropping them may distort the comparison. Preserve the original eligible count, the missing-outcome count and the reasons rather than claiming the remaining sample describes everyone.
Likewise, thirty people attempting the task five times each do not create 150 independent pairs. Repeated attempts and shared teams require analysis reflecting the actual dependence. The simple audit here deliberately supplies one pair per independent person.
A fail-to-pass change must also mean the same thing across the record. If the after assessment lowers the pass threshold or omits the hardest task, the table compares changed definitions as well as changed outcomes.
Turn the table into an investigation
Review the eight worsening records and two improving records against the unchanged criterion. Check task differences, data errors, timing and relevant working conditions. The table locates the changes; it does not explain them.
Before choosing a response, ask what degree of deterioration matters, what other evidence exists and what consequences follow from a failure. A statistical threshold alone cannot approve a process or establish that every outcome has equal practical importance.
Keep effect estimation separate too. The observed paired difference is minus twenty points; this guide does not calculate a confidence interval for the underlying difference. The p-value is not such an interval, and the thirty-person count does not promise the next thirty will behave identically.
- Preserve one identifier and both outcomes for each eligible pair.
- Fix the binary criterion and verify all four joint counts.
- Report marginal rates, improving and worsening counts, and net change.
- Use the planned paired method, tail convention and stopping rule.
- Retain missingness, dependence, causal limits and practical consequences beside the result.
Explore Infinite Upside
For Vijay Sheth’s personal accounts, read Infinite Upside: Building Wealth With Room to Live, published by Sheth Capital, Inc.
Choose an edition
Choose an edition