Comparing two means – Mann-Whitney U test

The Mann-Whitney U test (also known as Wilcoxon rank-sum test) allows for comparison of two groups which do not necessarily originate from normal distributions. This means that you may use this test even if the samples have a normal distribution. This is thus a good alternative to Student’s t-test when the assumption of normality might constitute a problem.

The function to use in R is wilcox.test(x, y) where x and y are the vectors containing the samples. Let’s use the same example as we have use for Student’s t-test:


Skjermbilde 2016-06-14 11.27.06

So, the test results in a p-value greater than 0.05, thus indicating that the null hypothesis is not to be rejected. The sample means are not significantly different.