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? 
 A: 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.
A: 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:
\begin{equation}
W(X)=\sum_{i=1}^n{Z_iR_i}
\end{equation}
where
\begin{equation}
Z_i = \mathbb{I}(X_i>\mu_0)
\end{equation}
and $R_i$ is the rank of $|X_i-\mu_0|$ in $\{ |X_1-\mu_0|,...,|X_n-\mu_0|\}$, that is, 
\begin{equation}
R_i=\sum_{j=1}^n{\mathbb{I}(|X_j-\mu_0|\leq|X_i-\mu_0|)}
\end{equation}
Now
\begin{equation}
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)}
\end{equation}
We can remove dependence on the $X_i>\mu_0$ as the remaining indicator function will return zero if $X_i<\mu_0$.
\begin{equation}
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)}
\end{equation}
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$.
