{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $Z_1, \\dots, Z_n$ be [[i.i.d.|0AJN7WHBJZ]] real random variables with a continuous distribution that is symmetric about a number $\\theta$, that is, $Z_1 - \\theta$ and $\\theta - Z_1$ have the same law.\nLet $R_i$ be the rank of $\\abs{Z_i}$ among $\\abs{Z_1}, \\dots, \\abs{Z_n}$, so that the smallest has rank $1$.\nThe *signed-rank statistic* is\n$$W^+ = \\sum_{i \\,:\\, Z_i \u003e 0} R_i.$$\nThe *Wilcoxon signed-rank test* of $H_0 \\colon \\theta = 0$ rejects $H_0$ when $W^+$ is too large, too small, or either, according to the alternative.\nUnder $H_0$, $W^+$ has the law of $\\sum_{k=1}^{n} k B_k$, where $B_1, \\dots, B_n$ are independent [[Bernoulli|0J97P5KZY0]] variables with parameter $1/2$.\n\n## Remarks\n\nUnder $H_0$, $E[W^+] = n(n+1)/4$ and $\\operatorname{Var}(W^+) = n(n+1)(2n+1)/24$, and $W^+$ is asymptotically normal.\nFor matched pairs $(X_i, Y_i)$ one takes $Z_i = Y_i - X_i$.\n\nExample: $Z = (1.2, -0.4, 2.5)$.\nThe absolute values $1.2, 0.4, 2.5$ have ranks $2, 1, 3$, so $W^+ = 2 + 3 = 5$.\nUnder $H_0$ each of the $8$ sign patterns has probability $1/8$, and only the sets of ranks $\\set{2, 3}$ and $\\set{1, 2, 3}$ give a sum at least $5$.\nSo the one-sided p-value is $P(W^+ \\ge 5) = 2/8 = 1/4$.\n\nNon-example: if the $Z_i$ have median $0$ but a skewed law, the clause on symmetry fails.\nThen the null law above is wrong, and the test can reject often even though the median is $0$; the [[sign test|NBK6G2VB7A]] is valid in that case.\n\nInverting the test gives the [[Hodges–Lehmann estimator|T6KRQAQQ15]] of $\\theta$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "38SETDT2HN",
    "kind": "definition",
    "msc": [
      "62G10"
    ],
    "name": "Wilcoxon signed-rank test",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test"
      }
    ],
    "tag": "9RPYB7S4HM",
    "uses": [
      "087P03NEND",
      "0AJN7WHBJZ",
      "0J97P5KZY0"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/9RPYB7S4HM/",
  "links": [
    {
      "field": "defines",
      "target": "38SETDT2HN"
    },
    {
      "field": "uses",
      "target": "087P03NEND"
    },
    {
      "field": "uses",
      "target": "0AJN7WHBJZ"
    },
    {
      "field": "uses",
      "target": "0J97P5KZY0"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/9RPYB7S4HM.md",
  "msc": [
    "62G10"
  ],
  "name": "Wilcoxon signed-rank test",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/9RP/9RPYB7S4HM.md",
  "status": null,
  "tag": "9RPYB7S4HM",
  "uri": "m2://9RPYB7S4HM",
  "url": "https://tamnd.github.io/math2/wiki/wilcoxon-signed-rank-test-definition/",
  "writing": {
    "tag": "9RPYB7S4HM",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
