[R] McNemar test in R & SPSS

Bob Green bgreen at dyson.brisnet.org.au
Tue Dec 26 22:27:00 CET 2006


Hello,

I am hoping someone can clarify why I might obtain a quite different value 
in R & SPSS  for a McNemar test I ran.

Firstly, here is the R syntax & output


R OUTPUT

 > mctest <- as.table(matrix(c(128,29,331,430),
+ ncol =2, dimnames = list(group=c("preMHT","postMHT"),
+ assault=c("yes","no"))))

 > mctest
               assault
group       yes  no
   preMHT  128 331
   postMHT  29 430

 >  mcnemar.test(mctest,correct=F)

         McNemar's Chi-squared test

data:  mctest
McNemar's chi-squared = 253.3444, df = 1, p-value < 2.2e-16


SPSS OUTPUT

The same data was inputted in SPSS. Regarding the first table SPSS 
generated - it lists the number of cases in each combination of categories. 
The diagonal contains the number of cases with the same response on both 
variables, while the off diagonal contains cases that have different 
responses on the 2 variables. The overall chisquare value is much lower 
than the value obtained using R, though still significant.


pre02 & post02

pre02   post02

         0       1
0       311     20
1       119     9


Test Statistics(b)

  pre02 & post02

N               459
Chi-Square(a)   69.094
Asymp. Sig.     .000

a  Continuity Corrected
b  McNemar Test


Any assistance is much appreciated,

Bob Green



More information about the R-help mailing list