{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet two groups give right-[[censored|MY8ZZP84NP]] lifetime data.\nLet $t_1 \u003c \\dots \u003c t_m$ be the distinct event times in the pooled data.\nAt $t_j$, let $n_j$ be the number at risk and $d_j$ the number of events in the pooled data.\nLet $n_{1j}$ and $d_{1j}$ be the same numbers in group 1.\nSet\n$$E_j = d_j \\frac{n_{1j}}{n_j}, \\qquad V_j = d_j \\frac{n_{1j}}{n_j} \\left(1 - \\frac{n_{1j}}{n_j}\\right) \\frac{n_j - d_j}{n_j - 1},$$\nwith $V_j = 0$ when $n_j = 1$.\nThe *log-rank statistic* is\n$$Z = \\frac{\\sum_{j=1}^{m} (d_{1j} - E_j)}{\\sqrt{\\sum_{j=1}^{m} V_j}}.$$\nThe *log-rank test* of the null hypothesis that the two groups have the same [[hazard function|Y959NKQ3XW]] rejects at level $\\alpha$ when $\\abs{Z} \u003e z_{1 - \\alpha/2}$.\nHere $z_{1 - \\alpha/2}$ is the $(1 - \\alpha/2)$-quantile of the standard [[normal distribution|05AQE0QR0D]].\n\n## Remarks\n\nUnder the null hypothesis and non-informative censoring, $Z$ is approximately standard normal for large samples, and $Z^2$ is approximately [[chi-squared|0A9EB0KQBC]] with $1$ degree of freedom.\nGiven the numbers at risk, $E_j$ and $V_j$ are the mean and variance of $d_{1j}$ under the hypergeometric distribution.\n\nExample: group 1 has events at times $1$ and $3$, group 2 at times $2$ and $4$, with no censoring.\nThe pairs $(n_j, n_{1j})$ are $(4, 2)$, $(3, 1)$, $(2, 1)$, $(1, 0)$, with $d_j = 1$ each time and $d_{1j} = 1, 0, 1, 0$.\nSo $\\sum (d_{1j} - E_j) = 1/2 - 1/3 + 1/2 + 0 = 2/3$ and $\\sum V_j = 1/4 + 2/9 + 1/4 = 13/18$, which gives $Z \\approx 0.78$: no evidence of a difference.\n\nNon-example: comparing the two Kaplan–Meier estimates at a single fixed time, say $t = 2$, is a different test.\nIt ignores the events at all other times, while the log-rank statistic combines them.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "F6CT1YXZ0G",
    "kind": "definition",
    "msc": [
      "62N03",
      "62G10",
      "62P10"
    ],
    "name": "Log-rank test",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Logrank_test"
      }
    ],
    "tag": "1R358D2T7J",
    "uses": [
      "087P03NEND",
      "MY8ZZP84NP",
      "Y959NKQ3XW",
      "05AQE0QR0D",
      "0A9EB0KQBC"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/1R358D2T7J/",
  "links": [
    {
      "field": "defines",
      "target": "F6CT1YXZ0G"
    },
    {
      "field": "uses",
      "target": "087P03NEND"
    },
    {
      "field": "uses",
      "target": "MY8ZZP84NP"
    },
    {
      "field": "uses",
      "target": "Y959NKQ3XW"
    },
    {
      "field": "uses",
      "target": "05AQE0QR0D"
    },
    {
      "field": "uses",
      "target": "0A9EB0KQBC"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/1R358D2T7J.md",
  "msc": [
    "62N03",
    "62G10",
    "62P10"
  ],
  "name": "Log-rank test",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/1R3/1R358D2T7J.md",
  "status": null,
  "tag": "1R358D2T7J",
  "uri": "m2://1R358D2T7J",
  "url": "https://tamnd.github.io/math2/wiki/log-rank-test-definition/",
  "writing": {
    "tag": "1R358D2T7J",
    "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
      }
    ]
  }
}
