McNemar's Test
For Correlated Proportions in the Marginals of a 2x2 Contingency Table
McNemar's test assess the significance of the difference between two correlated proportions, such as might be found in the case where the two proportions are based on the same sample of subjects or on matched-pair samples.

Subject's Measure
on Variable B

  1  
0
Totals
Subject's Measure
on Variable A

 1 
25
5
30
 0 
15
55
70
Totals
40
60
100
Individual Subjects Assessed with Respect to Two Dichotomous Variables. Suppose that 100 subjects are each assessed with respect to two dichotomous categorical variables, A and B. If the temporal sequence of the two measures is relevant, Variable A can be defined as the "before" measure and Variable B as the "after" measure. The results are coded as "1" for those subjects that display the property defined by the variable in question and as "0" for those that do not display that property. The marginal proportions in this example are:T
     pA = 30/100 = .30    andTT
     pB = 40/100 = .40T

That is: 30% of the subjects display the characteristic defined by Variable A and 40% display the characteristic defined by Variable B.


Measure for
 Pair Member B 
(Control)

  1  
0
Totals
Measure for
 Pair Member A 
(Case)

 1 
25
5
30
 0 
15
55
70
Totals
40
60
100
Matched Pairs of Subjects Assessed with Respect to One Dichotomous Variable. Suppose that 100 matched pairs of subjects are each assessed with respect to a single categorical variable. One member of each pair is the "A" member and the other is the "B" member. Alternatively, in the language of clinical research, one member of each pair is the "case" and the other is the "control." In the present example, 25 of the matched pairs have both the A and the B member showing the characteristic in question; 5 have the A member but not the B member showing the characteristic; and so on. Here again, the marginal proportions are:T
     pA = 30/100 = .30    andTT
     pB = 40/100 = .40T

That is: the characteristic in question is displayed by 30% of the A (or Case) members and by 40% of the B (or Control) members.

General
Structure

B
 1 
0
Totals
A
1
a
b
a+b
0
c
d
c+d
Totals
a+c
b+d
N=a+b+c+d
pA = (a+b)/NT
pB = (a+c)/N
Although the McNemar test bears a superficial resemblance to a test of categorical association, as might be performed by a 2x2 chi-square test or a 2x2 Fisher exact probability test, it is doing something quite different. The test of association examines the relationship that exists among the cells of the table, as marked in the adjacent General Structure by a, b, c, and d. The McNemar test examines the difference between the proportions that derive from the marginal sums of the table: pA=(a+b)/N and pB=(a+c)/N. The question in the McNemar test is: do these two proportions, pA and pB, significantly differ? And the answer it receives must take into account the fact that the two proportions are not independent. The correlation of pA and pB is occasioned by the fact that both include the quantity a in the upper left cell of the table.

The core insight of McNemar's test is two-fold: first, that the difference between pA and pB reduces, both algebraically and conceptually, to the difference between b and c in the blue-tinted diagonal cells of the table; and second, that b and c belong to a binomial distribution defined byT
    n=b+c;  p=0.5;  and  q=0.5

The basic concepts and computational details of binomial probabilities are described
in Chapters 5 & 6 of Concepts and Applications of Inferential Statistics.

The present page will perform McNemar's test using exact binomial probability calculations when b+c is equal to or less than 1000; for values of b+c greater than 1000, the binomial approximation of the normal distribution will be used. To perform the test, enter the appropriate numerical values into the cells of the following table, then click the «Calculate» button. The page will also calculate the odds ratio of the discordant cells b and c and the .95 confidence interval of this odds ratio.


B
1 0 Totals
 A    1  
  0  
Totals
Proportions  Difference
(Unsigned)
 pA 
 pB 
McNemar Test Result
Two-Tail
One-Tail
For Discordant Cells:T
Number of cases with
A=1 and B=0
Number of cases with
A=0 and B=1
Odds Ratio
  (larger/smaller)
.95 Confidence Interval of Odds Ratio
  Upper Limit
  Lower Limit
Note that the confidence interval is calculated only if b+c ≥ 10.



Home Click this link only if you did not arrive here via the VassarStats main page.


©Richard Lowry 2001-
All rights reserved.