How to use the mann-whitney u test calculator
- Paste the values for group A and group B, separated by commas, spaces or new lines. The examples show how.
- Choose the alternative: two-sided asks whether the groups differ at all, while the one-sided options ask whether A tends to be higher or lower than B.
- Open the options if you want to turn off the continuity correction used with the normal approximation.
- Read the p value, the U statistics, the rank sums and the effect sizes. For small samples without ties the exact p value is shown first.
Formula
rank all values together, giving tied values the average of their ranks
U for A = rank sum of A - n1 (n1 + 1) / 2, and U for B = n1 x n2 - U for A
mean of U = n1 n2 / 2, variance = n1 n2 / 12 x ((N + 1) - sum of (t^3 - t) / (N (N - 1)))
z = (U - mean of U - 0.5) / standard deviation, p from the normal curve
The exact p value counts how many of the equally likely arrangements of the ranks give a U at least as extreme. It is used when there are no ties and the samples are small. Otherwise the normal approximation with a tie correction is used.
Seven values against eight
Group A is 19, 22, 16, 29, 24, 31, 27 and group B is 20, 11, 17, 12, 21, 14, 18, 9. A has a rank sum of 78, so U for A is 78 - 28 = 50 and U for B is 7 x 8 - 50 = 6. The two-sided exact p value is 0.009324, and the normal approximation with continuity correction gives z = 2.488 and p = 0.012841.
The rank-biserial correlation is (50 - 6) / 56 = 0.7857, and the chance that a random value from A is larger than a random value from B is 50 / 56 = 89.3%. The medians are 24 and 15.5. The one-sided exact p value that A tends higher is 0.004662.
What the test compares
The Mann-Whitney U test, also called the Wilcoxon rank sum test, asks whether a random value from one group tends to be larger than a random value from the other. It works on ranks, so it does not assume a normal distribution and is not thrown off by one extreme value the way a t test can be.
If the two groups have the same shape, a significant result also means their medians differ, but in general it is a statement about which group tends to be larger. For comparing means with a t test, see the P Value Calculator, and for three or more groups the ANOVA Calculator.
Reading the result
A small p value says the difference in ranks is unlikely if the groups were really the same. It does not say how large or important the difference is, which is what the rank-biserial correlation and the chance that A beats B describe. Independence matters: if the same people appear in both groups, a paired test is the right choice.
More statistics tools
For related statistical tests and measures, try the Fisher Exact Test Calculator, P Value Adjustment Calculator and Cohen's d Calculator.
Assumptions and limits
- The observations are independent, and each group is a separate sample.
- The values can be ordered, and both groups are measured on the same scale.
- The exact p value is shown only when there are no ties and the samples are small.
- Group data are examples until you replace them.
Frequently asked questions
When should I use the Mann-Whitney U test instead of a t test?
Use it when the data are skewed, have outliers, or are ordinal ratings, or when the samples are small and you do not want to assume a normal distribution. It compares ranks instead of means.
What does U mean?
U counts, over every pair made of one value from each group, how often the value from that group is larger, with ties counting half. The two U values add up to n1 times n2.
What is the exact p value?
It lists every way the ranks could be shared between the groups, assuming they are all equally likely, and finds the share that is at least as extreme as yours. It needs no normal approximation.
How do ties change the test?
Tied values get the average of their ranks and the standard deviation is reduced to match. The exact p value does not apply with ties, so the corrected normal approximation is used.