{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $(x_1, y_1), \\dots, (x_n, y_n)$ be data with $x_i, y_i \\in \\R$.\nLet $p \\ge 0$ be an integer, the degree, and let $h \u003e 0$ be a number, the bandwidth.\nLet $K \\colon \\R \\to [0, \\infty)$ be a weight function, for example the tricube function $K(u) = (1 - \\abs{u}^3)^3$ for $\\abs{u} \u003c 1$ and $K(u) = 0$ otherwise.\nFor a point $x \\in \\R$, let $\\hat\\beta(x) = (\\hat\\beta_0(x), \\dots, \\hat\\beta_p(x))$ be a minimiser of\n$$\\sum_{i=1}^{n} K\\Big(\\frac{x_i - x}{h}\\Big) \\Big( y_i - \\sum_{j=0}^{p} \\beta_j (x_i - x)^j \\Big)^2$$\nover $\\beta \\in \\R^{p+1}$.\nThe *local polynomial regression estimate* of degree $p$ at $x$ is $\\hat m(x) = \\hat\\beta_0(x)$.\n\n## Remarks\n\nThe minimisation is a [[weighted least squares|H5CGZHBR58]] problem with weights $w_i = K((x_i - x)/h)$.\nIt has a unique solution when at least $p + 1$ distinct points $x_i$ have $w_i \u003e 0$.\nIn LOESS the bandwidth depends on $x$: $h(x)$ is the distance from $x$ to its $\\lceil \\alpha n \\rceil$-th nearest point $x_i$, for a fixed fraction $\\alpha \\in (0, 1]$ called the span.\nLOWESS adds rounds of reweighting that lower the weights of points with large residuals.\n\nExample: take $p = 1$ and data that lie on a line, $y_i = a + b x_i$.\nThen $\\beta = (a + bx, b)$ makes every residual $y_i - \\beta_0 - \\beta_1 (x_i - x)$ zero, so it is a minimiser and $\\hat m(x) = a + bx$; local linear regression reproduces lines exactly.\n\nNon-example: ordinary least squares with a global polynomial uses the same weight for every point at every $x$.\nIts weights do not depend on the distance $\\abs{x_i - x}$, so it is not a local fit.\n\nFor $p = 0$ the estimate is the weighted average $\\sum_i w_i y_i / \\sum_i w_i$, the Nadaraya–Watson estimate of [[kernel regression|710VV73909]].\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "TQFFFSH0BQ",
    "kind": "definition",
    "msc": [
      "62G08",
      "62J02"
    ],
    "name": "Local regression",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Local_regression"
      }
    ],
    "tag": "2H0J4P4NQF",
    "uses": [
      "H5CGZHBR58",
      "0BYTQ4X1HC"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/2H0J4P4NQF/",
  "links": [
    {
      "field": "defines",
      "target": "TQFFFSH0BQ"
    },
    {
      "field": "uses",
      "target": "H5CGZHBR58"
    },
    {
      "field": "uses",
      "target": "0BYTQ4X1HC"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/2H0J4P4NQF.md",
  "msc": [
    "62G08",
    "62J02"
  ],
  "name": "Local regression",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/2H0/2H0J4P4NQF.md",
  "status": null,
  "tag": "2H0J4P4NQF",
  "uri": "m2://2H0J4P4NQF",
  "url": "https://tamnd.github.io/math2/wiki/local-regression-definition/",
  "writing": {
    "tag": "2H0J4P4NQF",
    "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
      }
    ]
  }
}
