McNemar's test compares proportions that are observed before and after a treatment. For example, you can use McNemar's test to determine whether a training program changes the proportion of participants who correctly answer a question.
Observations for McNemar's test can be summarized in a two-by-two table, as shown below.
|| After Treatment
||Condition Not True
|Condition Not True
The condition for the training example is a correct answer. Thus, n21 represents the number of participants who answer the question correctly after training but not before training. And n12 represents the number of participants who answer the question correctly before training but not after training. The total number of participants is represented by n...
Let δ be the difference between the marginal probabilities, p1.- p.1, in the population. The estimated difference, , is given by the following formula:
An approximate 100(1 – α)% confidence interval is given by the following formula:
where α is the significance level for the test, z α/2 is the z-score associated with a tail probability of α/2, and SE is given by the following formula:
The null hypothesis is δ = 0. The exact p-value for the test of the null hypothesis is calculated as:
where X is a random variable that is drawn from a binomial distribution with an event probability of 0.5 and a number of trials equal to n21 + n12.