McNemar’s Test Calculator
The mcnemar test calculator is designed for analyzing paired nominal data, particularly in contexts such as before-and-after studies or matched-pair designs.
By comparing the frequencies of discordant pairs, the McNemar test offers insights into whether observed changes are statistically significant or merely due to chance.
McNemar Test Examples Chart
Study Type | Before (No) | Before (Yes) | After (No) | After (Yes) | McNemar’s Chi-square | p-value |
---|---|---|---|---|---|---|
Smoking Cessation | 65 | 35 | 80 | 20 | 15.0 | 0.0001 |
Diet Adherence | 40 | 60 | 55 | 45 | 7.5 | 0.0062 |
Medication Response | 70 | 30 | 75 | 25 | 1.0 | 0.3173 |
Exercise Habits | 55 | 45 | 30 | 70 | 25.0 | <0.0001 |
Sleep Quality | 50 | 50 | 60 | 40 | 2.5 | 0.1138 |
McNemar Test Formula
The McNemar Test formula is:
chi^2 = (b - c)^2 / (b + c)
Where:
- b is the number of subjects who changed from negative to positive.
- c is the number of subjects who changed from positive to negative.
In a study involving 100 participants testing a new medication:
- 20 improved (changed from symptomatic to asymptomatic).
- 10 worsened (changed from asymptomatic to symptomatic).
Calculating the test statistic:
chi^2 = (20 - 10)^2 / (20 + 10) = 100 / 30 = 3.33
With 1 degree of freedom, if this chi^2 value exceeds the critical value (3.84 for alpha = 0.05), we reject the null hypothesis, concluding that there is a significant difference.
How to Calculate the McNemar Test
To perform the McNemar test:
- Create a 2×2 contingency table of before and after results.
- Identify the discordant pairs (b and c).
- Apply the formula: chi^2 = (b – c)^2 / (b + c).
- Compare the result to the chi-square distribution with 1 degree of freedom.
A study evaluates the effectiveness of a new teaching method.
Before:
- 60 students passed.
- 40 students failed.
After:
- 75 students passed.
- 25 students failed.
Before\After | Pass | Fail |
---|---|---|
Pass | 55 | 5 |
Fail | 20 | 20 |
Here, b (failed before, passed after) = 20 and c (passed before, failed after) = 5.
Calculating the test statistic:
chi^2 = (20 - 5)^2 / (20 + 5) = 225 / 25 = 9
With chi^2 = 9 and 1 degree of freedom, the p-value is approximately 0.0027, which is less than the typical significance level of 0.05. This indicates that the new teaching method had a statistically significant effect on student performance.