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, 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 two-fold: first, that the difference between p
A and p
B 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 by
T
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.