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 matchedpair 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}
p_{A} = 30/100 = .30 and^{T}_{T}
p_{B} = 40/100 = .40^{T}
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}
p_{A} = 30/100 = .30 and^{T}_{T}
p_{B} = 40/100 = .40^{T}
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

p_{A} = (a+b)/N_{T} p_{B} = (a+c)/N

Although the McNemar test bears a superficial resemblance to a test of categorical association, as might be performed by a 2x2 chisquare 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:
p_{A}=(a+b)/N and p_{B}=(a+c)/N. The question in the McNemar test is: do these two proportions, p
_{A} and p_{B}, significantly differ? And the answer it receives must take into account the fact that the two proportions are
not independent. The correlation of p
_{A} and p_{B} 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 twofold: first, that the difference between p
_{A} and p_{B} reduces, both algebraically and conceptually, to the difference between
b and
c in the bluetinted diagonal cells of the table; and second, that
b and c belong to a binomial distribution defined by
_{T}
n=b+c; p=0.5; and q=0.5
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.
Home
 Click this link only if you did not arrive here via the VassarStats main page.

©Richard Lowry 2001
All rights reserved.