
MCNEMAR TESTName:
We can summarize the data in the following table. We call variable 1 X and variable 2 Y.
The McNemar test has the the following assumptions:
If we let P_{1} = P(X_{i} = 0, Y_{i} = 1) and P_{2} = P(X_{i} = 1, Y_{i} = 0), then the McNemar test can be formulated as follows.
where <y1> is the first response variable; <y2> is the second response variable; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used for the raw data case (i.e., <y1> and <y2> are variable containing 0's and 1's).
where <m> is a matrix containing the twoway table; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used for the case where we the data have already been crosstabulated into a twoway table.
where <n11> is a parameter containing the value for row 1, column 1 of a 2x2 table (i.e, a); <n12> is a parameter containing the value for row 1, column 2 of a 2x2 table (i.e., b); <n21> is a parameter containing the value for row 2, column 1 of a 2x2 table (i.e., c); <n22> is a parameter containing the value for row 2, column 2 of a 2x2 table (i.e., d). This syntax is used for the special case where you have a 2x2 table. In this case, you can enter the 4 values directly, although you do need to be careful that the parameters are entered in the order expected above.
MCNEMAR TEST M MCNEMAR TEST N11 N12 N21 N22
The McNemar test is also a special case of the Cochran test with c = 2 (enter HELP COCHRAN TEST for details).
STATCDF = the cdf for the McNemar test statistic
Fleiss, Levin, and Paik (2003), Statistical Methods for Rates and Proportions, Third Edition, p. 375.
let n11 = 63 let n21 = 4 let n12 = 21 let n22 = 12 . read matrix m 2 4 4 6 end of data . mcnear test n11 n21 n12 n22 mcnemar test mThe following output is generated. MCNEMAR TEST FOR NEW BETTER THAN OLD (2X2 TABLE) NULL HYPOTHESIS: NEW AND OLD ARE EQUAL ALTERNATIVE HYPOTHESIS: NEW AND OLD ARE NOT EQUAL  VARIABLE TWO  ROW VARIABLE ONE  SUCCESSES FAILURES  TOTAL ===================================================== SUCCESSES  63 21  84  0.940298 0.636364  FAILURES  4 12  16  0.059701 0.363636  ===================================================== COLUMN TOTAL  67 33  100 LARGE SAMPLE CASE (N >= 20) (CRITICAL VALUES BASED ON CHISQUARE WITH ONE DEGREE OF FREEDOM) WITHOUT CONTINUITY CORRECTION VALUE OF TEST STATISTIC = 11.56000 CDF OF TEST STATISTIC = 0.9993260 WITH CONTINUITY CORRECTION VALUE OF TEST STATISTIC = 10.24000 CDF OF TEST STATISTIC = 0.9986256 WITHOUT CONTINUITY CORRECTION NULL HYPOTHESIS NULL NULL CONFIDENCE CRITICAL ACCEPTANCE HYPOTHESIS HYPOTHESIS LEVEL VALUE INTERVAL CONCLUSION =================================================================== NEW/OLD EQUAL 50.0% 0.45 (0,0.500) REJECT NEW/OLD EQUAL 80.0% 1.64 (0,0.800) REJECT NEW/OLD EQUAL 90.0% 2.71 (0,0.900) REJECT NEW/OLD EQUAL 95.0% 3.84 (0,0.950) REJECT NEW/OLD EQUAL 99.0% 6.63 (0,0.990) REJECT WITH CONTINUITY CORRECTION NULL HYPOTHESIS NULL NULL CONFIDENCE CRITICAL ACCEPTANCE HYPOTHESIS HYPOTHESIS LEVEL VALUE INTERVAL CONCLUSION =================================================================== NEW/OLD EQUAL 50.0% 0.45 (0,0.500) REJECT NEW/OLD EQUAL 80.0% 1.64 (0,0.800) REJECT NEW/OLD EQUAL 90.0% 2.71 (0,0.900) REJECT NEW/OLD EQUAL 95.0% 3.84 (0,0.950) REJECT NEW/OLD EQUAL 99.0% 6.63 (0,0.990) REJECT MCNEMAR TEST FOR NEW BETTER THAN OLD (2X2 TABLE) NULL HYPOTHESIS: NEW AND OLD ARE EQUAL ALTERNATIVE HYPOTHESIS: NEW AND OLD ARE NOT EQUAL  VARIABLE TWO  ROW VARIABLE ONE  SUCCESSES FAILURES  TOTAL ===================================================== SUCCESSES  2 4  6  0.333333 0.400000  FAILURES  4 6  10  0.666667 0.600000  ===================================================== COLUMN TOTAL  6 10  16 SMALL SAMPLE CASE (N < 20) (CRITICAL VALUES BASED ON BINOMIAL WITH P = 0.5 AND N = 8) VALUE OF TEST STATISTIC = 4.000000 CDF OF TEST STATISTIC = 0.6367188 LOWER UPPER NULL HYPOTHESIS NULL NULL CONFIDENCE CRITICAL CRITICAL ACCEPTANCE HYPOTHESIS HYPOTHESIS LEVEL VALUE VALUE INTERVAL CONCLUSION ============================================================================= NEW/OLD EQUAL 50.0% 3.00 5.00 (0.250,0.750) ACCEPT NEW/OLD EQUAL 80.0% 2.00 6.00 (0.100,0.900) ACCEPT NEW/OLD EQUAL 90.0% 2.00 6.00 (0.050,0.950) ACCEPT NEW/OLD EQUAL 95.0% 1.00 7.00 (0.025,0.975) ACCEPT NEW/OLD EQUAL 98.0% 1.00 7.00 (0.010,0.990) ACCEPT NEW/OLD EQUAL 99.0% 1.00 7.00 (0.005,0.995) ACCEPT  
Date created: 01/15/2008 Last updated: 12/11/2023 Please email comments on this WWW page to alan.heckert@nist.gov. 