---
tag: J2GWK27Y15
kind: definition
name: Quantile regression
msc: [62G08, 62J05]
defines: 2F5C10ED1A
uses: [0B3Q3XDM5X, 3BTG6VVCGZ, 41FVC4P5JB]
sources:
  - url: https://en.wikipedia.org/wiki/Quantile_regression
---

## Definition

Let $\tau \in (0, 1)$.
The *check function* is $\rho_\tau \colon \R \to \R$, $\rho_\tau(u) = u\big(\tau - \mathbf{1}\set{u < 0}\big)$, so $\rho_\tau(u) = \tau u$ for $u \ge 0$ and $\rho_\tau(u) = (\tau - 1)u$ for $u < 0$.
Let $(x_1, y_1), \dots, (x_n, y_n)$ be data with $x_i \in \R^p$ and $y_i \in \R$.
The *linear quantile regression* estimate at level $\tau$ is any minimiser
$$\hat\beta(\tau) \in \arg\min_{\beta \in \R^p} \sum_{i=1}^{n} \rho_\tau\big(y_i - x_i^{T} \beta\big).$$
It 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)$.

## Remarks

For 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} < \infty$).
This is why the check [[loss|3BTG6VVCGZ]] targets quantiles, just as squared loss targets the mean.
The minimisation is a linear program.
When $x_1, \dots, x_n$ span $\R^p$, some minimiser fits at least $p$ data points exactly.
For $\tau = 1/2$, $\rho_{1/2}(u) = \abs{u}/2$, and the method is least absolute deviations regression.

Example: the intercept-only model, $p = 1$ and $x_i = 1$, with $y = (1, 2, 3, 4, 5)$ and $\tau = 1/2$.
The function $b \mapsto \sum_i \abs{y_i - b}/2$ is minimised at $b = 3$, the sample median.

Non-example: minimising $\sum_i (y_i - x_i^{T}\beta)^2$ is [[linear regression|41FVC4P5JB]] by least squares.
Its loss is quadratic, not a check function, and it estimates the conditional mean.
For skewed data the conditional mean and the conditional median differ, so the two fits differ.
