[R] Exact wilcoxon may differ in R and SPSS/StatXact (due to round off in the latter pair)

From: Nilsson Fredrik X <Fredrik.X.Nilsson_at_skane.se>
Date: Wed, 16 Jan 2008 13:12:02 +0100


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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Jan 2008 - 12:20:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Jan 2008 - 13:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive