We will cover by now:
Tests whether the median of a population equals a given value, or whether the median of paired differences equals zero.
Let
Zero differences are discarded.
Under H₀: $$ S \sim \text{Binomial}(n, 1/2) $$
Exact p-values are computed from the binomial distribution.
If m₀ is the true median, then $$ \mathbb{P}(X_i > m₀) = \mathbb{P}(X_i < m₀) = \tfrac{1}{2}. $$
By independence, the indicator variables are i.i.d. Bernoulli(1/2), yielding an exact distribution-free test.
A study is done to determine the effects of removing a renal blockage in patients whose renal function is impaired because of advanced metatstatic malignancy of nonurologic cause. The arterial blood pressure of a random sample of 10 patients is measured before and after surgery for treatment of the blockage yielded the following data:
The Wilcoxon signed-rank test is a non-parametric test for detecting a location shift in one-sample or paired-sample settings.
It is a robust alternative to the one-sample or paired t-test under non-normality.
Let $$ X_1, \dots, X_n \quad \text{i.i.d.} $$ and let $m_0$ be a hypothesized median.
Define differences: $$ d_i = X_i - m_0. $$
Given paired observations $(X_i, Y_i)$, define $$ d_i = X_i - Y_i. $$
In both cases, inference is performed on the distribution of the differences $d_i$.
Null hypothesis $$ H_0: \text{the distribution of } d_i \text{ is symmetric about } 0 $$
Alternative hypothesis $$ H_1: \text{the distribution of } d_i \text{ is not symmetric about } 0 $$ (or one-sided variants)
⚠️ Note: this is not merely a median test; symmetry is essential.
The two statistics are affinely equivalent: $$ W^+ = \frac{n(n+1)}{4} + \frac{1}{2} T_n, \quad T_n = 2W^+ - \frac{n(n+1)}{2}. $$
They induce identical tests, p-values, and decisions.
Under $H_0$:
Thus, $$ T_n = \sum_{i=1}^n R_i S_i $$ has an exact permutation distribution.
Equivalently, $$ W^+ = \sum_{i=1}^n R_i B_i, \quad B_i \sim \text{Bernoulli}(1/2). $$
This distribution:
Let $$ S = \sum_{k=1}^n k = \frac{n(n+1)}{2}. $$
Then $$ W^+ \in \{0,1,\dots,S\}. $$
Each value corresponds to the sum of a subset of $\{1,\dots,n\}$.
Formally: $$
\frac{#{\text{subsets of } {1,\dots,n} \text{ with sum } w}}{2^n}. $$
For every subset $A \subseteq \{1,\dots,n\}$, its complement $A^c$ satisfies: $$ \sum_{k \in A^c} k = S - \sum_{k \in A} k. $$
Hence: $$ \mathbb{P}(W^+ = w) = \mathbb{P}(W^+ = S - w), $$ and $$ \mathbb{E}[W^+] = \frac{S}{2} = \frac{n(n+1)}{4}. $$
For $W^+$: $$ \mathbb{E}[W^+] = \frac{n(n+1)}{4}, \quad \mathrm{Var}(W^+) = \frac{n(n+1)(2n+1)}{24}. $$
For $T_n$: $$ \mathbb{E}[T_n] = 0, \quad \mathrm{Var}(T_n) = \frac{n(n+1)(2n+1)}{6}. $$
Under symmetry: $$ d_i \stackrel{d}{=} -d_i. $$
Therefore:
Thus the statistic reduces to a randomly signed sum of fixed ranks, yielding:
Conditionally on the ranks: $$ T_n = \sum_{i=1}^n R_i S_i $$ is a sum of independent, mean-zero random variables.
Let $$ \sigma_n^2 = \sum_{i=1}^n R_i^2 \sim \frac{n^3}{3}. $$
Since $$ \max_i \frac{R_i^2}{\sigma_n^2} \to 0, $$ the Lindeberg condition holds.
Hence: $$ \frac{T_n}{\sqrt{\sigma_n^2}} \xrightarrow{d} N(0,1). $$
Equivalently: $$ \frac{W^+ - \mathbb{E}[W^+]}{\sqrt{\mathrm{Var}(W^+)}} \xrightarrow{d} N(0,1). $$
In these cases, the null distribution is distorted.
The Wilcoxon signed-rank test is an exact, distribution-free test for symmetry-based location shifts, whose null distribution arises from random sign permutations of fixed ranks and converges asymptotically to a normal distribution.