Puzzling behavior of ranksum

7 visualizaciones (últimos 30 días)
Paul
Paul el 3 de Mayo de 2017
Comentada: Star Strider el 24 de Jul. de 2017
I performed a ranksum test on two vectors of 80 and 88 entries, both with 0 median and in all respects fairly similar. I assumed ranksum would tell me the difference between the two vectors was insignificant but surprisingly ranksum returned a p < 0.05. I started playing around to try and understand the output better and came across the following puzzling behavior of ranksum:
As I added an identical number of 0's(5,10,20,50..) to the end of both vectors and redid the ranksum test, the p-value it output became smaller. The more 0's I added to both vectors the smaller the p-value I received upon testing. This seemed strange to me because by adding identical entries to both vectors all sample statistics should converge, right? And the more similar the sample statistics the more likely they were drawn from the same distribution?
I have been reading quite a lot about the Wilcoxon Rank Sum test but have not come across an explanation for this behavior. I'm not a statistician and I'm getting at the end of my wits here. If anybody could tell me what I'm missing it would be greatly appreciated!
Best, Paul

Respuestas (1)

Star Strider
Star Strider el 3 de Mayo de 2017
I’ve not used the Wilcoxon Rank-Sum test in a while, but as I recall (and a brief review just now supports, at least as I read it), the p-value is the probability that the two medians are different (or one greater or less than the other in a one-tailed test). So a low p-value would be interpreted to mean that the probability of different medians is low, and a high p-value the probability of different medians is high.
This is counter-intuitive with respect to the interpretation of the t-test, for example, where a low p-value indicates a low probability that the means are the same, and a high p-value a high probability that the means are the same.
I would be interested to read others’ interpretations and clarifications.
  4 comentarios
Paul
Paul el 24 de Jul. de 2017
Editada: Paul el 24 de Jul. de 2017
Hi Star Strider,
Sorry for the long radio silence. I moved on to do different things for a while but now I'm back with the same problem. First let me thank you again for your answer and code.
When I run your code (which is basically what I suggested you try), indeed I do get the same sensible results form ranksum that you find as well; adding zeros to two identically sized vectors and then testing their difference with ranksum returns a larger p-value than when testing without the 0-padding.
However, when I start with two vectors of dissimilar length, the p-value decreases with 0-padding. If you're still interested in humoring me, here's the code I used:
v1 = randi(30,30,1)
v2 = v1(5:end-5)
v3 = [v1;zeros(10,1)];
v4 = [v2;zeros(10,1)];
p1 = ranksum(v1,v2)
p2 = ranksum(v3,v4)
v1 =
27
17
2
3
17
8
29
8
29
18
8
14
25
4
11
7
2
28
22
30
12
22
8
20
7
3
24
24
29
4
v2 =
17
8
29
8
29
18
8
14
25
4
11
7
2
28
22
30
12
22
8
20
7
p1 =
0.8402
p2 =
0.6941
Star Strider
Star Strider el 24 de Jul. de 2017
My pleasure.
As I read it, larger vectors result in larger values for the test statistic, so a lower p-value. More data (with the same distribution) would reduce the p-value with every statistical test I’m familiar with.

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by