{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $n \\ge 2$, let $a \\le x_1 \u003c x_2 \u003c \\cdots \u003c x_n \\le b$ be real nodes, let $y_1, \\dots, y_n$ be real numbers, and let $\\lambda \u003e 0$.\nLet $W$ be the space of functions $f \\colon [a, b] \\to \\R$ such that $f'$ is absolutely continuous and $f''$ is square integrable.\nThe *smoothing spline* for these data is the function $f \\in W$ that minimizes\n$$J_\\lambda(f) = \\sum_{i=1}^{n} \\big(y_i - f(x_i)\\big)^2 + \\lambda \\int_a^b f''(x)^2 \\, dx.$$\n\n## Remarks\n\nThe minimizer exists and is unique, and it is a natural [[cubic spline|V42H0R3EKX]] with knots $x_1, \\dots, x_n$: a cubic on each $[x_i, x_{i+1}]$, of class $C^2$, and linear on $[a, x_1]$ and $[x_n, b]$.\nUniqueness uses $n \\ge 2$: then a function with $f'' = 0$ that vanishes at all nodes is zero.\nExample: if the data lie on a line, $y_i = \\alpha + \\beta x_i$, then $f(x) = \\alpha + \\beta x$ gives $J_\\lambda(f) = 0$, so it is the smoothing spline for every $\\lambda$.\nNon-example: take $n \\ge 3$ data not on a line, and let $g$ be the natural cubic spline through them.\nIts [[second derivative|0Y9D2FJRQ4]] penalty is positive, and moving $g$ slightly toward a line lowers $J_\\lambda$, so $g$ is not the minimizer.\nAs $\\lambda \\to 0$ the smoothing spline tends to the natural interpolating cubic spline, and as $\\lambda \\to \\infty$ it tends to the [[least squares|0BYTQ4X1HC]] regression line.\nIn practice $\\lambda$ is often chosen by generalized cross-validation.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "BNEXZF75QC",
    "kind": "definition",
    "msc": [
      "65D10",
      "41A15",
      "62G08"
    ],
    "name": "Smoothing spline",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Smoothing_spline"
      }
    ],
    "tag": "7JN0ADA86C",
    "uses": [
      "V42H0R3EKX",
      "0BYTQ4X1HC",
      "0Y9D2FJRQ4"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/7JN0ADA86C/",
  "links": [
    {
      "field": "defines",
      "target": "BNEXZF75QC"
    },
    {
      "field": "uses",
      "target": "V42H0R3EKX"
    },
    {
      "field": "uses",
      "target": "0BYTQ4X1HC"
    },
    {
      "field": "uses",
      "target": "0Y9D2FJRQ4"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/7JN0ADA86C.md",
  "msc": [
    "65D10",
    "41A15",
    "62G08"
  ],
  "name": "Smoothing spline",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/7JN/7JN0ADA86C.md",
  "status": null,
  "tag": "7JN0ADA86C",
  "uri": "m2://7JN0ADA86C",
  "url": "https://tamnd.github.io/math2/wiki/smoothing-spline-definition/",
  "writing": {
    "tag": "7JN0ADA86C",
    "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
      }
    ]
  }
}
