One sample Wilcoxon signed-rank test

This page offers all the basic information you need about the one sample wilcoxon signed-rank 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 one sample wilcoxon signed-rank test with other statistical methods, go to Statkat's or practice with the one sample wilcoxon signed-rank test at Statkat's

Contents

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 one sample wilcoxon signed-rank test requires one variable of the following type:

Variable type required for the one sample wilcoxon signed-rank test :
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 one sample wilcoxon signed-rank test tests the following null hypothesis (H0):

H0: $m = m_0$

$m$ is the population median; $m_0$ is the population median according to the null hypothesis.
Alternative hypothesis

The one sample wilcoxon signed-rank test tests the above null hypothesis against the following alternative hypothesis (H1 or Ha):

H1 two sided: $m \neq m_0$
H1 right sided: $m > m_0$
H1 left sided: $m < m_0$
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 one sample wilcoxon signed-rank test makes the following assumptions:

Test statistic

The one sample wilcoxon signed-rank 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. We will denote the first option the $W_1$ statistic (also known as the $T$ statistic), and the second option the $W_2$ statistic. In order to compute each of the test statistics, follow the steps below:
  1. For each subject, compute the sign of the difference score $\mbox{sign}_d = \mbox{sgn}(\mbox{score} - m_0)$. The sign is 1 if the difference is larger than zero, -1 if the diffence is smaller than zero, and 0 if the difference is equal to zero.
  2. For each subject, compute the absolute value of the difference score $|\mbox{score} - m_0|$.
  3. Exclude subjects with a difference score of zero. This leaves us with a remaining number of difference scores equal to $N_r$.
  4. Assign ranks $R_d$ to the $N_r$ remaining absolute difference scores. The smallest absolute difference score corresponds to a rank score of 1, and the largest absolute difference score corresponds to a rank score of $N_r$. If there are ties, assign them the average of the ranks they occupy.
Then compute the test statistic:

Sampling distribution

Sampling distribution of $W_1$ and of $W_2$ if H0 were true:

Sampling distribution of $W_1$:
If $N_r$ is large, $W_1$ is approximately normally distributed with mean $\mu_{W_1}$ and standard deviation $\sigma_{W_1}$ if the null hypothesis were true. Here $$\mu_{W_1} = \frac{N_r(N_r + 1)}{4}$$ $$\sigma_{W_1} = \sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{24}}$$ Hence, if $N_r$ is large, the standardized test statistic $$z = \frac{W_1 - \mu_{W_1}}{\sigma_{W_1}}$$ follows approximately the standard normal distribution if the null hypothesis were true.

Sampling distribution of $W_2$:
If $N_r$ is large, $W_2$ is approximately normally distributed with mean $0$ and standard deviation $\sigma_{W_2}$ if the null hypothesis were true. Here $$\sigma_{W_2} = \sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{6}}$$ Hence, if $N_r$ is large, the standardized test statistic $$z = \frac{W_2}{\sigma_{W_2}}$$ follows approximately the standard normal distribution if the null hypothesis were true.

If $N_r$ is small, the exact distribution of $W_1$ or $W_2$ should be used.

Note: the formula for the standard deviations $\sigma_{W_1}$ and $\sigma_{W_2}$ 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: Right sided: Left sided:
Example context

The one sample wilcoxon signed-rank test could for instance be used to answer the question:

Is the median mental health score different from 50?
SPSS

How to perform the one sample wilcoxon signed-rank test in SPSS:

Specify the measurement level of your variable on the Variable View tab, in the column named Measure. Then go to:

Analyze > Nonparametric Tests > One Sample...
Jamovi

How to perform the one sample wilcoxon signed-rank test in jamovi:

T-Tests > One Sample T-Test