McNemar Chisquare and Exact test for Matched Pairs
Menu locations:
Analysis_Exact_Matched Pairs;
Analysis_Chisquare_McNemar.
Paired proportions have traditionally been compared using McNemar's test but an exact alternative due to Liddell (1983) is preferable. StatsDirect gives you both.
The exact test is a special case of the sign test. The b count in the table below is treated as a binomial variable from the sample b+c. Using the ratio R' (R' = b/c) as a point estimate of relative risk, a two sided probability is calculated that R' = 1 (the null hypothesis). The test statistic F=b/(c+1).
Confidence limits for R' are calculated as follows:
 where F(α/2, n, d) is a quantile from the F distribution with n and d degrees of freedom.
You should use the exact test for analysis; McNemar's test is included for interest only.
If you need the exact confidence interval for the difference between a pair of proportions then please see paired proportions.
DATA INPUT:
Observed frequencies should be entered as a paired fourfold table:


Control/reference category: 



outcome present 
outcome absent 
Case/index category: 
outcome present: 
a 
b 
outcome absent: 
c 
d 
Example
From Armitage and Berry (1994, p. 127).
The data below represent a comparison of two media for culturing Mycobacterium tuberculosis. Fifty suspect sputum specimens were plated up on both media and the following results were obtained:


Medium B: 



Growth 
No Growth 
Medium A: 
Growth: 
20 
12 

No Growth: 
2 
16 
To analyse these data in StatsDirect you should select the McNemar function from the chisquare section of the analysis menu. Select the default 95% confidence interval. Enter the counts into the table as shown above.
For this example:
McNemar's test:
Yates' continuity corrected Chi² = 5.785714 P = 0.0162
After Liddell (1983)Refs:
Point estimate of relative risk (R') = 6
Exact 95% confidence interval = 1.335744 to 55.197091
F = 4, P (two sided) = 0.0129
R' is significantly different from unity
Here we can conclude that the tubercle bacilli in the experiment grew significantly better on medium A than on medium B. With 95% confidence we can state that the chances of a positive culture are between 1.34 and 55.20 times greater on medium A than on medium B.