Solved – What does the W value in Wilcoxon test mean

rwilcoxon-mann-whitney-test

I carried out a wilcoxon test (using wilcox.test in R) in 2 sample groups of size 135 and 48.

My results in r where:

wilcox.test(raj_reps.a, raj_reps.b)

Wilcoxon rank sum test with continuity correction

data:  raj_reps.a and raj_reps.b
W = 2359.5, p-value = 0.005217
alternative hypothesis: true location shift is not equal to 0

My H0 was that the groups are equal in means, the alternative hypothesis was that the values in group a are different (lower) than in group b.

Can I accept H0? as the p-value is lower than 0.05?

What exactly means the W value? I read about it and found out its the number of ranks and used as critical value which I can look up in tables. Unfortunately most of the tables are not covering such huge sample sizes.
Can anyone tell me if this high W means, that I can accept H0 or do I have to reject it?

Best Answer

The Wilcoxon test does not test for equality of means, rather it tests

$$H_0: P(X_a > X_b) = 0.5$$

namely that a randomly drawn observation of group a has 50% chance of being larger than a randomly drawn observation from group b. Only if you see location-shift (i.e. distributions in both groups have the same shape but different mean (location)) than you can formulate your conclusion in terms of means. With the P-value you have you can reject $H_0$ on the 5% significance level. The $W$ is the Wilcoxon test statistic and is, as the name says, the sum of the ranks in one of both groups. You could enumerate the exact distribution of $W$ under $H_0$ by typing

    wilcox.test(raj_reps.a, raj_reps.b, exact=TRUE)

This is very computer-intensive, so usually for such large sample sizes the asymptotic normality of $W$ is used for calculating the p-value, see ?wilcox.test