The procedure to run a Mann-Whitney U test using the legacy procedure in SPSS is shown in the nine steps below. However, if you wanted to use the new procedure, this is available on the previous page.
For SPSS versions 18 and newer, click Analyze > Nonparametric Tests > Legacy Dialogs > 2 Independent Samples... on the main menu (as shown below) but, for older versions of SPSS, click Analyze > Nonparametric Tests > 2 Independent Samples... on the main menu.
You will be presented with the Two-Independent-Samples Tests dialogue box, as shown below:
Note: The Mann-Whitney U checkbox in the –Test Type– area should be selected by default, but if not, make sure to check this option. This option instructs SPSS to run a Mann-Whitney U test on the variables you are going to transfer in the next step of this procedure.
Note: The Test Variable List: box is where you enter the dependent variable(s) you wish to analyse. You can transfer more than one dependent variable into this box to analyse many dependent variables at the same time. The independent variable is referred to as the "grouping variable" in SPSS for the Mann-Whitney U test procedure. If you transfer multiple dependent variables into the Test Variable List: box, a Mann-Whitney U test will be performed on all the dependent variables for the same groups of the independent variable that you define in the Grouping Variable: box.
For example, if we added another variable called happiness (reflecting happiness score), we would end up with the following:
Two Mann-Whitney U tests will be performed, one for each dependent variable (i.e., engagement and happiness), with both tests using the same groups of the independent variable, gender (i.e., males/females), as defined in the Grouping Variable: box.
Click the button. You will be presented with the Two Independent Samples: Define Groups dialogue box, as shown below:
Note: If the button is not active (i.e., it looks faded like this, ), make sure that the gender variable is highlighted in yellow (as shown above in step 2) by clicking on it. This will activate the button.
Enter "1" into the Group 1: box and "2" into the Group 2: box, as shown below:
Explanation: You are doing this because the "Male" group was labelled as "1" and the "Female" group was labelled as "2" in the data file setup, and as shown below:
If you have coded your groups differently, you need to enter in your specific codes (e.g., 0/1 or yes/no). In this example, you are instructing SPSS to compare engagement scores between the groups "Male" and "Female". This might seem like a rather unneeded procedure - indicating which groups to compare - but the Mann-Whitney U test procedure in SPSS is designed to be flexible and allow the comparison of any two groups within an independent variable where there are several groups (e.g., you could compare groups 3 and 4 of an independent variable that had 8 levels/categories); it just so happens that you have a dichotomous variable in this example so it seems unnecessary. You might wish to compare two groups within a categorical variable with three or more groups as part of a post-hoc analysis following a Kruskal-Wallis H test. For example, if you had four groups as follows:
You could compare the "Car" to "Aeroplane" groups using a Mann Whitney U test by typing in "1" and "4" into the two boxes of the Two Independent Samples: Define Groups dialogue box, as shown below:
Click the button and you will be returned to the Two-Independent-Samples Tests dialogue box, but now with a completed Grouping Variable: box, as highlighted below:
Click the button. You will be presented with the Two-Independent-Samples Tests: Options dialogue box, as shown below:
Explanation: If you only transferred one dependent variable into the Test Variable List: box earlier, like in our example, either option you select in the –Missing Values– area (i.e., either Exclude cases test-by-test or Exclude cases listwise) will produce the same result. Namely, SPSS will ignore any missing values in your data set when performing the Mann-Whitney U test. Therefore, we suggest keeping the default, Exclude cases test-by-test, in the –Missing Values– area.
However, if you have transferred multiple dependent variables (i.e., you are going to run more than one Mann-Whitney U test at the same time), Exclude cases test-by-test will treat each Mann-Whitney U test separately. This means that only dependent variable values that are missing for that specific Mann-Whitney U test will be removed from the analysis. This is illustrated below (with the addition of a new variable, called happiness, reflecting happiness score):
As you can see from the diagram above, although participants 8 and 11 have missing values for one of the transferred variables, the missing values only affect the Mann-Whitney U test analysis for the variable they are missing from. The analysis of the other variable is not affected. Therefore, only case number 8 will be excluded when running the Mann-Whitney U test for the dependent variable, happiness, and only case number 11 will be excluded when running the Mann-Whitney U test for the dependent variable, engagement.
However, if you select Exclude cases listwise, all variables you transfer for analysis will be assessed for missing values and all cases (e.g., participants) where at least one value is missing will result in that particular case's results not being used in any Mann-Whitney U test analyses. This is illustrated below:
As the diagram above shows, if a case (e.g., participant) has a missing value for any transferred variable, that case is removed from all Mann-Whitney U test analyses. That is, the missing value has a carry-over effect on all other analyses. In the example above, this would mean that the Mann-Whitey U test for the dependent variable, engagement, would exclude cases 8 and 11, even though only case 8 had a missing value for that variable. At the same time, the Mann-Whitney U test that was simultaneously run for the dependent variable, happiness, would also exclude cases 8 and 11, even though only case 11 had a missing value for that variable. However, remember that the options in the –Missing Values– area only apply to the variables that you have transferred into the Test Variable List: box. This means that a missing value on a variable that has not been transferred does not have any bearing on how missing values are treated in a Mann-Whitney U test analysis.
Select the Descriptive and Quartiles checkboxes in the –Statistics– area. You will end up with a dialogue box similar to below:
Note: Although selecting the Descriptive and Quartiles checkboxes provides descriptive statistics, they are not particularly useful. The reason for this is that the statistics produced (e.g., median) will be for each variable separately. For example, it will calculate the median for gender and the median for engagement. However, what you want to calculate is the median of engagement at each level of gender (i.e., median engagement score for males and median engagement score for females).
Click the button and you will be returned to the Two-Independent-Samples Tests dialogue box.
Click the button to generate the output.
Now that you have run the Mann-Whitney U test procedure, you need to generate medians for your data. We show you how to do this on the next page.