# Mann-Whitney tests give same output

I am looking for some advice regarding the Mann-Whitney U test. I have a dataset consisting of two indices (Index_1 and Index_2) measured under two conditions (A and B). The sample sizes are small ($n=$5 for each condition).

Condition  Index_1  Index_2
A   1.0040242   1.2553715
A   1.3520534   1.74602
A   0.9449538   1.1698796
A   0.9852742   1.3240154
A   1.5320312   2.0959063
B   0.4457907   0.7175904
B   0.3815555   0.5997045
B   0.3720059   0.5654503
B   0.4648043   0.6231635
B   0.4833657   0.723848


When I apply a Mann-Whitney U test for each index I find that the output from the two tests is identical:

> wilcox.test(Index_1~Condition)

Wilcoxon rank sum test

data:  Index_1 by Condition
W = 25, p-value = 0.007937
alternative hypothesis: true location shift is not equal to 0

> wilcox.test(Index_2~Condition)

Wilcoxon rank sum test

data:  Index_2 by Condition
W = 25, p-value = 0.007937
alternative hypothesis: true location shift is not equal to 0


This is puzzling to me, as no other statistical test applied to this data (Kruskal-Wallis or t test) gives two identical outputs. Specifying paired=F does not make a difference.

Is this a result of the small sample sizes? Unfortunately this can't be remedied and I have to present some sort of result for this dataset.

From the help for wilcox.test

[...] if both x and y are given and paired is FALSE, a Wilcoxon rank sum test (equivalent to the Mann-Whitney test: see the Note) is carried out. In this case, the null hypothesis is that the distributions of x and y differ by a location shift of mu and the alternative is that they differ by some other location shift (and the one-sided alternative "greater" is that x is shifted to the right of y).

.

R's [Mann-Whitney] value can also be computed as the number of all pairs (x[i], y[j]) for which y[j] is not greater than x[i], the most common definition of the Mann-Whitney test.

The ranks of both indices are 1-5 for condition A and 6-10 for condition B. You get identical results because the value above is identical is both cases.

The common thing in both cases is, that each index in A is larger than each index in B and there are 5 cases. Try any other comparison, in which 5 out of 5 are larger then in the other group (but with no ties), and you will find that particular p, e. g.

> wilcox.test(1:5, 6:10)

Wilcoxon rank sum test

data:  1:5 and 6:10
W = 0, p-value = 0.007937
alternative hypothesis: true location shift is not equal to 0


Recognise that p-value? Oh, but the W is wrong. Let'S do it the other way around:

> wilcox.test(6:10, 1:5)

Wilcoxon rank sum test

data:  6:10 and 1:5
W = 25, p-value = 0.007937
alternative hypothesis: true location shift is not equal to 0


Now W and p fit.