{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $(X_1, Y_1), \\dots, (X_n, Y_n)$ be [[i.i.d.|0AJN7WHBJZ]] pairs of real random variables with $E\\abs{Y_1} \u003c \\infty$, and with regression function $m(x) = E[Y_1 \\mid X_1 = x]$, a [[conditional expectation|0TTDGTEFMN]].\nLet $K \\colon \\R \\to [0, \\infty)$ be a kernel as in [[kernel density estimation|ZV65XMJ9A4]], and let $h \u003e 0$ be a bandwidth.\nThe *Nadaraya–Watson kernel regression estimator* of $m$ is\n$$\\hat m_h(x) = \\frac{\\sum_{i=1}^{n} K\\big((x - X_i)/h\\big)\\, Y_i}{\\sum_{i=1}^{n} K\\big((x - X_i)/h\\big)},$$\ndefined at each $x$ where the denominator is not $0$.\n\n## Remarks\n\nThe weights $K((x - X_i)/h) / \\sum_j K((x - X_j)/h)$ are nonnegative and sum to $1$, so $\\hat m_h(x)$ is a weighted average of the $Y_i$.\nDividing the numerator and the denominator by $nh$ shows the denominator is the kernel density estimate of the law of $X$ at $x$.\nExample: with the box kernel $K = \\frac{1}{2} \\mathbf{1}_{[-1, 1]}$, $\\hat m_h(x)$ is the plain average of the $Y_i$ with $\\abs{X_i - x} \\le h$.\nNon-example: the numerator alone, divided by $nh$, estimates $m(x) f_X(x)$ rather than $m(x)$, where $f_X$ is the density of $X$.\nLocal polynomial regression generalizes this estimator; the Nadaraya–Watson estimator is the local constant case.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "710VV73909",
    "kind": "definition",
    "msc": [
      "62G08"
    ],
    "name": "Kernel regression",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Kernel_regression"
      }
    ],
    "tag": "7H2639JPXJ",
    "uses": [
      "ZV65XMJ9A4",
      "0TTDGTEFMN",
      "0AJN7WHBJZ"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/7H2639JPXJ/",
  "links": [
    {
      "field": "defines",
      "target": "710VV73909"
    },
    {
      "field": "uses",
      "target": "ZV65XMJ9A4"
    },
    {
      "field": "uses",
      "target": "0TTDGTEFMN"
    },
    {
      "field": "uses",
      "target": "0AJN7WHBJZ"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/7H2639JPXJ.md",
  "msc": [
    "62G08"
  ],
  "name": "Kernel regression",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/7H2/7H2639JPXJ.md",
  "status": null,
  "tag": "7H2639JPXJ",
  "uri": "m2://7H2639JPXJ",
  "url": "https://tamnd.github.io/math2/wiki/kernel-regression-definition/",
  "writing": {
    "tag": "7H2639JPXJ",
    "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
      }
    ]
  }
}
