A Procedural Guide on How to Perform Wilcoxon Rank-Sum Test
What is the Mann-Whitney U Test?
The Mann-Whitney U test, also known as the Wilcoxon Rank-Sum test, is a non-parametric test used to compare the differences between two independent groups. Unlike the parametric independent samples t-test, the Mann-Whitney U test does not assume normality and is often used when the assumptions of the t-test are violated. Instead of comparing means, this test compares the medians of the two groups, aiming to determine whether there is a significant difference between their distributions.
When should you use the Mann-Whitney U Test?
The Mann-Whitney U test is suitable in the following scenarios:
- You have two independent groups.
- The dependent variable is at least ordinal or continuous.
- The data does not follow a normal distribution.
Example Scenario for Performing Mann-Whitney U Test in R
In this example, we will determine if there are significant differences in movie ratings between male and female viewers. Both groups provide their ratings, and we will compare the medians to assess any statistical differences using the Mann-Whitney U test.
Check out how to run the Mann-Whitney U test using SPSS for the same example. You will realize that we have the same results for both tests.
Null and Alternative Hypothesis in Mann-Whitney Wilcoxon U Test
The hypotheses for this test are as follows:
- Null Hypothesis: The median movie ratings for males and females are equal (no difference).
- Alternative Hypothesis: The median movie ratings for males and females are not equal (there is a difference).
Movie Ratings Sample Data

Shapiro-Wilk Normality Test
To justify using the Mann-Whitney U test, we first check whether the data is normally distributed. If the data is not normally distributed in either group, the t-test is inappropriate, and the Mann-Whitney U test is warranted.
In RStudio, we use the Shapiro-Wilk Normality Test to assess the distribution of male and female movie ratings.

- The p-value for females is 0.6475, which is greater than the alpha level of 0.05, indicating a normal distribution.
- The p-value for males is 0.003681, which is less than 0.05, suggesting the data is not normally distributed.
Since one group (male ratings) does not follow a normal distribution, we will use the Mann-Whitney U test instead of the t-test.
Running Mann-Whitney-Wilcoxon U Test in R
Since male and female data are independent, we perform the Mann-Whitney U test by using the wilcox.test() function in R. Here’s how you can do it:

The output gives us a p-value of 0.9031, which is greater than our alpha level of 0.05. This means we fail to reject the null hypothesis.
Important Note: The order in which male and female data is input into the function can affect the test statistic. It’s essential to report the smaller test statistic (W). Let’s switch the order and run the test again:

The p-value remains the same (0.9031), but the W statistic changes from 205 to 195. Therefore, when reporting results, we will use the W statistic of 195.
Mann-Whitney U Test in R Report
- W = 195
- p = 0.9031
Since the p-value is greater than our alpha level of 0.05, we conclude that there is no significant difference between the movie ratings of males and females in this dataset.
Do you need help with SPSS analysis?
We’re a team of fully experienced statisticians. For personalized assistance, email us or join our live chat.