---
title: Wilcoxon Signed-Rank Test
url: https://www.emergentmind.com/topics/wilcoxon-signed-rank-test
type: topic
---

# Wilcoxon Signed-Rank Test

The Wilcoxon Signed-Rank Test is a classical, distribution-free statistical hypothesis test for assessing whether the center of a paired or one-sample distribution shifts away from zero, most commonly applied to before-and-after experiments or paired measurements. It combines sign information with ranks of magnitude, yielding superior efficiency compared to the sign test while remaining robust under broad non-Gaussian conditions. The test has spawned numerous modern extensions, including smoothed, differentially private, Bayesian, and multivariate optimal-transport-based variants, all grounded in its foundational framework.

## 1. Classical Formulation and Statistical Properties

Given $n$ paired data points $(u_i, v_i)$, the Wilcoxon signed-rank test evaluates the null hypothesis $H_0$: the distribution of differences $d_i = v_i - u_i$ is symmetric about zero. The alternative hypothesis is that the differences are systematically positive (one-sided) or lack such symmetry (two-sided).

**Test Statistic**:  
1. Compute $d_i = v_i - u_i$ and $s_i = \mathrm{sign}(d_i) \in \{-1,0,1\}$.
2. Discard pairs with $d_i = 0$, or in the Pratt variant, retain them with $s_i = 0$.
3. For the nonzero $d_i$, assign absolute ranks $r_i$ (averaging ties).
4. Form the statistic:
   $$
   W = \sum_{i=1}^{n_r} s_{(i)} r_i = \sum_{i:d_i \ne 0} \mathrm{sign}(d_i) \times \mathrm{rank}(|d_i|)
   $$
   where $n_r$ is the number of nonzero $d_i$.

**Distribution Under $H_0$**:  
Exactly, enumerate all $2^{n_r}$ sign patterns for $W$; asymptotically, $W \dot\sim N(0, \sigma^2)$ with variance $\sigma^2 = n_r(n_r+1)(2n_r+1)/6$. The continuity-corrected normal approximation is routinely used for $n > 10$.

**p-Value Calculation**:  
- Exact: $p = \Pr_{H_0}(|W| \ge |w_\mathrm{obs}|)$  
- Normal: $p \approx 2[1 - \Phi\left(\frac{|w_\mathrm{obs}| - 0.5}{\sigma}\right)]$

This nonparametric test is invariant under strictly monotone transformations and robust to outliers. Under Gaussian shift alternatives, its asymptotic relative efficiency (ARE) to the paired $t$-test is $3/\pi \approx 0.955$, i.e., with only ~5% power loss under ideal normality—for heavier-tailed distributions, the ARE can exceed 1 [1311.5354].

## 2. Power under Shift and Mixture Alternatives

The standard claim is that, under pure location-shift in a Gaussian population, the $t$-test is optimal, with the Wilcoxon signed-rank test slightly less efficient. However, when multi-modal or mixture alternatives are present—that is, only a fraction $\theta>0$ of subjects experience a real effect while the rest remain unaffected—the Wilcoxon signed-rank test can surpass the $t$-test in power.

Consider the mixture model:
$$
f(x) = (1-\theta)\varphi(x;0,1) + \theta\varphi(x;\mu,\sigma^2)
$$
where $\varphi(\cdot;m,s^2)$ is the normal density.

For concentrated subpopulations (small $\sigma$ relative to $\mu$), the Pitman ARE of Wilcoxon to $t$-test can be $\gg1$, and practical scenarios (such as clinical trials with heterogeneous response or fMRI group analysis) confirm this efficiency advantage [1311.5354]. As a rule of thumb, if $\sigma/\mu \lesssim 2/3$, Wilcoxon is superior.

## 3. Extensions: Smoothed and Multivariate Signed-Rank Tests

### Smoothed Wilcoxon Test

To remedy the discrete “lattice effect” of classical rank tests and to achieve finer distributional approximations, smoothing via kernel estimators is employed [1610.02145]. Let $X_1,\ldots,X_n \sim F(x-\theta)$ and $k(u)$ a symmetric kernel. Define:
$$
\tilde W_n = \sum_{i<j} K\left(\frac{X_i+X_j}{2h_n}\right)
$$
where $K$ is the integrated kernel and $h_n \to 0$ controls smoothing.

Properties:
- $\tilde W_n$ is asymptotically normal after centering and scaling.
- Pitman ARE versus the classical $W$ is unity.
- Edgeworth expansions to $o(n^{-1})$ are available when a 4th-order kernel is used.
- Simulations indicate smoother p-value behavior and preserved power, with $h_n \approx n^{-1/3}/\log n$ recommended.

### Multivariate Extension

The univariate Wilcoxon signed-rank test is generalized to arbitrary dimensions via optimal transport [2305.01839]. Given $n$ vectors $X_i \in \mathbb{R}^p$, assign signs and ranks by mapping each sample via optimal assignment (with respect to a compact group $G \subset O(p)$ and a reference measure $\nu$), inducing multivariate signed ranks.

