{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $\\tau \\in (0, 1)$.\nThe *check function* is $\\rho_\\tau \\colon \\R \\to \\R$, $\\rho_\\tau(u) = u\\big(\\tau - \\mathbf{1}\\set{u \u003c 0}\\big)$, so $\\rho_\\tau(u) = \\tau u$ for $u \\ge 0$ and $\\rho_\\tau(u) = (\\tau - 1)u$ for $u \u003c 0$.\nLet $(x_1, y_1), \\dots, (x_n, y_n)$ be data with $x_i \\in \\R^p$ and $y_i \\in \\R$.\nThe *linear quantile regression* estimate at level $\\tau$ is any minimiser\n$$\\hat\\beta(\\tau) \\in \\arg\\min_{\\beta \\in \\R^p} \\sum_{i=1}^{n} \\rho_\\tau\\big(y_i - x_i^{T} \\beta\\big).$$\nIt estimates $\\beta(\\tau)$ in the model in which the conditional [[quantile function|0B3Q3XDM5X]] of $Y$ given $X = x$ at level $\\tau$ is $x^{T}\\beta(\\tau)$.\n\n## Remarks\n\nFor a real random variable $Y$, the minimisers of $b \\mapsto E[\\rho_\\tau(Y - b)]$ are exactly the $\\tau$-quantiles of $Y$ (when $E\\abs{Y} \u003c \\infty$).\nThis is why the check [[loss|3BTG6VVCGZ]] targets quantiles, just as squared loss targets the mean.\nThe minimisation is a linear program.\nWhen $x_1, \\dots, x_n$ span $\\R^p$, some minimiser fits at least $p$ data points exactly.\nFor $\\tau = 1/2$, $\\rho_{1/2}(u) = \\abs{u}/2$, and the method is least absolute deviations regression.\n\nExample: the intercept-only model, $p = 1$ and $x_i = 1$, with $y = (1, 2, 3, 4, 5)$ and $\\tau = 1/2$.\nThe function $b \\mapsto \\sum_i \\abs{y_i - b}/2$ is minimised at $b = 3$, the sample median.\n\nNon-example: minimising $\\sum_i (y_i - x_i^{T}\\beta)^2$ is [[linear regression|41FVC4P5JB]] by least squares.\nIts loss is quadratic, not a check function, and it estimates the conditional mean.\nFor skewed data the conditional mean and the conditional median differ, so the two fits differ.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "2F5C10ED1A",
    "kind": "definition",
    "msc": [
      "62G08",
      "62J05"
    ],
    "name": "Quantile regression",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Quantile_regression"
      }
    ],
    "tag": "J2GWK27Y15",
    "uses": [
      "0B3Q3XDM5X",
      "3BTG6VVCGZ",
      "41FVC4P5JB"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/J2GWK27Y15/",
  "links": [
    {
      "field": "defines",
      "target": "2F5C10ED1A"
    },
    {
      "field": "uses",
      "target": "0B3Q3XDM5X"
    },
    {
      "field": "uses",
      "target": "3BTG6VVCGZ"
    },
    {
      "field": "uses",
      "target": "41FVC4P5JB"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/J2GWK27Y15.md",
  "msc": [
    "62G08",
    "62J05"
  ],
  "name": "Quantile regression",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/J2G/J2GWK27Y15.md",
  "status": null,
  "tag": "J2GWK27Y15",
  "uri": "m2://J2GWK27Y15",
  "url": "https://tamnd.github.io/math2/wiki/quantile-regression-definition/",
  "writing": {
    "tag": "J2GWK27Y15",
    "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
      }
    ]
  }
}
