A Mann-Whitney U-test (also called the rank-sum test, or Wilcoxin-Mann-Whitney test) uses sample data to test if a numeric outcome variable with any distribution differs across two independent groups. This test is an alternative to the two-sample independent t-test when the data fails the normality assumption or if the sample sizes in each group are too small to assess normality.
This test is run by ranking all observations and then finding the sum of the ranks in each group. If the values in one group are generally higher than in the other, the rank sums will differ. The test statistic, U (or W), is a measure of the difference in rank sums.
Note: This test does not test specifically if the mean or median of two groups are equal, only if the overall distributions are significantly different or not.
Assumptions:
Hypotheses:
Ho: The population distributions in the two groups are the same.
HA: The population distributions in the two groups are not the same.
Example 1: Hand calculation video
In this video, we’ll use a Mann-Whitney U-test to see if the distribution of weights of female and male mosquitoes are significantly different.
Sample conclusion: This data suggests that there is no difference in the weights of female and male mosquitoes (U=26, p>0.05).
Example 2: How to run in RStudio
This example tests if the number of days cats and dogs spend in the animal shelter before being adopted is the same.
Dataset used in video
R script file used in video
Sample conclusion: There is evidence to suggest that dogs and cats spend different lengths of time in the shelter before getting adopted (W=45.5, p<0.05).