McNemar (Concordence of paired proportions)

Enter the name for this tabbed section: Description
The McNemar test is designed to test the concordance of paired proportions. It is applied to 2 x 2 contingency tables in which the dichotomous status is measured on the same subjects (in the statistical sense).
For instance, we could compare the results of 2 diagnostic methods on the same patients or the proportion of satisfaction before and after a certain treatment of change. We could for instance imagines paris of twins randomly assigned to a treatment and a control. In each group, the twin could either pass or fail a particular test.
Enter the name for this tabbed section: R Syntax
In R, the test can be performed using the syntax :

mcnemar {stats}

mcnemar.test(m)
  • m is a 2x2 matrix of frequencies.
R assumes that the frequencies are provided in a tabular format (table or matrix).
Enter the name for this tabbed section: Code Example
McNemar

The mcNemar test is a particular version of the Chi-square test designed to work on paired experimental subjects. Imagine that we have a class of 27 students and we ask them to take a “skill test” in Statistics just after and one week after viewing a tutorial video. The result of the test is a pass/fail mark. The question we would like to know is if there is a difference in skills after one week. We need first to create the data: After 1 Week After Pass Fail Pass 6 14 Fail 2 5 This can be interpreted as 6 students passed both tests, but 14 students passed immediately after the tutorial but failed to do so 1 week later. 2 students failed both times and 5 students actually passed one week later whereas they fail the first test.

datmc <- matrix(c(6,14,2,5), nrow = 2)
  mcnemar.test(datmc)
## 
##  McNemar's Chi-squared test with continuity correction
## 
## data:  datmc
## McNemar's chi-squared = 7.5625, df = 1, p-value = 0.00596

The results of the tests suggest that indeed the passing and failing changes accroding to time (p-value = 0.00596). the distribution of pass and fail differs between the two exams: not very encouring from a pedagogical perspective.

In this second example, we keep the same number of students, but now the who succeeded both tests or failed both tests are much larger than the changes…. After 1 Week After Pass Fail Pass 16 3 Fail 5 3

datmc <- matrix(c(15,3,5,3), nrow = 2)
mcnemar.test(datmc)
## 
##  McNemar's Chi-squared test with continuity correction
## 
## data:  datmc
## McNemar's chi-squared = 0.125, df = 1, p-value = 0.7237

The results are now different. Most of the students passed both test, although some did improve over time… McNemar test tells us there is no significant difference in proportion over time.