[R] Exact wilcoxon may differ in R and SPSS/StatXact (due to round off in the latter pair)
Nilsson Fredrik X
Fredrik.X.Nilsson at skane.se
Wed Jan 16 13:12:02 CET 2008
Dear R-users,
If you use the exact Wilcoxon test in the coin package, I would like
make you aware of that SPSS/StatXact MAY perform a round-off before
doing their exact Wilcoxon-Mann-Whitney test (if you ever are unlucky
enough not to use R).
I have data from two treatments and was surprised to find that SPSS (15
under Windows) and R differed in their p-values (0.167 resp. 0.172). It
turns out that SPSS rounds off an entry which is equal to
-0.899999999999999 to -0.9 (thus producing a tie at this position).
While the former entry probably is the result of some stupid algorithmic
twist in some software (take your guesses), I think that wilcox_exact in
the coin package is superior by not assuming that data are to be tied
when deemed close enough by some poor defined measure (but I'm biased).
Try wilcox_test(delta_hba1c~as.factor(Treatment), data=U,
distribution="exact")
And wilcox_test(signif(delta_hba1c,3)~as.factor(Treatment), data=U,
distribution="exact")
Thanks to Torsten Hothorn for discussing this with me and for producing
such a neat package (together with Kurt Hornik, Mark A. van de Wiel and
Achim Zeileis)!
Cheers,
Fredrik Nilsson.
My data: U a data frame with
"Treatment";"delta_hba1c"
1;-1.7
2;-1.9
1;0
1;-1.9
1;-1
1;-1.2
2;-1.7
2;-1.6
1;-0.9
2;-3.5
2;-3.1
1;-1.6
2;-1.2
2;-3.8
2;-0.899999999999999
2;-1.4
2;-1.2
1;-1.3
1;-1.6
2;-1.8
1;-1.5
1;-0.7
2;-0.7
2;0
2;-1.8
1;-1.2
1;-0.3
1;-2
1;-2.3
2;-5
2;-1.3
1;-2.6
2;-1.4
2;-3.6
2;-5.6
1;-1.7
More information about the R-help
mailing list