{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $y_1, \\dots, y_n \\in \\R$ be data observed at points $x_1 \u003c x_2 \u003c \\dots \u003c x_n$, and let $w_1, \\dots, w_n \u003e 0$ be weights.\nThe *isotonic regression* of $y$ is the vector $\\hat y \\in \\R^n$ that minimises\n$$\\sum_{i=1}^{n} w_i (y_i - z_i)^2$$\nover all $z \\in \\R^n$ with $z_1 \\le z_2 \\le \\dots \\le z_n$.\n\n## Remarks\n\nThe set of non-decreasing vectors is a closed [[convex|0K06X9QXDX]] cone, so $\\hat y$ is the projection of $y$ onto it for the weighted inner product, and it exists and is unique.\nIt has the min-max formula $\\hat y_i = \\max_{s \\le i} \\min_{t \\ge i} \\mathrm{Av}(s, t)$, where $\\mathrm{Av}(s, t) = \\sum_{k=s}^{t} w_k y_k / \\sum_{k=s}^{t} w_k$.\nThe pool adjacent violators algorithm computes $\\hat y$ in $O(n)$ steps: it merges adjacent blocks whose averages are out of order and replaces them by their weighted average.\nThe same definition works for any partial order on the index set, with $z_i \\le z_j$ required whenever $i$ precedes $j$.\n\nExample: $y = (1, 3, 2)$ with equal weights.\nThe pair $3, 2$ violates the order, and pooling gives $\\hat y = (1, 2.5, 2.5)$, which is non-decreasing.\nIts squared error is $0 + 0.25 + 0.25 = 0.5$.\n\nNon-example: $z = (1, 3, 2)$ itself has error $0$ but it is not non-decreasing, so it is not admissible; the [[monotone|0WFF6AZPBP]] constraint is what makes $\\hat y$ differ from $y$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "JAFPWZDM95",
    "kind": "definition",
    "msc": [
      "62G08",
      "62G05"
    ],
    "name": "Isotonic regression",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Isotonic_regression"
      }
    ],
    "tag": "P7XYNN27AM",
    "uses": [
      "0BYTQ4X1HC",
      "0WFF6AZPBP",
      "0K06X9QXDX"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/P7XYNN27AM/",
  "links": [
    {
      "field": "defines",
      "target": "JAFPWZDM95"
    },
    {
      "field": "uses",
      "target": "0BYTQ4X1HC"
    },
    {
      "field": "uses",
      "target": "0WFF6AZPBP"
    },
    {
      "field": "uses",
      "target": "0K06X9QXDX"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/P7XYNN27AM.md",
  "msc": [
    "62G08",
    "62G05"
  ],
  "name": "Isotonic regression",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/P7X/P7XYNN27AM.md",
  "status": null,
  "tag": "P7XYNN27AM",
  "uri": "m2://P7XYNN27AM",
  "url": "https://tamnd.github.io/math2/wiki/isotonic-regression-definition/",
  "writing": {
    "tag": "P7XYNN27AM",
    "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
      }
    ]
  }
}
