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.