I've recently looked into the Wilcoxon Rank Sum test for comparing groups of continuous values. In particular I've been using R's wilcox.test()
function for this task.
While using the test on my real data I noticed I wasn't getting any instances of the test rejecting the alternative hypothesis and all outputs always said alternative hypothesis: true location shift is not equal to 0
. I proceeded to do a quick test in R to see how a rejected alternative hypothesis result would look like:
>test1 <- c(1, 2, 3, 4, 5)
>test2 <- c(1, 2, 3, 4, 5)
>test <- wilcox.test(test1, test2, alt="two.sided")
I was totally expecting a rejected alternative hypothesis here since both groups of values are equal but oh surprise:
> test
Wilcoxon rank sum test with continuity correction
data: test1 and test2
W = 12.5, p-value = 1
alternative hypothesis: true location shift is not equal to 0
By no means I'm experienced using Wilcoxon test, but I really can't see why the alternative hypothesis is accepted in this case. I know that the null hypothesis for this test expects the median of both groups to be equal, so I can't really tell why the example above didn't work as expected. Maybe this could be a matter of result interpretation in R? What would be a small example in which the alternative hypothesis would be rejected then?
alternative hypothesis: true location shift is not equal to zero
is just telling you what the alternative hypothesis is. It's not telling you the result of the test. For the test result, look to the reported p value. $\endgroup$