13.5 Mann-Whitney U Test
The Mann-Whitney U Test is the non-parametric alternative to the independent t-test. The test was expanded on Frank Wilcoxon’s Rank Sum test by Henry Mann and Donald Whitney.

The independent t-test assumes the populations are normally distributed. When these conditions are not met, the Mann-Whitney Test is an alternative method.
If two groups come from the same distribution and were randomly assigned labels, then the two different groups should have values somewhat equally distributed between the two groups. The Mann-Whitney Test looks at all the possible rankings between the data points. For large sample sizes, a normal approximation of the distribution of ranks is used.
Small Sample Size Case
Combine the data from both groups and sort from smallest to largest. Make sure to label the data values so you know which group they came from. Rank the data. Sum the ranks separately from each group. Let = sum of ranks for group one and = sum of ranks for group two.
Find the statistic for both groups: .
The test statistic is the smaller of or . For the two-sided test without ties, critical values are given in Figure 13-8 and Figure 13-9 .
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | - | - | - | - | - | - | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 |
| 3 | - | - | - | 0 | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 4 | 5 | 5 | 6 | 6 | 7 | 7 | 8 |
| 4 | - | - | 0 | 1 | 2 | 3 | 4 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 11 | 12 | 13 | 14 |
| 5 | - | 0 | 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 |
| 6 | - | 1 | 2 | 3 | 5 | 6 | 8 | 10 | 11 | 13 | 14 | 16 | 17 | 19 | 21 | 22 | 24 | 25 | 27 |
| 7 | - | 1 | 3 | 5 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 |
| 8 | 0 | 2 | 4 | 6 | 8 | 10 | 13 | 15 | 17 | 19 | 22 | 24 | 26 | 29 | 31 | 34 | 36 | 38 | 41 |
| 9 | 0 | 2 | 4 | 7 | 10 | 12 | 15 | 17 | 20 | 23 | 26 | 28 | 31 | 34 | 37 | 39 | 42 | 45 | 48 |
| 10 | 0 | 3 | 5 | 8 | 11 | 14 | 17 | 20 | 23 | 26 | 29 | 33 | 36 | 39 | 42 | 45 | 48 | 52 | 55 |
| 11 | 0 | 3 | 6 | 9 | 13 | 16 | 19 | 23 | 26 | 30 | 33 | 37 | 40 | 44 | 47 | 51 | 55 | 58 | 62 |
| 12 | 1 | 4 | 7 | 11 | 14 | 18 | 22 | 26 | 29 | 33 | 37 | 41 | 45 | 49 | 53 | 57 | 61 | 65 | 69 |
| 13 | 1 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 33 | 37 | 41 | 45 | 50 | 54 | 59 | 63 | 67 | 72 | 76 |
| 14 | 1 | 5 | 9 | 13 | 17 | 22 | 26 | 31 | 36 | 40 | 45 | 50 | 55 | 59 | 64 | 69 | 74 | 78 | 83 |
| 15 | 1 | 5 | 10 | 14 | 19 | 24 | 29 | 34 | 39 | 44 | 49 | 54 | 59 | 64 | 70 | 75 | 80 | 85 | 90 |
| 16 | 1 | 6 | 11 | 15 | 21 | 26 | 31 | 37 | 42 | 47 | 53 | 59 | 64 | 70 | 75 | 81 | 86 | 92 | 98 |
| 17 | 2 | 6 | 11 | 17 | 22 | 28 | 34 | 39 | 45 | 51 | 57 | 63 | 69 | 75 | 81 | 87 | 93 | 99 | 105 |
| 18 | 2 | 7 | 12 | 18 | 24 | 30 | 36 | 42 | 48 | 55 | 61 | 67 | 74 | 80 | 86 | 93 | 99 | 106 | 112 |
| 19 | 2 | 7 | 13 | 19 | 25 | 32 | 38 | 45 | 52 | 58 | 65 | 72 | 78 | 85 | 92 | 99 | 106 | 113 | 119 |
| 20 | 2 | 8 | 14 | 20 | 27 | 34 | 41 | 48 | 55 | 62 | 69 | 76 | 83 | 90 | 98 | 105 | 112 | 119 | 127 |
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | 0 | 0 |
| 3 | - | - | - | - | - | - | - | 0 | 0 | 0 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 3 | 3 |
| 4 | - | - | - | - | 0 | 0 | 1 | 1 | 2 | 2 | 3 | 3 | 4 | 5 | 5 | 6 | 6 | 7 | 8 |
| 5 | - | - | - | 0 | 1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 6 | - | - | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 |
| 7 | - | - | 0 | 1 | 3 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 24 |
| 8 | - | - | 1 | 2 | 4 | 6 | 7 | 9 | 11 | 13 | 15 | 17 | 18 | 20 | 22 | 24 | 26 | 28 | 30 |
| 9 | - | 0 | 1 | 3 | 5 | 7 | 9 | 11 | 13 | 16 | 18 | 20 | 22 | 24 | 27 | 29 | 31 | 33 | 36 |
| 10 | - | 0 | 2 | 4 | 6 | 9 | 11 | 13 | 16 | 18 | 21 | 24 | 26 | 29 | 31 | 34 | 37 | 39 | 42 |
| 11 | - | 0 | 2 | 5 | 7 | 10 | 13 | 16 | 18 | 21 | 24 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 |
| 12 | - | 1 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 31 | 34 | 37 | 41 | 44 | 47 | 51 | 54 |
| 13 | - | 1 | 3 | 7 | 10 | 13 | 17 | 20 | 24 | 27 | 31 | 34 | 38 | 42 | 45 | 49 | 53 | 57 | 60 |
| 14 | - | 1 | 4 | 7 | 11 | 15 | 18 | 22 | 26 | 30 | 34 | 38 | 42 | 46 | 50 | 54 | 58 | 63 | 67 |
| 15 | - | 2 | 5 | 8 | 12 | 16 | 20 | 24 | 29 | 33 | 37 | 42 | 46 | 51 | 55 | 60 | 64 | 69 | 73 |
| 16 | - | 2 | 5 | 9 | 13 | 18 | 22 | 27 | 31 | 36 | 41 | 45 | 50 | 55 | 60 | 65 | 70 | 74 | 79 |
| 17 | - | 2 | 6 | 10 | 15 | 19 | 24 | 29 | 34 | 39 | 44 | 49 | 54 | 60 | 65 | 70 | 75 | 81 | 86 |
| 18 | - | 2 | 6 | 11 | 16 | 21 | 26 | 31 | 37 | 42 | 47 | 53 | 58 | 64 | 70 | 75 | 81 | 87 | 92 |
| 19 | 0 | 3 | 7 | 12 | 17 | 22 | 28 | 33 | 39 | 45 | 51 | 57 | 63 | 69 | 74 | 81 | 87 | 93 | 99 |
| 20 | 0 | 3 | 8 | 13 | 18 | 24 | 30 | 36 | 42 | 48 | 54 | 60 | 67 | 73 | 79 | 86 | 92 | 99 | 105 |
If is less than or equal to the critical value, then reject . Dashes indicate that the sample is too small to reject .
If you have only sample size above 20, use the following online calculator to find the critical value: https://www.socscistatistics.com/tests/mannwhitney/default.aspx.
Normal Approximation Case (adequate sample sizes)
Find the statistic for both groups: , .
Let , the smaller of or . The formula for the test statistic is:
Example 2
A manager wants to know whether weekly coffee sales differ between the Portland and Cannon Beach stores. They take a random sample of weekly sales from the two stores over the last year. Use a two-sided Mann-Whitney test, with the p-value method and .
Editorial clarification: The original question asked whether Portland sales were greater, but its worked hypotheses, doubled tail probability, and conclusion all tested a difference in either direction. This web-edition question explicitly adopts that two-sided alternative. The calculation below does not answer the original directional question.
Try it in XYZ Crunch
Two-tailed p-value for the large-sample U
With U = 190.5 the normal approximation gives z = -0.7429. The first link shades the tail below it: about 0.228771; doubling the unrounded tail and then rounding gives the book's p-value of 0.4575 (doubling the rounded one-tail display 0.2288 gives 0.4576), far above alpha = 0.05. The second link is the critical-value route to the same decision, inverse normal at 0.025 for +/-1.96. Try area 0.05 instead and you get -1.645, which is why the tail area for a two-tailed alpha = 0.05 has to be 0.025.
| Portland | Cannon Beach | ||
|---|---|---|---|
| 1510 | 1257 | 3585 | 1510 |
| 4125 | 4677 | 4399 | 5244 |
| 1510 | 3055 | 1764 | 1510 |
| 5244 | 1764 | 3853 | 4399 |
| 4125 | 6128 | 5244 | 1510 |
| 6128 | 3319 | 1510 | 5244 |
| 3319 | 6433 | 2533 | 4125 |
| 3319 | 5244 | 3585 | 2275 |
| 3055 | 6134 | 2533 | 2275 |
| 4025 | 3015 | 4399 | 3585 |
| 4125 | 5244 | ||
Show solution
For the small-sample table, label the smaller sample as group 1. We keep that convention here, so Portland is group 1; the normal approximation uses the smaller of the two U values and is unchanged if the group labels are exchanged. (If the sample sizes are equal, then whatever group comes first in the problem is group one.) If there are no ties at the end, the last rank should match the total of both sample sizes.
Combine the data, keeping the group label, then rank the combined data.
| Order | Store | Sales | Rank | Order | Store | Sales | Rank | |
|---|---|---|---|---|---|---|---|---|
| 1 | Portland | 1257 | 1 | 22 | Cannon Beach | 3585 | 21 | |
| 2 | Portland | 1510 | 4.5 | 23 | Cannon Beach | 3853 | 23 | |
| 3 | Portland | 1510 | 4.5 | 24 | Portland | 4025 | 24 | |
| 4 | Cannon Beach | 1510 | 4.5 | 25 | Portland | 4125 | 26.5 | |
| 5 | Cannon Beach | 1510 | 4.5 | 26 | Portland | 4125 | 26.5 | |
| 6 | Cannon Beach | 1510 | 4.5 | 27 | Cannon Beach | 4125 | 26.5 | |
| 7 | Cannon Beach | 1510 | 4.5 | 28 | Cannon Beach | 4125 | 26.5 | |
| 8 | Portland | 1764 | 8.5 | 29 | Cannon Beach | 4399 | 30 | |
| 9 | Cannon Beach | 1764 | 8.5 | 30 | Cannon Beach | 4399 | 30 | |
| 10 | Cannon Beach | 2275 | 10.5 | 31 | Cannon Beach | 4399 | 30 | |
| 11 | Cannon Beach | 2275 | 10.5 | 32 | Portland | 4677 | 32 | |
| 12 | Cannon Beach | 2533 | 12.5 | 33 | Portland | 5244 | 35.5 | |
| 13 | Cannon Beach | 2533 | 12.5 | 34 | Portland | 5244 | 35.5 | |
| 14 | Portland | 3015 | 14 | 35 | Cannon Beach | 5244 | 35.5 | |
| 15 | Portland | 3055 | 15.5 | 36 | Cannon Beach | 5244 | 35.5 | |
| 16 | Portland | 3055 | 15.5 | 37 | Cannon Beach | 5244 | 35.5 | |
| 17 | Portland | 3319 | 18 | 38 | Cannon Beach | 5244 | 35.5 | |
| 18 | Portland | 3319 | 18 | 39 | Portland | 6128 | 39.5 | |
| 19 | Portland | 3319 | 18 | 40 | Portland | 6128 | 39.5 | |
| 20 | Cannon Beach | 3585 | 21 | 41 | Portland | 6134 | 41 | |
| 21 | Cannon Beach | 3585 | 21 | 42 | Portland | 6433 | 42 |
The hypotheses are:
: There is no difference in the coffee sales between the Portland and Cannon Beach stores.
: There is a difference in the coffee sales between the Portland and Cannon Beach stores.
Sum the ranks for each group.
The sum for the Portland store’s ranks: .
The sum for the Cannon Beach store’s ranks: .
Compute the test statistic:
Using the simplified normal approximation above, the two-sided p-value for is . This hand calculation uses the unadjusted variance and no continuity correction; with the tied sales values, it is an approximation, not an exact p-value. Adjusting the variance for the observed ties, still without continuity correction, gives approximately and a two-sided p-value of 0.4557. Both methods lead to the same decision at the 5% significance level. The calculator illustration below reproduces the simplified calculation.

The p-value = ; therefore, do not reject .
This is a two-tailed test with . Each tail has area . The corresponding standard-normal critical values are approximately -1.96 and 1.96.
There is not enough evidence to support the claim that there is a difference in coffee sales between the Portland and Cannon Beach stores.
There are no shortcut keys on the TI calculators or Excel for this Nonparametric Test. Note that if your data has tied ranks, there are several methods not addressed in this text, to correct the standard deviation. Hence, the z-score in some software packages may not match your results calculated by hand.
Adapted from Mostly Harmless Statistics by Rachel Webb (Portland State University, https://mostlyharmlessstat.wixsite.com/webpage), © Rachel Webb, licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.