# Mann-Whitney-Wilcoxon test

This page offers all the basic information you need about the mann-whitney-wilcoxon test. It is part of Statkat’s wiki module, containing similarly structured info pages for many different statistical methods. The info pages give information about null and alternative hypotheses, assumptions, test statistics and confidence intervals, how to find *p * values, SPSS how-to’s and more.

To compare the mann-whitney-wilcoxon test with other statistical methods, go to Statkat's or practice with the mann-whitney-wilcoxon test at Statkat's

##### Contents

- 1. When to use
- 2. Null hypothesis
- 3. Alternative hypothesis
- 4. Assumptions
- 5. Test statistic
- 6. Sampling distribution
- 7. Significant?
- 8. Equivalent to
- 9. Example context
- 10. SPSS
- 11. Jamovi

##### When to use?

Deciding which statistical method to use to analyze your data can be a challenging task. Whether a statistical method is appropriate for your data is partly determined by the measurement level of your variables. The mann-whitney-wilcoxon test requires the following variable types:

Independent/grouping variable: One categorical with 2 independent groups | Dependent variable: One of ordinal level |

Note that theoretically, it is always possible to 'downgrade' the measurement level of a variable. For instance, a test that can be performed on a variable of ordinal measurement level can also be performed on a variable of interval measurement level, in which case the interval variable is downgraded to an ordinal variable. However, downgrading the measurement level of variables is generally a bad idea since it means you are throwing away important information in your data (an exception is the downgrade from ratio to interval level, which is generally irrelevant in data analysis).

If you are not sure which method you should use, you might like the assistance of our method selection tool or our method selection table.

##### Null hypothesis

The mann-whitney-wilcoxon test tests the following null hypothesis (H_{0}):

- H
_{0}: the population median for group 1 is equal to the population median for group 2

Formulation 1:

- H
_{0}: the population scores in group 1 are not systematically higher or lower than the population scores in group 2

- H
_{0}: P(an observation from population 1 exceeds an observation from population 2) = P(an observation from population 2 exceeds observation from population 1)

##### Alternative hypothesis

The mann-whitney-wilcoxon test tests the above null hypothesis against the following alternative hypothesis (H_{1} or H_{a}):

- H
_{1}two sided: the population median for group 1 is not equal to the population median for group 2 - H
_{1}right sided: the population median for group 1 is larger than the population median for group 2 - H
_{1}left sided: the population median for group 1 is smaller than the population median for group 2

Formulation 1:

- H
_{1}two sided: the population scores in group 1 are systematically higher or lower than the population scores in group 2 - H
_{1}right sided: the population scores in group 1 are systematically higher than the population scores in group 2 - H
_{1}left sided: the population scores in group 1 are systematically lower than the population scores in group 2

- H
_{1}two sided: P(an observation from population 1 exceeds an observation from population 2) $\neq$ P(an observation from population 2 exceeds an observation from population 1) - H
_{1}right sided: P(an observation from population 1 exceeds an observation from population 2) > P(an observation from population 2 exceeds an observation from population 1) - H
_{1}left sided: P(an observation from population 1 exceeds an observation from population 2) < P(an observation from population 2 exceeds an observation from population 1)

##### Assumptions

Statistical tests always make assumptions about the sampling procedure that's been used to obtain the sample data. So called parametric tests also make assumptions about how data are distributed in the population. Non-parametric tests are more 'robust' and make no or less strict assumptions about population distributions, but are generally less powerful. Violation of assumptions may render the outcome of statistical tests useless, although violation of some assumptions (e.g. independence assumptions) are generally more problematic than violation of other assumptions (e.g. normality assumptions in combination with large samples).

The mann-whitney-wilcoxon test makes the following assumptions:

- Group 1 sample is a simple random sample (SRS) from population 1, group 2 sample is an independent SRS from population 2. That is, within and between groups, observations are independent of one another

##### Test statistic

The mann-whitney-wilcoxon test is based on the following test statistic:

