Mann-Whitney U Test

Mann-Whitney U TestWhat is a Mann-Whitney U Test?

A Mann-Whitney U test (sometimes called the Wilcoxon rank-sum test) is used to compare the differences between two independent samples when the sample distributions are not normally distributed and the sample sizes are small (n <30). It is considered to be the nonparametric equivalent to the two-sample independent t-test.

Here are some examples of when you might use a Mann-Whitney U test:

  • You want to compare the salaries of five graduates from university A vs. the salaries of five graduates from university B. The salaries are not normally distributed.
  • You want to know if weight loss varies for two groups: 12 people using diet A and 10 people using diet B. The weight loss is not normally distributed. 
  • You want to know if the scores of 8 students in class A differ from those of 7 students in class B. The scores are not normally distributed.

In each example you have two groups that you want to compare, the sampling distributions are not normal, and the sample sizes are small. Thus, a Mann-Whitney U test is appropriate as long as the following assumptions are met.

Assumptions of the Mann-Whitney U Test

Before you conduct a Mann-Whitney U test, you need to make sure the following four assumptions are met:

  • Ordinal or Continuous: The variable you’re analyzing is ordinal or continuous. Examples of ordinal variables include Likert items (e.g., a 5-point scale from “strongly disagree” to “strongly agree”). Examples of continuous variables include height (measured in inches), weight (measured in pounds), or exam scores (measured from 0 to 100).
  • Independence: All of the observations from both groups are independent of each other.
  • Shape: The shapes of the distributions for the two groups are roughly the same.

If these assumptions are met, then you can proceed to conduct a Mann-Whitney U test.

How to Conduct a Mann-Whitney U Test

To conduct a Mann-Whitney U test, we follow the standard five-step hypothesis testing procedure:

1. State the hypotheses. 

In most cases, a Mann-Whitney U test is performed as a two-sided test. The null and alternative hypotheses are written as:

H0: The two populations are equal

Ha: The two populations are not equal

2. Determine a significance level to use for the hypothesis.

Decide on a significance level. Common choices are .01, .05, and .1.

3. Find the test statistic.

The test statistic is denoted as U and is the smaller of U1 and U2, as defined below:

U1 = n1n2  +  n1(n1+1)/2  – R1

U2 = n1n2  +  n2(n2+1)/2  – R2

where n1 and n2 are the sample sizes for sample 1 and 2 respectively, and R1 and R2 are the sum of the ranks for sample 1 and 2 respectively.

The examples below will show how to find this test statistic in detail.

4. Reject or fail to reject the null hypothesis.

Using the test statistic, determine if you can reject or fail to reject the null hypothesis based on the significance level and critical value found in the Mann-Whitney U Table.

5. Interpret the results. 

Interpret the results of the test in the context of the question being asked.

Examples of Conducting a Mann-Whitney U Test

The follow examples show how to conduct a Mann-Whitney U test.

Example 1

We want to know whether or not a new drug is effective at preventing panic attacks. A total of 12 patients are randomly split into two groups of 6 and assigned to receive the new drug or the placebo. The patients then record how many panic attacks they have over the course of one month.

The results are shown below:

NEW DRUG PLACEBO
3 4
5 8
1 6
4 2
3 1
5 9

Conduct a Mann-Whitney U test to see if there is a difference in the number of panic attacks for the patients in the placebo group compared to the new drug group. Use a .05 level of significance. 

1. State the hypotheses. 

H0: The two populations are equal

Ha: The two populations are not equal

2. Determine a significance level to use for the hypothesis.

The problem tells us that we are to use a .05 level of significance.

3. Find the test statistic.

Recall that test statistic is denoted as U and is the smaller of U1 and U2, as defined below:

U1 = n1n2  +  n1(n1+1)/2  – R1

U2 = n1n2  +  n2(n2+1)/2  – R2

where n1 and n2 are the sample sizes for sample 1 and 2 respectively, and R1 and R2 are the sum of the ranks for sample 1 and 2 respectively.

In order to find R1 and R2, we need to combine the observations from both groups and rank them in order from least to greatest:

