Time commitment
5 - 10 minutes
Description
The purpose of this video is to explain the Mann-Whitney U test (also known as the Wilcoxon rank-sum test), a nonparametric test used to compare the medians of two independent groups. Unlike the t-test, this test does not assume that the data is normally distributed, making it useful when normality is in question. The video outlines the assumptions necessary to perform the test, such as ensuring the dependent variable is ordinal or continuous, and the independent variable is categorical with two groups. Additionally, it provides instructions on how to check these assumptions in SPSS, run the Mann-Whitney U test, and interpret the output, including the p-value and what it indicates about group differences.
Video
Transcript
What is a Wilcoxon rank-sum test, or a Mann-Whitney U test? These are two terms for the same test. A Wilcoxon rank-sum test or a Mann-Whitney U test is used to determine whether two groups’ medians on the same continuous variable differs.
This is a nonparametric test; this test does not assume normality. Your data do not have to follow this typical bell-shaped curve. So, if you have run an independent samples t-test, but you failed normality in one or both of your groups, you should probably consider switching to the Mann-Whitney U test.
And if you need some additional help running the Mann-Whitney U test, we have this in the U of G SPSS LibGuide, there's a Laerd statistics guide on this, or you can check the SPSS documentation for some more help.
All right, what are the assumptions of a Mann-Whitney U test? There are four. The first is that your dependent variable must be ordinal or continuous. Our second assumption is that the independent variable must be categorical, and you must have two independent groups. The third is that your data must be independent. And the fourth, the data distributions of the two groups must have the same shape.
We'll cover these on the next few slides, let's go.
[Slide contains a screenshot of a table in SPSS within Data View. The table’s column headers are as follows: Gender, Fake_Data1, Fake_Data2, Fake_Data3, Fake_Data4, Colour, and Group.]
Alright, our first assumption, our dependent variable must be ordinal or continuous. Here, if we're using Fake_Data1.
[Fake_Data1 column is highlighted.]
We can look at this and say: “Does this look like it's ordinal or continuous?”. Here we have a range of values with decimals, this is probably continuous. It's a giveaway that it's continuous because it's got those decimals and a wide range of values. So, we pass the assumption of continuous dependent variable data.
Our second assumption is that our independent variable must be categorical.
[Gender column is highlighted in two parts first drawing attention to the Male and then the Female values.]
If we're using our Gender column, we can see that there are only two groups here, we have male participants and female participants, which means we have passed this assumption of our independent variable being categorical; that's your different buckets of information.
Our next assumption is that the data must be independent. As a reminder, this is normally something you set up before you run your statistics. For example, when you're setting up your survey or setting up your experiment, you normally make sure your data are independent before you get started. For example, one row per participant. If you're surveying people, you don't want the same person to answer the survey three times, that's not right, that's cheating. You would fail the assumption of independence in that case. So, after-the-fact, we can look at the data and say: “Does it look independent?”, but we normally do this beforehand.
[Column headers and first row are highlighted.]
For example, if we look in our first row, we can see that this is a male participant; they have data for Fake_Data1, Fake_Data2, Fake_Data3. It's hard to tell after-the-fact whether we've passed independence because maybe row 1 is the same as row 10, and we don't know they're the same human, but it LOOKS like the data are independent, so we can roughly say (it's a fake data set, I made this), we can say that we've passed this this assumption for this test.
And our last assumption here is that the distributions across our two groups should look the same. This one’s a new assumption, we haven't seen this one before [in the workshop series]. I'm going to shortcut as a bit because we've already seen the distributions earlier in the independent sample t-test when we checked for normality and outliers. You can create these graphs several ways, including using the Chart Builder, but we've already made them for today's presentation, so we'll just look at the ones we already have.
[Two SPSS histograms showing the distribution of Fake_Data1 for Males (left) and Females (right) separately. Both histograms use red bars to represent frequency counts along the y-axis, with Fake_Data1 values on the x-axis.
In the Male histogram, the values range from 85.0 to 89.0, with the highest frequency occurring at 87.0 (6 cases) and 88.0 (5 cases). The distribution appears somewhat right skewed, with lower counts at 85.0 (3 cases) and 86.0 (1 case).
In the Female histogram, the values range from 85.0 to 90.0, with the highest frequency at 85.0 to 87.0 (4, 5, and 4 cases respectively). The distribution appears more uniform but with lower frequencies at 89.0 and 90.0 (each with 1 case), suggesting a slight left skewed pattern.]
What you do, is you look at your continuous variable across your two categorical groups. So here on the left we have our male participants, and on the right we have our female participants. Both of these are Fake_Data1, and we're looking at them to say: “Do these look like they are the same shape?”.
If you're looking at this critically, you can see for the male participants it looks like most of the data is like, between 87 and 89, whereas for the female participants most of the data looks like it's between 85 and 88. So one of these is skewed to the right and one of these skewed to the left;
I would say these distributions don't look like they're the same shape, so potentially you can't use this test to assess for differences. So, we might have failed this assumption.
[Slide shows the table with the Analyze menu open and Nonparametric Tests selected. From the Nonparametric Tests sub-menu One Sample is highlighted.]
If you have passed all of your assumptions, you can proceed to conducting the Mann-Whitney test. Today, it looks like we failed assumption four; it looks like our distributions are not the same shape. This is a warning to always check your assumptions. For the sake of showing you how to do the test today, I'm going to run it for you anyway, but this is a reminder: Always check your assumptions.
How do we actually run the Mann-Whitney U test? We click: Analyze > Nonparametric Tests > Independent Samples. This is one of those examples where SPSS slightly hides the tests and it's not using the actual name of the test.
Remember, this is the Wilcoxon rank-sum test or the Mann-Whitney U test. The term we're seeing here is not actually the name of the test, because there are different kinds of independent samples tests that we can run. If you remember to yourself: “Hmm, the parametric version is the independent samples t-test, I want to run the non-parametric independent samples t-test, which button do I click? Alright, independent: Nonparametric > Independent Samples.”
[SPSS Nonparametric Tests: Two or More Independent Samples dialog box. The Objective tab is selected, offering three options in the “What is your objective?” box: automatically compare distributions, compare medians, or customize analysis (which is selected).]
If you click that, it will open up the Nonparametric Tests: Two or More Independent Samples dialog box. And it's got three different tabs, we have to do something in each tab. In the Objective tab, we're going to click where it says, “Customize Analysis”. And then we switch over to the Fields tab, which you can see along the top here.
[SPSS Nonparametric Tests: Two or More Independent Samples dialog box with the Fields tab selected. The Use custom field assignments radio button is selected, leaving Use predefined roles unselected. The left panel lists available variables, while the right panel shows the selected test field, which is set to Fake data: =85 + 5*rand(). In the Groups field, the grouping variable is Gender (0 = Male, 1 = Female).]
In the Fields tab, you're going to take your continuous dependent variable and move it to where it says, “Test Fields:”. If you have set up your Measure properly in Variable View, your continuous dependent variable should have a little yellow ruler next to it.
If you don't have a yellow ruler, you should back out, go to Variable View, check the Measure column, and make sure this is set properly. Your continuous dependent variable should be listed as scale data [Presenter note: you can also have ordinal data here, which would be the little bar graph].
Then you take your categorical independent variable, and you put it where it says “Groups:”. And if it's appropriately labeled in Variable View as categorical, it should have either three coloured circles or three coloured bars here.
Then you click Settings, there's one more thing we have to do, and that's in our third tab.
[SPSS Nonparametric Tests: Two or More Independent Samples dialog box with the Settings tab selected. From the Select an item menu there are three options Choose Tests, Test Options, and User-Missing Values, Choose Tests is selected. The bottom contains buttons for Run, Paste, Reset, Cancel, and Help.]
So we go to our Settings tab, we click where it says, “Customize tests”, and then there's a bunch of different options. You're looking for the “Mann-Whitney U (2 samples)” test. So, we check the box that says Mann-Whitney U, and then we click Run. If you have remembered to click all of the buttons in Objective, Fields, and Settings, you can click Run and you'll get some output that looks like this.
[SPSS Nonparametric Tests output window, showing results for the Mann-Whitney U test comparing Fake data: =85 + 5*rand() between Male (0) and Female (1) groups. Shows two tables, the Hypothesis Test Summary and Independent-Samples Mann U Test Summary. The Hypothesis Test Summary shows Null Hypothesis, Test, Sig, and Decision.]
Alright, so there's a bit of information here. There's the Hypothesis Test Summary table, which tells you what null hypothesis you're testing, what test you have actually run, the significance value of that test, and what decision you should make based on the p-value in the significance column.
We can read our p-value either up in the Hypothesis Test Summary table [Sig column highlighted], or we can read it down in the Independent Samples Mann-Whitney U Test Summary table [Exact Sig row highlighted]; they're the same value. It just depends which one you want to read. In the Independent Samples Mann-Whitney U Test Summary table, it gives you your N (or number of observations for the test), your Mann-Whitney U value, your Wilcoxon W value, the test statistic, your standard error, your standardized test statistic, your asymptotic significance (2-sided test), or your exact significance (2-sided test).
The “Sig.” value in the Hypothesis Test Summary [table] matches the Exact Sig. (2-sided) test from the Independent Samples Mann-Whitney U Test Summary [table]. So that's the thing that you care about the most in this output; this is your p-value. Here, if your p-value is less than (<) .05, you can say that you have found a difference between the groups; one of the groups is higher than the other. If your p-value is greater than (>) .05, and our case we've got .098, so we have p-value greater than .5 – sorry, .05 – we say we failed to find a difference between the groups. Not that there's no difference! We failed to find a difference. So based on our decision, we're retaining the null hypothesis; we failed to reject the null.
There's one other thing that pops out that you might want to look at, this is your Independent Samples Mann-Whitney U Test [graph].
[Horizontal bar chart from an Independent-Samples Mann-Whitney U Test in SPSS. The chart compares the distribution of "Fake data: =85 + 5*rand()" between males (right side, red bars) and females (left side, blue bars). The x-axis represents frequency, while the y-axis represents Fake data values. Summary statistics indicate N = 15 per group, with mean ranks of 12.80 (female) and 18.20 (male)]
This is a graph that shows you your distribution, so the distributions we already looked at that I had in red side-by-side, this is the same sort of graph, but it's put them vertically instead. So instead of being along our X[-axis], they're along our Y[-axis]. And you can use this to say: “Do these distributions look similar?”. And you should look at this and say “Mm, they actually don't look that similar.”. The males are grouped kind of up in this region, and the females are mostly grouped down in this region. So, this would be another hint, if you got to this step and looked at this graph, that maybe you don't meet one of your assumptions. Alright, that's how you run a Mann-Whitney U test.
License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
- Ask Chat is a collaborative service
- Ask Us Online Chat hours
- Contact Us