Given two paired variables where each variable has exactly two possible outcomes (coded as 0 and 1), the McNemar test can be used to test if there is a statistically significant difference between the probability of a (0,1) pair and the probability of a (1,0) pair. For example, this test is often used for the situation where we are testing for the prescence (= 1) or absence (= 0) of something and variable 1 is the state before an experiment and variable 2 is the state after the experiment (i.e., did the experiment have an effect?).
We can summarize the data in the following table. We call variable 1 X and variable 2 Y.
Yi = 0 Yi = 1
Xi = 0 a b
Xi = 1 c d
The McNemar test has the the following assumptions:
The pairs (Xi,Yi) are mutually independent.
Each Xi and Yi can be assigned to one of two possible categories.
The difference