The Generalized Wilcoxon Signed-Rank (GWSR) statistic
$$
\mathbf{W}_n = \frac{1}{\sqrt{n}} \sum_{i=1}^n S_n(X_i) J(R_n(X_i))
$$
retains exact distribution-freeness under the null and achieves ARE $\geq 1$ relative to Hotelling’s $T^2$ under broad shift alternatives, with local maximin optimality available via appropriate score transformation. Implementation requires solving an assignment problem (Hungarian/Auction method, $O(n^3)$) and is suitable for general notions of symmetry (central, sign, spherical).

## 4. Privacy-Preserving and Bayesian Variants

### Differential Privacy

In contexts where dataset summaries can pose disclosure risks, a differentially private Wilcoxon signed-rank test is constructed [1809.01635]. The Pratt variant is used, incorporating zeros ($s_i=0$) and ranking among all entries. The $L_1$ sensitivity is $2n$, so Laplace noise of scale $2n/\varepsilon$ is added to $W_P$. Since the null distribution of the privatized statistic is a convolution of normal and Laplace, p-values are estimated via Monte Carlo, fully accounting for sampling and added noise.

Empirically, for $\varepsilon=1$ and effect size $1\sigma$, 80% power is achieved at $n\approx32$ for the private test versus $n\approx14$ for the public version and $n\approx80$--$122$ for prior private approaches. Even at moderate privacy budgets and with up to 30% ties, the loss in power is mild, and practical recommendations include exclusive budget allocation to computation of the privatized statistic and Monte Carlo p-value estimation.

### Bayesian Signed-Rank Testing

Bayesian inference is enabled via a latent normal model [1712.06941], positing that observed $d_i$ are rank-revealing projections of $Z_i \sim N(\delta,1)$, with $\delta$ the location shift parameter. The observed signs and ranks are enforced as deterministic constraints on the latent variables. The hypotheses are $\mathcal{H}_0:\delta=0$ versus $\mathcal{H}_1:\delta \sim \mathrm{Cauchy}(0,r)$. The Savage-Dickey density ratio yields the Bayes factor:
$$
\mathrm{BF}_{10} = \frac{p(\delta=0|\mathcal{H}_1)}{p(\delta=0| \text{data},\mathcal{H}_1)}
$$
A data-augmentation Gibbs sampler (truncated normal steps for $Z_i$, Gaussian updates for $\delta$, inverse-gamma for $g$) is employed. Bayesian and classical tests are both rank-based and robust; however, the Bayesian approach yields direct evidence quantification and posterior intervals for effect sizes.

## 5. Practical Guidance and Application Scenarios

- For independent, paired data with a null hypothesis of symmetry about zero, the Wilcoxon signed-rank test is suitable when Gaussianity is dubious or outliers may be present [1311.5354].
- The Pratt variant avoids the need to privately estimate the number of nonzero differences and should be used in privacy-constrained analyses [1809.01635].
- In two-component or mixture alternatives common in heterogeneous responses (e.g., partial clinical trials, fMRI voxels), the signed-rank test can outperform the $t$-test, particularly for small shift/variance ratios [1311.5354].
- Smoothing the statistic supports higher-order distributional approximations and reduces discreteness in p-values for moderate samples [1610.02145].
- Bayesian and differentially private versions are well-developed, with efficient computational schemes and robust error/power behavior [1712.06941, 1809.01635].
- The test extends to the multivariate setting with provable distribution-freeness and asymptotic optimality using optimal transport [2305.01839].

## 6. Table of Key Wilcoxon Signed-Rank Variants

| Variant                | Principle                                   | ARE (vs. parametric) |
|------------------------|---------------------------------------------|----------------------|
| Classical              | Ranks + signs (1D), exact finite-sample     | $3/\pi \approx 0.955$|
| Smoothed               | Kernel smoothing of indicators              | $1$                  |
| Multivariate (GWSR)    | Optimal transport signs/ranks (multi-D)     | $\geq 1$             |
| Bayesian               | Latent normal, posterior/Bayes factor       | ≈ classical          |
| Differentially Private | Laplace mechanism (Pratt), Monte Carlo p    | Close to classical   |

## 7. Summary and Theoretical Significance

The Wilcoxon signed-rank framework unifies several branches of nonparametric inference via its central use of symmetric rank-and-sign statistics. Its large-sample efficiency remains remarkably close to classical parametric tests, and under mixture alternatives, it can exceed that efficiency. Modern theoretical advancements—including optimal-transport multivariate generalizations, smoothing for high-order accuracy, Bayesian evidence quantification, and formal differential privacy—demonstrate the flexibility of the signed-rank principle for contemporary methodological demands. Each extension maintains the foundational distribution-freeness and robustness, while targeting specific needs such as high-dimensional inference, privacy, or interpretability in scientific research [1311.5354, 1610.02145, 1809.01635, 2305.01839, 1712.06941].

Source: https://www.emergentmind.com/topics/wilcoxon-signed-rank-test