The Mann-Whitney U test is a non-parametric alternative to the independent samples t-test. It measures the difference between two samples, but unlike the t-test, it uses ranked data instead of the actual data values (Gravetter and Wallnau, 2013). Remember that non-parametric tests are used when the data do not meet the assumptions for parametric testing; that is why we use ranks instead to calculate the U value.
This wiki will walk you through an in-depth example of how to run a Mann-Whitney U test. We will use the dataset "Time traveled to work: Chicago vs. DC" to demonstrate how your data might look in ranks. This example uses 14 ranks with 7 scores in each sample, but it can be done with any number of ranks in any appropriate sample combination.
The first step to performing a Mann-Whitney U test is to convert the data from values into ranks. The ranks are based on the absolute values of each data value. To obtain appropriate ranks, combine the whole set of data and rank every value. For the Chicago and DC travel example, the values (20.8, 32, 25.6, 45, 26, 30, 54, 40, 46, 55, 68, 14, 62.5, 61) are ranked so that a rank of 1 corresponds to 14 (the lowest value) and 14 corresponds to 68 (the highest value).
If you have tied values in your data, there are special instructions for ranking them. Once they receive their position ranks, which is what we did for the Chicago and DC travel example above, take the average of the ranks and use that for both of the values' final ranks. For instance, if 2 of your values are ranked as 5 and 6 by position, then their final rank would be 5.5.
The final ranks for this data are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14.
Now that we have the ranks, we have to organize them by sample. Referring to the example data we have been using, the ranks for Chicago travel times are: 3, 9, 6, 11, 13, 2, 7. The ranks for DC travel times are: 14, 10, 1, 4, 12, 5, 8.
Next, we add up the ranks in each sample. The ∑R(Chicago) is 3 + 9 + 6 + 11 + 13 + 2 + 7 = 51. The ∑R(DC) is 14 + 10 + 1 + 4 + 12 + 5 + 8 = 54.
The U(Chicago) is calculated using this formula: U(Chicago)=(n(Chicago)⋅n(DC))+(n(Chicago)⋅(n(Chicago)+1)2)-(∑R(Chicago)). Plugging in the values, we have U(Chicago)=(7⋅7)+(7⋅7+12)-51=26.
The U(DC) is calculated using this formula: U(DC)=(n(Chicago)⋅n(DC))+(n(DC)⋅(n(DC)+1)2)-(∑R(DC)). Plugging in the values, we have U(DC)=(7⋅7)+(7⋅7+12)-54=23.
The Mann-Whitney U is the smaller of these two values, so U = 23.
We refer to the Mann-Whitney U Table of Critical Values in order to determine whether our U value of 23 is significant. For two samples of 7 each, the critical U value at alpha = .05 is 8. The U value obtained from data is only significant if it is less than or equal to the U value in the table, so with a U value of 23, we did not get significance.
Gravetter, F. J., & Wallnau, L. B. (2013). Statistics for the Behavioral Sciences. Wadsworth, A: Cengage Learning.
Mann-Whitney table produced by University of Massachusetts Boston - Social Psychology Department - Psych270 (Psychological Statistics).