The Wilcoxon Signed-Rank Test (Wilcoxon 1945) is an alternative for the Paired Two Sample t-Test. It often yields valid results, even when the underlying Central Limit Theorem assumptions of the Paired Two Sample t-Test are not satisfied.
117.1 Hypotheses -- Example
Suppose we wish to test the following statistical hypothesis for a bivariate, quantitative dataset:
\[
\begin{cases}\text{H}_0: \text{the median paired difference equals } \mu_0 \\\text{H}_A: \text{the median paired difference differs from } \mu_0\end{cases}
\]
where \(\mu_0 = 0\). The chosen type I error \(\alpha\) is 5%.
For this location interpretation, the distribution of paired differences is assumed to be symmetric around its median.
In case we wish to perform a one-sided test, we can formulate the following hypotheses:
The p-value for the two-sided hypothesis is smaller than the chosen type I error. As a consequence we reject the Null Hypothesis.
The choice between alternative = "less" and alternative = "greater" must be made before examining the sample results, based on substantive prior knowledge.
With alternative = "greater", the p-value is smaller than the chosen type I error \(\alpha = 0.05\). As a consequence we reject the Null Hypothesis.
For reporting, add an effect size (for example rank-biserial correlation for paired data), not only the p-value:
\[
r_{rb} = \frac{W^+ - W^-}{W^+ + W^-}
\]
where \(W^+\) and \(W^-\) are sums of positive and negative signed ranks.
To compute the Wilcoxon Signed-Rank Test on your local machine, the following script can be used in the R console.
Note: this local script is a synthetic template. The embedded app example above uses the AMS dataset and therefore has different numeric output.
set.seed(123)A <-rnorm(150)B <-rnorm(150)x <-cbind(A, B)par1 =1#column number of first samplepar2 =2#column number of second samplepar3 =0.95#confidence (= 1 - alpha)par4 ='two.sided'par5 ='paired'par6 =0.0#Null Hypothesisif (par5 =='unpaired') paired <-FALSEelse paired <-TRUE(wilcox.test(x[,par1], x[,par2], alternative=par4, paired=paired, mu=par6, conf.level=par3))
Wilcoxon signed rank test with continuity correction
data: x[, par1] and x[, par2]
V = 5127, p-value = 0.3155
alternative hypothesis: true location shift is not equal to 0
117.3 Assumptions
There are four assumptions for the Wilcoxon Signed-Rank Test:
Each pair of measurements comes from the same population.
The pairs are chosen independently and completely at random.
The data are measured at least on an ordinal scale.
The paired differences are approximately symmetric around their median.
There is no need to make distributional assumptions (i.e. Central Limit Theorem) to apply the Wilcoxon Signed-Rank Test -- hence, it is often preferred.
117.4 Alternatives
Since the Wilcoxon Signed-Rank Test is an alternative for the Paired Two Sample t-Test, the alternatives are also the same as for the One Sample t-Test (cfr. Chapter 114).