McNemar's Test Calculator

Analyze paired dichotomous data from a 2x2 contingency table to determine if there is a significant change.

Enter the counts for the four cells of the 2x2 table representing paired observations to calculate the McNemar's chi-squared statistic and p-value.

Examples

Try these examples to see how the calculator works.

Drug Efficacy Trial

Medical Study

A study tests a new drug. 50 patients who initially tested positive for a disease are re-tested after treatment.

a: 10, b: 35

c: 5, d: 0

Ad Campaign Effectiveness

Marketing

A company surveys 100 people about brand preference before and after an ad campaign.

a: 20, b: 10

c: 30, d: 40

Teaching Method Comparison

Education

A group of 80 students is tested on a concept, taught a new method, and then re-tested.

a: 15, b: 5

c: 25, d: 35

Pilot Study with Continuity Correction

Small Sample

A small pilot study with only 20 subjects to test a new intervention.

a: 2, b: 8

c: 1, d: 9

Other Titles
Understanding McNemar's Test: A Comprehensive Guide
Learn about the principles, application, and interpretation of McNemar's Chi-Squared test for paired categorical data.

What is McNemar's Test?

  • Core Concept
  • When to Use It
  • Key Assumptions
McNemar's test is a non-parametric statistical test used on paired nominal data. It assesses the significance of the difference between two related dichotomous variables. It is specifically designed for 'before-and-after' studies or matched-pair designs to determine if there is a significant change in the proportion of subjects in two categories.
Core Concept
The test focuses on the discordant pairs in a 2x2 contingency table. These are the pairs where the outcome has changed between the first and second measurement (e.g., from 'positive' to 'negative' or vice versa). The concordant pairs, where the outcome remains the same, do not contribute to the test statistic. The null hypothesis (H0) of McNemar's test is that the marginal proportions of the two categories are equal, meaning that the number of subjects who switched from category 1 to 2 is equal to the number who switched from 2 to 1.
When to Use It
Use McNemar's test in the following scenarios: 1. You have paired data, such as measurements taken on the same subjects at two different times (e.g., pre-test/post-test). 2. The dependent variable is dichotomous (i.e., it has only two categories, like yes/no, pass/fail, positive/negative). 3. The two groups in your study are related, not independent. For independent groups, a standard Chi-Squared test would be more appropriate.
Key Assumptions
The primary assumptions for McNemar's test are: 1. The data must be from paired samples. 2. The data is nominal and dichotomous. 3. The discordant pairs (cells b and c) are the focus, and the sample size should be adequate. Some statisticians recommend that the sum of discordant pairs (b+c) should be at least 10 for the chi-squared approximation to be valid.

Step-by-Step Guide to Using the McNemar's Test Calculator

  • Inputting Data
  • Applying Continuity Correction
  • Interpreting the Results
This calculator simplifies the process of performing a McNemar's test. Follow these steps for an accurate analysis.
Inputting Data into the 2x2 Table
The calculator requires you to fill in the four cells of a 2x2 contingency table, which represent the agreement and disagreement between two paired measurements: Cell (a): Count of pairs that were positive in both measurements. Cell (b): Count of pairs that were positive in the first measurement but negative in the second. Cell (c): Count of pairs that were negative in the first measurement but positive in the second. Cell (d): Count of pairs that were negative in both measurements. Ensure all values are non-negative integers.
Applying Continuity Correction
The calculator includes an option for Yates's continuity correction. This is an adjustment made when the sample size is small, specifically when the number of discordant pairs (b + c) is less than about 20. The correction provides a more conservative and often more accurate p-value in these cases. Check the 'Apply Continuity Correction' box if your data fits this criterion.
Interpreting the Results
After clicking 'Calculate', the tool provides three key outputs: 1. Chi-Squared (χ²) Value: This is the test statistic. A larger value indicates a greater discrepancy between the discordant pairs. 2. P-Value: This tells you the probability of observing the data (or more extreme data) if the null hypothesis were true. A small p-value (typically < 0.05) suggests that you can reject the null hypothesis. 3. Interpretation: The calculator provides a plain-language summary of whether the result is statistically significant, helping you draw a conclusion.

Real-World Applications of McNemar's Test

  • Medical and Clinical Research
  • Marketing and Business Analytics
  • Social Sciences and Education
McNemar's test is a versatile tool used across many fields to analyze changes in dichotomous outcomes.
Medical and Clinical Research
It is frequently used to assess the effectiveness of a medical treatment. For example, researchers might record whether patients have a certain symptom before and after receiving a drug. McNemar's test can determine if the drug significantly changed the presence of the symptom.
Marketing and Business Analytics
In marketing, the test can measure the impact of an advertising campaign. A company could survey a group of consumers about their preference for a brand before and after the campaign. McNemar's test would show if the campaign significantly shifted brand preference.
Social Sciences and Education
Educators can use it to evaluate the effectiveness of a new teaching method. Students' pass/fail rates on a test can be compared before and after the new method is implemented to see if it led to a significant improvement in learning outcomes.