Two different types of test statistics can be used; both will result in the same test outcome. The first is the Wilcoxon rank sum statistic $W$:- $W$ = sum of ranks in group 1

- $U = W - \dfrac{n_1(n_1 + 1)}{2}$

Note: we could just as well base W and U on group 2. This would only 'flip' the right and left sided alternative hypotheses. Also, tables with critical values for $U$ are often based on the smaller of $U$ for group 1 and for group 2.

##### Sampling distribution

Sampling distribution of $W$ and of $U$ if H_{0}were true:

Sampling distribution of $W$:

For large samples, $W$ is approximately normally distributed with mean $\mu_W$ and standard deviation $\sigma_W$ if the null hypothesis were true. Here
$$
\begin{aligned}
\mu_W &= \dfrac{n_1(n_1 + n_2 + 1)}{2}\\
\sigma_W &= \sqrt{\dfrac{n_1 n_2(n_1 + n_2 + 1)}{12}}
\end{aligned}
$$
Hence, for large samples, the standardized test statistic
$$
z_W = \dfrac{W - \mu_W}{\sigma_W}\\
$$
follows approximately the standard normal distribution if the null hypothesis were true. Note that if your $W$ value is based on group 2, $\mu_W$ becomes $\frac{n_2(n_1 + n_2 + 1)}{2}$.

Sampling distribution of $U$:

For large samples, $U$ is approximately normally distributed with mean $\mu_U$ and standard deviation $\sigma_U$ if the null hypothesis were true. Here
$$
\begin{aligned}
\mu_U &= \dfrac{n_1 n_2}{2}\\
\sigma_U &= \sqrt{\dfrac{n_1 n_2(n_1 + n_2 + 1)}{12}}
\end{aligned}
$$
Hence, for large samples, the standardized test statistic
$$
z_U = \dfrac{U - \mu_U}{\sigma_U}\\
$$
follows approximately the standard normal distribution if the null hypothesis were true.

For small samples, the exact distribution of $W$ or $U$ should be used.

Note: the formula for the standard deviations $\sigma_W$ and $\sigma_U$ is more complicated if ties are present in the data.##### Significant?

This is how you find out if your test result is significant:

For large samples, the table for standard normal probabilities can be used:Two sided:

- Check if $z$ observed in sample is at least as extreme as critical value $z^*$ or
- Find two sided $p$ value corresponding to observed $z$ and check if it is equal to or smaller than $\alpha$

- Check if $z$ observed in sample is equal to or larger than critical value $z^*$ or
- Find right sided $p$ value corresponding to observed $z$ and check if it is equal to or smaller than $\alpha$

- Check if $z$ observed in sample is equal to or smaller than critical value $z^*$ or
- Find left sided $p$ value corresponding to observed $z$ and check if it is equal to or smaller than $\alpha$

##### Equivalent to

The mann-whitney-wilcoxon test is equivalent to:

If no ties in the data: two sided Mann-Whitney-Wilcoxon test is equivalent to Kruskal-Wallis test with an independent variable with 2 levels ($I = 2$)##### Example context

The mann-whitney-wilcoxon test could for instance be used to answer the question:

Do men tend to score higher on social economic status than women?##### SPSS

How to perform the mann-whitney-wilcoxon test in SPSS:

Analyze > Nonparametric Tests > Legacy Dialogs > 2 Independent Samples...- Put your dependent variable in the box below Test Variable List and your independent (grouping) variable in the box below Grouping Variable
- Click on the Define Groups... button. If you can't click on it, first click on the grouping variable so its background turns yellow
- Fill in the value you have used to indicate your first group in the box next to Group 1, and the value you have used to indicate your second group in the box next to Group 2
- Continue and click OK

##### Jamovi

How to perform the mann-whitney-wilcoxon test in jamovi:

T-Tests > Independent Samples T-Test- Put your dependent variable in the box below Dependent Variables and your independent (grouping) variable in the box below Grouping Variable
- Under Tests, select Mann-Whitney U
- Under Hypothesis, select your alternative hypothesis