# Prove the relationship between Walsh averages and Wilcoxon signed rank test

In my lecture notes it is stated that

sum of all positive signed ranks (defined in Wilcoxon signed rank test) = the number of Walsh averages that are greater than median

How can I prove this statement?

• Please add the [self-study] tag & read its wiki. Commented Jun 2, 2016 at 3:13

For clarity: The sample Walsh averages are the pairwise averages $$(x_i+x_j)/2$$, $$i=1,2,...n,$$ $$j=1,...,i$$. The median of the Walsh averages is the Hodges-Lehmann estimator, also called the pseudo-median.

Here's some (hopefully useful) hints to get you started -- which is basically one of several ways to just arrange the calculation methodically, but it makes it easier to see the connections between the two calculations.

Here the observations are from a single sample (in the case of a paired test the observations are the pair-differences, at which point we're dealing with a single sample of pair-differences). Further assume that the $$X$$'s are continuous (so for example, there are no tied ranks and no Walsh averages at 0)

Consider without loss of generality that we're comparing to a specified median of zero.

Let $$X_i = S_i M_i$$ where $$M_i=|X_i|$$ and $$S_i = \mathop{\mathrm{sgn}}(X_i)$$ (and similarly for $$j$$, when we deal with pairs of observations).

Then let $$R_i = \mathop{\mathrm{rank}}(M_i)$$. We now have some notation in place to describe the basic components of the signed rank test.

Now order the $$X$$-values from smallest magnitude to largest magnitude (i.e. sort them by the $$M$$-values).

(It helps to play with a small numerical example. Consider data values $$1.0, -2.4, 3.6$$ say -- these have deliberately been ordered as just described)

Write an $$n \times n$$ table with row and column headings being the ordered $$X_i$$ values (you may like to write a small $$(S_i,R_i)$$ under the columns).

Inside the table, for values on or above the main diagonal, put a "+" if the Walsh average of the corresponding row- and column- $$X$$-values is above 0 and "-" if it's below it. For each column, count how many "+" values there are.

Note that looking down a column we're just seeing $$X_i$$ compared with each other value that is no larger in magnitude than $$X_i$$ (i.e. with each observation to it's left in the ordered list, plus itself).

For the column labelled $$X_i$$, the count will either be positive or $$0$$. What determines which of the two things it is? Now note the connection between the column "+" count and $$R_i$$.

Hopefully you should be able to work your way to an argument from that.

Here's the example I mentioned above. Note that if $$X$$'s are 1.0, -2.4, 3.6 then the signed ranks are +1, -2 and +3:

           1.0  -2.4   3.6
1.0    +     -      +
-2.4          -      +
3.6                 +

(S,R)  +,1   -,2    +,3


It should be clear that if $$S_i$$ is $$-1$$ then there are no "+" terms in the column of positive Walsh averages, but if $$S_i=+1$$ then there are $$R_i$$ positive Walsh averages. What you need to do is make this observation a bit more formal and then argue a small step to the needed result from that.

• Because "Walsh average" is a fairly obscure term--there isn't even a Wikipedia reference, much less an entry for it--it would be nice to include a definition or explanation of it in your answer.
– whuber
Commented Jun 2, 2016 at 13:07
• @whuber Good thought. Done Commented Jun 2, 2016 at 16:34
• @Glen_b What happen if you change 1.0 by 2.6? How do we interpret the table? This contradicts the fact that if $S_i$ is −1 then there are no "+" terms in the column of positive Walsh-averages, Commented Apr 16, 2017 at 22:17
• I'm sorry I don't quite follow what you're asking. Perhaps you could ask a new more explicit question (i.e. give complete details of the sample and so on); you can refer back to this one with a link if need be. Commented Apr 17, 2017 at 2:03

I'll give a direct proof:

Suppose we have continuous data $$X=(X_1, ..., X_n)$$, assumed to be symmetric about the mean $$\mu$$. We consider the hypothesis $$H_0: \mu_0 = \mu$$. The signed rank statistic is:

$$$$W(X)=\sum_{i=1}^n{Z_iR_i}$$$$

where

$$$$Z_i = \mathbb{I}(X_i>\mu_0)$$$$

and $$R_i$$ is the rank of $$|X_i-\mu_0|$$ in $$\{ |X_1-\mu_0|,...,|X_n-\mu_0|\}$$, that is,

$$$$R_i=\sum_{j=1}^n{\mathbb{I}(|X_j-\mu_0|\leq|X_i-\mu_0|)}$$$$

Now

$$$$W(X)=\sum_{i=1}^n\sum_{j=1}^n{\mathbb{I}(|X_j-\mu_0|\leq|X_i-\mu_0|, X_i>\mu_0)}\\ =\sum_{i=1}^n\sum_{j=1}^n{\mathbb{I}(|X_j-\mu_0|\leq X_i-\mu_0, X_i>\mu_0)}\\ =\sum_{i=1}^n\sum_{j=1}^n{\mathbb{I}(|X_j-\mu_0|\leq X_i-\mu_0)}$$$$

We can remove dependence on the $$X_i>\mu_0$$ as the remaining indicator function will return zero if $$X_i<\mu_0$$.

$$$$W(X)=\sum_{i=1}^n\sum_{j=1}^n{\mathbb{I}(\mu_0-X_i \leq X_j-\mu_0\leq X_i-\mu_0)}\\ =\sum_{i=1}^n\sum_{j=1}^n{\mathbb{I}(2\mu_0\leq X_j+X_i\leq 2X_i)}\\ =\sum_{i=1}^n\sum_{j=1}^n{\mathbb{I}\left(\frac{X_i+X_j}{2}\geq \mu_0,X_j\leq X_i\right)}\\ =\sum_{1\leq i\leq j \leq n}{\mathbb{I}\left(\frac{X_i+X_j}{2}\geq \mu_0\right)}$$$$

The justification for this last step is that we see the order of $$X$$ makes no difference to the value of the statistic, so we may assume WLOG it is decreasing, in which case $$X_j\leq X_i \Rightarrow i\leq j$$.