{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $X_1, X_2, \\dots$ be observed one at a time, in the setting of the [[change detection|Z5H8ZZHVMC]] problem with pre-change density $f_0$ and post-change density $f_1$.\nLet $\\ell(x) = \\log \\big( f_1(x) / f_0(x) \\big)$ be the log [[likelihood ratio|0VW9E4QXR6]] of one observation.\nThe *CUSUM statistic* is defined by\n$$W_0 = 0, \\qquad W_n = \\max\\left(0, \\; W_{n-1} + \\ell(X_n)\\right) \\quad (n \\ge 1).$$\nFor a threshold $h \u003e 0$, the *CUSUM procedure* is the [[stopping time|WND87FBAKC]]\n$$T_h = \\min \\set{n \\ge 1 : W_n \\ge h},$$\nat which it raises an alarm.\n\n## Remarks\n\nEquivalently, $W_n = \\max_{1 \\le k \\le n + 1} \\sum_{i=k}^{n} \\ell(X_i)$, with the empty sum for $k = n + 1$ equal to $0$.\nSo $W_n$ is the largest log-likelihood ratio of \"a change happened at time $k$\" against \"no change yet\", over all candidate times $k$.\n\nExample: for a shift of a normal mean from $\\mu_0$ to $\\mu_1 \u003e \\mu_0$ with variance $\\sigma^2$, one finds $\\ell(x) = \\frac{\\mu_1 - \\mu_0}{\\sigma^2} \\left( x - \\frac{\\mu_0 + \\mu_1}{2} \\right)$.\nAfter rescaling, the statistic becomes $S_n = \\max(0, S_{n-1} + X_n - \\mu_0 - k)$ with the reference value $k = (\\mu_1 - \\mu_0)/2$, the form used in quality control.\n\nNon-example: the plain cumulative sum $\\sum_{i=1}^n \\ell(X_i)$ without the reset at $0$ is not the CUSUM statistic.\nBefore the change it drifts down to $-\\infty$, so after a late change it needs a long time to climb back to the threshold.\n\nThe mean time to a false alarm satisfies $E_\\infty[T_h] \\ge e^h$, which guides the choice of $h$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "1VXZHAHT6K",
    "kind": "definition",
    "msc": [
      "62L10",
      "62P30"
    ],
    "name": "CUSUM",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/CUSUM"
      }
    ],
    "tag": "VYM8AJ8111",
    "uses": [
      "Z5H8ZZHVMC",
      "9CWYNB9003",
      "0VW9E4QXR6",
      "WND87FBAKC"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/VYM8AJ8111/",
  "links": [
    {
      "field": "defines",
      "target": "1VXZHAHT6K"
    },
    {
      "field": "uses",
      "target": "Z5H8ZZHVMC"
    },
    {
      "field": "uses",
      "target": "9CWYNB9003"
    },
    {
      "field": "uses",
      "target": "0VW9E4QXR6"
    },
    {
      "field": "uses",
      "target": "WND87FBAKC"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/VYM8AJ8111.md",
  "msc": [
    "62L10",
    "62P30"
  ],
  "name": "CUSUM",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/VYM/VYM8AJ8111.md",
  "status": null,
  "tag": "VYM8AJ8111",
  "uri": "m2://VYM8AJ8111",
  "url": "https://tamnd.github.io/math2/wiki/cusum-definition/",
  "writing": {
    "tag": "VYM8AJ8111",
    "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
      }
    ]
  }
}