NEW DRUG PLACEBO
3 4
5 8
1 6
4 2
3 1
5 9

Total Sample: 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 8, 9

Ranks: 1.5, 1.5, 3, 4.5, 4.5, 6.5, 6.5, 8.5, 8.5, 10, 11, 12

R1 = sum of ranks for sample 1 = 1.5+4.5+4.5+6.5+8.5+8.5 =  34

R2 = sum of ranks for sample 2 = 1.5+3+6.5+10+11+12 =  44

Next, we use our sample sizes n1 and n2 along with our sum of ranks R1 and R2 to find U1 and U2.

U1 = 6(6)  +  6(6+1)/2  – 34 = 23

U2 = 6(6) +  6(6+1)/2  – 44 = 13

Our test statistics is the smaller of U1 and U2, which happens to be U = 13.

Note: We could also use the Mann-Whitney U Test Calculator to find that U = 13.

4. Reject or fail to reject the null hypothesis.

Using n1 = 6 and n2 = 6 with a significance level of .05, the Mann-Whitney U Table tells us that the critical value is 5:

Mann Whitney U Test critical value table

Since our test statistic (13) is greater than our critical value (5), we fail to reject the null hypothesis.

5. Interpret the results. 

Since we failed to reject the null hypothesis, we do not have sufficient evidence to say that the number of panic attacks experienced by patients in the placebo group is different from the new drug group.

Example 2

We want to know whether or not studying for 30 minutes per day for one week helps students score better on a test. A total of 15 patients are randomly assigned to a study or no-study group. After one week, all of the students take the same test.

The test scores for the two groups are shown below:

STUDY NO-STUDY
89 88
92 93
94 95
96 75
91 72
99 80
84 81
90

Conduct a Mann-Whitney U test to see if there is a difference in the test scores for the study vs. no-study group. Use a .01 level of significance. 

1. State the hypotheses. 

H0: The two populations are equal

Ha: The two populations are not equal

2. Determine a significance level to use for the hypothesis.

The problem tells us that we are to use a .01 level of significance.

3. Find the test statistic.

Recall that test statistic is denoted as U and is the smaller of U1 and U2, as defined below:

U1 = n1n2  +  n1(n1+1)/2  – R1

U2 = n1n2  +  n2(n2+1)/2  – R2

where n1 and n2 are the sample sizes for sample 1 and 2 respectively, and R1 and R2 are the sum of the ranks for sample 1 and 2 respectively.

In order to find R1 and R2, we need to combine the observations from both groups and rank them in order from least to greatest:

STUDY NO-STUDY
89 88
92 93
94 95
96 75
91 72
99 80
84 81
90

Total Sample: 72, 75, 80, 81, 84, 88, 89, 90, 91, 92, 93, 94, 95, 96, 99

Ranks: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15

R1 = sum of ranks for sample 1 = 5+7+8+9+10+12+14+15 = 80

R2 = sum of ranks for sample 2 = 1+2+3+4+6+11+13 = 40

Next, we use our sample sizes n1 and n2 along with our sum of ranks R1 and R2 to find U1 and U2.

U1 = 8(7)  +  8(8+1)/2  – 80 = 12

U2 = 8(7) +  7(7+1)/2  – 40 = 44

Our test statistics is the smaller of U1 and U2, which happens to be U = 12.

Note: We could also use the Mann-Whitney U Test Calculator to find that U = 12.

4. Reject or fail to reject the null hypothesis.

Using n1 = 8 and n2 = 7 with a significance level of .01, the Mann-Whitney U Table tells us that the critical value is 6:

Mann Whitney U Test critical value table

Since our test statistic (12) is greater than our critical value (6), we fail to reject the null hypothesis.

5. Interpret the results. 

Since we failed to reject the null hypothesis, we do not have sufficient evidence to say that the test scores of the students who studied is different than the test scores of the students who did not study.

Helpful Tools

Mann-Whitney U Test Calculator
Mann-Whitney U Table

Leave a Reply

Your email address will not be published. Required fields are marked *