Mann-Whitney is a non-parametric hypothesis test is used to assess if two samples came from the same population or not. To do that, it tests the median value of the two samples.



To run this test, it’s important that:

  • The data of the two samples are ordinal so the value are comparable;
  • The distribution of the two samples isn’t normal;
  • The two samples are independent of each other;
  • In each sample, the observation is independent.



The hypothesis of this test is like this in case of a two-tails test:

  • H0: Median1 = Median2;
  • H1Median1 != Median2.


The hypothesis of this test is like this in case of a left tail test:

  • H0: Median1 = Median2;
  • H1Median1 < Median2.


The hypothesis of this test is like this in case of a right tail test:

  • H0: Median1 = Median2;
  • H1Median1> Median2.


The way to conduct the hypothesis test is like the one-sample t-tests, but we use another statistics.


You can calculate the statistics in this way:

  1. Put all the observation of the two-sample in one group – es: S1 = {2,6,8,2,2}, S2={6,8,10,6,6}, now you have Stot = {2,6,8,10}
  2. Give to each observation of the toal group an ordinal rank value – es: Stot = {2=1,6=3,8=4,10=5}
  3. Now separete back the rank in two sample, so now you have – es: S1 = {1,3,4,1,1}, S2={3,4,5,3,3}
  4. Compute R1 and R2 that are the sum of rank for each sample – es R1=10 and R2 = 17
  5. Calculate U1 = n1n2+0,5n1(n1+1)-R1 where n1 and n2 are the number of observation in each sample – es: U1 = 5+5+0,5*3*(3+1) – 10 = 15
  6. Calculate U2 = n1n2+0,5n2(n2+1)-R2 where n1 and n2 are the number of observation in each sample – es: U2 = 5+5+0,5*3*(3+1) – 17 = 8
  7. Get the min value between U1 and U2, in this case U2 = 8

Now we have that U1=8 is the statistics.
Now we get the critical value from the Mann-Whitney table. Remember that we have N1 = 5, N2=5, and suppose you have a significance level alpha=0,05. So the critical value from the table is 2.
Remember that we are performing a two-tail test, so we have -2 and 2 as critical value (each one with alpha/2 of probability).
Because 8>2, we reject the H0 and say that the two distributions are different.

Share on: