McNemar's Chi-Square Test
In some experiments with two categorical variables, one of the variables specifies two or more groups of individuals that receive different treatments. In such situations, matching of individuals is often carried out in order to increase the precision of statistical inference. However, when matching is carried out, the observations usually are not independent. In such cases, the inference obtained from the chi-square test, Fisher's exact test, and Mantel-Haenszel test is not valid because these tests all assume independent observations.
McNemar's test allows you to obtain a valid inference for experiments where matching is carried out. McNemar's statistic is used to test the null hypothesis of symmetry-namely, that the probability of an observation being classified into cell [i,j] is the same as the probability of being classified into cell [j,i].
The returned p value should be interpreted carefully. Its validity depends on the assumption that the cell counts are at least moderately large. Even when cell counts are adequate, the chi-square is only a large-sample approximation to the true distribution of McNemar's statistic under the null hypothesis.
To perform McNemar's chi-square test
Choose Statistics Compare Samples
Counts and Proportions
McNemar's Chi-Square. The dialog shown below appears.
Data Set
Specify a data set.
Variable 1
Specify the factor column that contains the first classification variable. It must have at least 2 levels.
Variable 2
Specify the factor column that contains the other classification variable. This variable must have the same number of levels as the first classification variable.
Data Set is a Contingency Table
Select if the data set specified is a contingency table.
Options
Apply Continuity Correction
Check this to apply a correction for continuity. See the online Help for mcnemar.test for an algebraic definition of the continuity correction.
Results
Enter the name for the object in which to save the results of the analysis.
Print Results
Select this to print out the results of the analysis in the designated output window.
Related S-PLUS language functions:
mcnemar.test, print.htest, menuMcnemar