This repository was archived by the owner on Nov 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
Wilcoxon Signed Rank Test for PAIRED samples: TwoSampleWilcoxonSignedRankTest #848
Copy link
Copy link
Closed
Labels
Milestone
Description
Hello,
I am experiencing severe problems with the results from the Wilcoxon Signed Rank test for PAIRED samples. I am using the TwoSampleWilcoxonSignedRankTest class for that, which actually says in the documentation "Wilcoxon signed-rank test for paired samples".
The differences are not just marginal but huge.
Here you can find a sample, showing the difference
R-Code (can be executed here)
a <- c(600, 250, 550, 350, 300, 400, 300, 100, 250, 400, 200, 650, 300, 250, 550,
100, 450, 500, 300, 250, 750, 300, 450, 450, 150, 450, 450, 200, 450, 200, 500,
500, 300, 250, 250)
b <- c(250, 300, 550, 450, 300, 300, 450, 250, 50, 400, 250, 650, 300, 200, 450,
100, 350, 150, 300, 150, 500, 200, 450, 400, 200, 300, 350, 300, 250, 500, 450,
500, 250, 50, 50)
wilcox.test(a,b, paired=TRUE, alternative="two.sided") # V=258, p-Value=0.0361
wilcox.test(a,b, paired=TRUE, alternative="less") # V=258, p-Value=0.9831
wilcox.test(a,b, paired=TRUE, alternative="greater") # V=258, p-Value=0.01805
C#-Code
var s1 = new double[]
{
600, 250, 550, 350, 300, 400, 300, 100, 250, 400, 200, 650, 300, 250, 550,
100, 450, 500, 300, 250, 750, 300, 450, 450, 150, 450, 450, 200, 450, 200,
500, 500, 300, 250, 250
};
var s2 = new double[]
{
250, 300, 550, 450, 300, 300, 450, 250, 50, 400, 250, 650, 300, 200, 450,
100, 350, 150, 300, 150, 500, 200, 450, 400, 200, 300, 350, 300, 250, 500,
450, 500, 250, 50, 50
};
var r1 = new TwoSampleWilcoxonSignedRankTest(s1, s2, exact: false);
// Result: p-Value: 0.35474665884716949
var r2 = new TwoSampleWilcoxonSignedRankTest(s1, s2, exact: false,
alternate: TwoSampleHypothesis.FirstValueIsGreaterThanSecond);
// Result: p-Value: 0.82685266203536745
var r3 = new TwoSampleWilcoxonSignedRankTest(s1, s2, exact: false,
alternate: TwoSampleHypothesis.FirstValueIsSmallerThanSecond);
// Result: p-Value: 0.17737332942358475
You can see the differences:
- for two-sided: 0.0361 from R vs. 0.35474665884716949 from Accord
- for less: 0.9831 from R vs. 0.82685266203536745 from Accord
- for greater: 0.01805 from R vs. 0.17737332942358475 from Accord
As these tests are a critical function in our current product, I would need an urgent fix for this.
Maybe this is also related to my other reported bugs: #389
If you need, I could provide more test data samples.
Cheers,
Harald
cesarsouzahkoestin