{
  "id": "wilcoxon-signed-rank-test",
  "title": "Wilcoxon signed-rank test",
  "lang": "en",
  "source_lang": "en",
  "summary": "The Wilcoxon signed-rank test is a nonparametric test of a symmetric population’s location, applied to one sample or paired differences using signed ranks.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "Signed-rank test",
    "Wilcoxon matched-pairs signed-rank test",
    "Wilcoxon paired-sample test"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/wilcoxon-signed-rank-test/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/wilcoxon-signed-rank-test/",
      "json": "https://aiwiki.page/zh/wilcoxon-signed-rank-test.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The Wilcoxon signed-rank test is a statistical hypothesis test used to assess whether a population of measurements, or differences between paired measurements, is symmetric about a specified value. It combines the signs of deviations from that value with the ranks of their absolute magnitudes. Under a symmetric location model, it tests whether the population’s center equals the specified value. Introduced by Frank Wilcoxon in 1945, it is a standard method in nonparametric statistics and an alternative to the paired Student’s t-test when a normal model for differences is unsuitable."
    },
    {
      "heading": "Setting and hypotheses",
      "text": "The test has two common forms:\n\n- One-sample form: observations \\(X_1,\\ldots,X_n\\) are compared with a specified location \\(\\theta_0\\), using differences \\(D_i=X_i-\\theta_0\\).\n- Paired-sample form: each observational unit provides two measurements, \\(X_i\\) and \\(Y_i\\), and the test is applied to \\(D_i=Y_i-X_i\\). A hypothesized change other than zero can also be subtracted.\n\nPairing may arise from repeated measurements of the same unit or from matched units. Independence is required between pairs, not between the two observations within a pair.\n\nA standard formulation assumes that the differences are independent observations from a common continuous distribution symmetric about a location \\(\\theta\\). The null hypothesis is\n\n\\[H_0:\\theta=0.\\]\n\nThe alternative hypothesis may be two-sided, \\(\\theta\\ne0\\), or one-sided, \\(\\theta>0\\) or \\(\\theta<0\\).\n\nUnder symmetry, the location is also the population median. Nevertheless, the signed-rank test is not a distribution-free test of a median alone: a distribution can have median zero without being symmetric, and the usual signed-rank null distribution need not then apply."
    },
    {
      "heading": "Construction of the statistic",
      "text": "For the conventional version of the test:\n\n- Compute the differences \\(D_i\\).\n- Remove differences equal to zero.\n- Rank the absolute values \\(|D_i|\\) from smallest to largest.\n- Assign tied absolute values their average rank.\n- Sum the ranks separately for positive and negative differences.\n\nLet \\(m\\) be the number of nonzero differences and \\(R_i\\) the rank assigned to \\(|D_i|\\). Define\n\n\\[W^+=\\sum_{i:D_i>0}R_i, \\qquad W^-=\\sum_{i:D_i<0}R_i.\\]\n\nSince the ranks sum to \\(m(m+1)/2\\),\n\n\\[W^++W^-=\\frac{m(m+1)}{2}.\\]\n\nLarge \\(W^+\\) supports a positive location shift; small \\(W^+\\) supports a negative shift. Common choices of test statistic include \\(W^+\\), the smaller sum\n\n\\[T=\\min(W^+,W^-),\\]\n\nand the signed sum\n\n\\[S=W^+-W^-.\\]\n\nThese statistics encode equivalent information when \\(m\\) is fixed, but software packages use different names and reporting conventions. A reported “Wilcoxon statistic” therefore requires its definition to be clear.\n\nThe ranks here describe ordering by magnitude and are unrelated to matrix rank."
    },
    {
      "heading": "Exact null distribution",
      "text": "Under the continuous symmetric null hypothesis, each difference is equally likely to be positive or negative, and its sign is independent of its absolute magnitude. Conditional on the observed magnitudes, all \\(2^m\\) sign assignments are equally probable.\n\nWithout ties, \\(W^+\\) consequently has the same distribution as\n\n\\[\\sum_{r=1}^{m}rB_r,\\]\n\nwhere the \\(B_r\\) are independent Bernoulli random variables with success probability \\(1/2\\).\n\nThis yields an exact sampling distribution, obtainable through enumeration or recursive calculation. For an upper-tailed alternative, the p-value is\n\n\\[P_0(W^+\\ge w_{\\mathrm{obs}}).\\]\n\nA common two-sided convention doubles the smaller inclusive tail probability, capped at 1:\n\n\\[p_{\\mathrm{two}} = \\min\\!\\left[ 1,\\, 2\\min\\left\\{ P_0(W^+\\le w_{\\mathrm{obs}}), P_0(W^+\\ge w_{\\mathrm{obs}}) \\right\\} \\right].\\]\n\nBecause the distribution is discrete, attainable p-values occur in steps. Different definitions of two-sided exact p-values can also produce different results, so the convention matters.\n\nExample\n\nSuppose six paired differences are\n\n\\[-1,\\ 2,\\ 3,\\ 4,\\ 5,\\ 6.\\]\n\nTheir absolute values already have ranks \\(1,\\ldots,6\\), giving\n\n\\[W^-=1,\\qquad W^+=20,\\qquad T=1.\\]\n\nOf the \\(2^6=64\\) possible sign assignments, two produce \\(W^+\\le1\\): no positive ranks, or only rank 1 positive. By symmetry, two produce \\(W^+\\ge20\\). The doubled-tail two-sided p-value is therefore\n\n\\[p=\\frac{4}{64}=0.0625.\\]\n\nThus, five positive differences out of six do not by themselves imply significance at a significance level of \\(0.05\\)."
    },
    {
      "heading": "Normal approximation",
      "text": "When there are no ties or zeros, the null expectation and variance of \\(W^+\\) are\n\n\\[E_0(W^+)=\\frac{m(m+1)}{4},\\]\n\n\\[\\operatorname{Var}_0(W^+) = \\frac{m(m+1)(2m+1)}{24}.\\]\n\nFor sufficiently large samples, a standardized statistic is approximately normally distributed:\n\n\\[Z= \\frac{W^+-m(m+1)/4} {\\sqrt{m(m+1)(2m+1)/24}}.\\]\n\nA continuity correction is often applied, commonly by moving the numerator \\(0.5\\) toward zero for a two-sided calculation. Its implementation depends on the tail and software convention.\n\nThere is no universal sample-size cutoff guaranteeing an adequate approximation. Accuracy depends on the sample size, ties, zero differences, and the tail probability of interest."
    },
    {
      "heading": "Ties and zero differences",
      "text": "Tied absolute differences\n\nTies receive average ranks. If zero differences have been discarded, the conditional sign-assignment variance is\n\n\\[\\operatorname{Var}_0(W^+\\mid R_1,\\ldots,R_m) = \\frac14\\sum_{i=1}^{m}R_i^2.\\]\n\nEquivalently, if tied groups have sizes \\(t_1,t_2,\\ldots\\),\n\n\\[\\operatorname{Var}_0(W^+) = \\frac{m(m+1)(2m+1)}{24} - \\frac{1}{48}\\sum_j(t_j^3-t_j).\\]\n\nThe usual no-tie exact tables are not valid unchanged when ties occur. Nevertheless, an exact conditional calculation can still be performed by enumerating sign assignments using the observed average ranks, provided the null sign-symmetry assumptions hold. Whether software implements this calculation varies.\n\nZero differences\n\nSeveral conventions are used:\n\n- Wilcoxon convention: discard zeros before ranking.\n- Pratt convention: include zeros when ranking absolute differences, but omit their ranks from the positive and negative sums.\n- Zero-splitting convention: include zeros in ranking and allocate half their rank sum to each side.\n\nThese conventions change the statistic and its null distribution. The formulas for the conventional no-zero procedure cannot be transferred unchanged to every alternative.\n\nIf every difference is zero, the conventional procedure has no nonzero ranks to analyze. Software may return a special result or indicate that the calculation is undefined."
    },
    {
      "heading": "Location estimation and confidence intervals",
      "text": "The signed-rank procedure is closely connected to the Hodges–Lehmann estimator. For a one-sample set of differences, form the Walsh averages\n\n\\[A_{ij}=\\frac{D_i+D_j}{2}, \\qquad 1\\le i\\le j\\le n.\\]\n\nTheir median is the one-sample Hodges–Lehmann estimate.\n\nIts population target is the pseudomedian, defined as a median of \\((D+D')/2\\), where \\(D\\) and \\(D'\\) are independent observations from the same population. For a continuous distribution symmetric about \\(\\theta\\), the pseudomedian and median both equal \\(\\theta\\). They need not coincide in an asymmetric distribution.\n\nA confidence interval for the symmetric location can be obtained by inverting signed-rank tests over candidate values. Its endpoints can be expressed using ordered Walsh averages. This connection does not make the standard test valid for arbitrary asymmetric distributions merely by reinterpreting its target as a pseudomedian."
    },
    {
      "heading": "Comparison with related tests",
      "text": "Paired Student’s t-test\n\nThe paired Student’s t-test tests the mean difference and has an exact finite-sample t distribution when the differences are normally distributed. The signed-rank test uses ranks rather than the original magnitudes and assumes symmetry for its standard location interpretation.\n\nThe signed-rank test is less sensitive to the numerical size of an extreme difference: making the largest absolute difference still larger does not change its rank. This does not make it assumption-free or immune to unusual observations.\n\nUnder normal location alternatives, its asymptotic relative efficiency against the paired t-test is \\(3/\\pi\\), approximately \\(0.955\\). Its relative power can be higher for some heavier-tailed distributions, but neither method is uniformly superior.\n\nSign test\n\nThe sign test uses only whether each difference is positive or negative. For continuous independent observations, its median test does not require symmetry.\n\nThe signed-rank test additionally uses the ordering of absolute differences. This extra information can improve power when the symmetry model is appropriate, but also introduces assumptions absent from the sign test.\n\nWilcoxon rank-sum test\n\nThe Wilcoxon rank-sum test, also called the Mann–Whitney U test, concerns two independent samples. It is not the signed-rank test. The shared name “Wilcoxon test” can obscure the distinction between paired and independent-sample designs."
    },
    {
      "heading": "Interpretation and limitations",
      "text": "The signed-rank test is used for paired comparisons in experiments, measurement studies, and other settings where differences have meaningful numerical magnitudes. Several limitations govern its interpretation:\n\n- Symmetry matters. Without it, rejection need not indicate a nonzero median; an asymmetric distribution with median zero can violate the signed-rank null.\n- Differences must be meaningful. Ranking absolute differences requires more structure than merely ordering the original observations. Arbitrary numerical coding of ordinal categories can change the result.\n- Observations must have the appropriate dependence structure. Repeated differences from the same participant, clustered units, or serially dependent measurements do not generally constitute independent pairs.\n- Statistical significance is not magnitude. A p-value does not quantify the practical importance of a change. A location estimate, interval, or clearly defined effect size provides different information.\n- Non-rejection is not equivalence. A large p-value does not establish that a change is absent or negligibly small.\n- Pairing does not establish causation. A significant before–after difference alone does not identify a causal effect; that interpretation depends on the study design and possible confounding.\n\nA reproducible report identifies the direction of subtraction, the alternative hypothesis, the statistic convention, the treatment of ties and zeros, and whether the p-value was exact, based on sign-assignment simulation, or obtained by a normal approximation."
    }
  ],
  "links": [
    "statistical-hypothesis-testing",
    "statistical-independence",
    "null-hypothesis",
    "alternative-hypothesis",
    "median",
    "absolute-value",
    "test-statistic",
    "matrix-rank",
    "bernoulli-distribution",
    "sampling-distribution",
    "p-value",
    "significance-level",
    "expected-value",
    "variance",
    "normal-distribution",
    "confidence-interval",
    "students-t-test",
    "statistical-power",
    "effect-size",
    "confounding"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}