McNemar’s test
Hypothesis tests · Method and input reference
Nonnegative integer counts. Fisher and McNemar require 2×2. McNemar uses the exact binomial test for paired binary outcomes. Synthetic example: 240 paired assessments, baseline category by follow-up category. Off-diagonal counts represent changes.
Open calculator · Compare methods in the decision matrix
When to consider it
- Compare paired binary outcomes using discordant pairs in a 2×2 table.
Assumptions and scope
- Observations must be independent between subjects; repeated rows from one subject are not independent samples.
- Use the outcome and predictor coding required by the calculator; review missing data and model diagnostics.
Required inputs
- Observed count matrix — Numeric observations; preserve the row and column structure described above.
Review missing values and data coding before running. Sample inputs are synthetic teaching examples.
Implementation
Lifescio validates inputs and formats results; listed functions are the principal calculation routines, not an exhaustive transitive dependency list.
- statsmodels 0.14.4: statsmodels.stats.contingency_tables.mcnemar
These are pinned library versions; saved results record the versions actually used at runtime.