{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $k \\ge 2$, and for $g = 1, \\dots, k$ let $X_{g1}, \\dots, X_{g n_g}$ be [[i.i.d.|0AJN7WHBJZ]] real random variables with a continuous distribution function $F_g$, the $k$ samples being independent.\nLet $N = n_1 + \\dots + n_k$.\nRank all $N$ observations together from $1$ to $N$, let $R_g$ be the sum of the ranks in sample $g$, and let $\\bar R_g = R_g / n_g$.\nThe *Kruskal–Wallis statistic* is\n$$H = \\frac{12}{N(N+1)} \\sum_{g=1}^{k} n_g \\Big( \\bar R_g - \\frac{N + 1}{2} \\Big)^2 = \\frac{12}{N(N+1)} \\sum_{g=1}^{k} \\frac{R_g^2}{n_g} - 3(N + 1).$$\nThe *Kruskal–Wallis test* of $H_0 \\colon F_1 = \\dots = F_k$ rejects $H_0$ when $H$ is large.\n\n## Remarks\n\nUnder $H_0$ the law of $H$ depends only on $n_1, \\dots, n_k$.\nAs all $n_g \\to \\infty$, $H$ [[converges in distribution|0JDAQHWA9N]] to the [[chi-squared distribution|0RFMMBHFTV]] with $k - 1$ degrees of freedom, which gives approximate critical values.\nThe number $(N+1)/2$ is the mean of the ranks $1, \\dots, N$.\n\nExample: $k = 2$, samples $(1, 2)$ and $(3, 4)$, so $N = 4$, $R_1 = 3$, $R_2 = 7$.\nThen $H = \\frac{12}{20}\\big(\\frac{9}{2} + \\frac{49}{2}\\big) - 15 = 17.4 - 15 = 2.4$.\nThe first form gives the same: $\\frac{12}{20}\\big(2(1.5 - 2.5)^2 + 2(3.5 - 2.5)^2\\big) = 0.6 \\cdot 4 = 2.4$.\n\nNon-example: repeated measurements on the same subjects under $k$ conditions are not independent samples.\nThe clause on independence fails; the Friedman test is used for such blocked data.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "EG4VCBXDKZ",
    "kind": "definition",
    "msc": [
      "62G10"
    ],
    "name": "Kruskal–Wallis test",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Kruskal%E2%80%93Wallis_test"
      }
    ],
    "tag": "ESQCJ06KZD",
    "uses": [
      "087P03NEND",
      "0AJN7WHBJZ",
      "0RFMMBHFTV",
      "0JDAQHWA9N"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/ESQCJ06KZD/",
  "links": [
    {
      "field": "defines",
      "target": "EG4VCBXDKZ"
    },
    {
      "field": "uses",
      "target": "087P03NEND"
    },
    {
      "field": "uses",
      "target": "0AJN7WHBJZ"
    },
    {
      "field": "uses",
      "target": "0RFMMBHFTV"
    },
    {
      "field": "uses",
      "target": "0JDAQHWA9N"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/ESQCJ06KZD.md",
  "msc": [
    "62G10"
  ],
  "name": "Kruskal–Wallis test",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/ESQ/ESQCJ06KZD.md",
  "status": null,
  "tag": "ESQCJ06KZD",
  "uri": "m2://ESQCJ06KZD",
  "url": "https://tamnd.github.io/math2/wiki/kruskal-wallis-test-definition/",
  "writing": {
    "tag": "ESQCJ06KZD",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
