# Can someone explain to me need symmetrical distribution for Wilcoxon signed rank test?

So I am confused. I understand that Wilcoxon signed rank test does not need to have normal distribution (hence why it is used when your data is non-normally distributed in place of paired samples t-test). What I don't understand though is that the assumptions say the perform a box plot to see if is symmetrical? Is it looking to see if median's are roughly the same?

I'm not sure what they are referring to.

## 2 Answers

Let's first consider the test statistic, for two independently drawn measurements, $$x_1, \dots, x_N$$ and $$y_1, \dots, y_N$$.

$$W=\sum_i sgn(x_i - y_i)R_i$$

Where $$R_i$$ is the rank from smallest to largest. (We also need to drop 0's but let's not worry about this here).

Now getting to your question, I assume you are asking why the null hypothesis is that the distribution of differences is symmetric vs. the alternate hypothesis that the distribution of differences is not symmetric.

From a purely heuristic perspective, let's think about what we see when we look at the differences between two measurements of what, under the null, should have the same mean. Simply, we would expect that the differences are symmetric about 0. In particular, it can be shown that the test statistic under the null has a symmetric distribution for small $$N$$.

Perhaps, easier to see as $$N\to\infty$$ the test statistic will be approximately normal (a symmetric distribution). This is clear because if the distributions of $$x$$ and $$y$$ have the same mean, then we have the sum of mean zero random variables.

There is a little bit of work in actually showing these results and so I will leave you with an introductory reference: https://math.mit.edu/~rmd/650/nonpartests.pdf

• Nice explanation of paired case. And link. (+1) Commented May 19, 2021 at 6:03

Here's the kind of nonsense you can get when you try to use the one-sample Wilcoxon signed rank test on data from a highly skewed distribution, such as an exponential population with mean $$1.$$

This population has median $$\eta = -\ln(.5) = 0.69315.$$

qexp(.5)
[1] 0.6931472


Look at sample x of size $$n = 1000$$ from this distribution.

set.seed(2021)
x = rexp(1000)
summary(x)
Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
0.000806 0.283089 0.691022 1.005858 1.415143 6.687939

boxplot(x, col="skyblue2", pch=20, horizontal=T)


So the population median is $$\eta = 0.69315,$$ the sample median is $$H = 0.69102$$ and the null hypothesis $$H_0: \eta = 0.69315$$ against $$H_0: \eta \ne 0.69315.$$ is strongly rejected with P-value near $$0.$$

wilcox.test(x, mu = 0.69315)

Wilcoxon signed rank test
with continuity correction

data:  x
V = 298800, p-value = 1.072e-07
alternative hypothesis:
true location is not equal to 0.69315


This is not a fluke and not due to the large sample size. In 100,000 tests on exponential samples of size $$n=100,$$ almost 40% led to rejection at the 5% level, Of course, a legitimate test would have rejected only 5% of the time.

set.seed(1234)
pv = replicate(10^5, wilcox.test(rexp(100), mu = 0.69315)$p.val) mean(pv <= .05) [1] 0.38491  • Since$-\ln(0.5)$is irrational, could it be catching that your mu = 0.69315 is not quite the true value? I am having trouble thinking of a skewed distribution that has an integer median, but I am curious how that would go. – Dave Commented May 19, 2021 at 15:57 • @Dave: In principle, that could happen, but not here. Before posting, I tried testing with the$-\ln(0.5)\$ expressed to various numbers of decimal places. Commented May 19, 2021 at 16:30