Quantile Regression › Formula

Michael BrenndoerferOctober 26, 202620 min read
Machine Learning from ScratchAll chapters
Part 5 of 15Linear and Generalized Linear Models
Chapter 47Quantile Regression › Formula
Reading section 4 of 10 · Formula · 20 minSection 4 of 10 · 20 min

Section 4 of 10 · 20 min read

Quantile Regression › FormulaSection view · Sections in this chapter4 / 10 ↓
Reading tools Definitions, links & notes

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Notes & comments

A regression model for the mean answers the question "what is the average response at this xx?" A regression model for a quantile answers a sharper question: "what cutoff has at most a fraction τ\tau of responses strictly below it and at least a fraction τ\tau at or below it at this xx?" To make that question precise we need three ingredients: a definition of a conditional quantile, a loss function whose minimizer is that quantile, and a finite-sample optimization problem we can solve. The first two are population statements; the third is what turns the idea into an algorithm.

We begin with notation. Let YY be a response variable and let the full predictor vector be X=(X0,X1,…,Xp)X = (X_0,X_1,\dots,X_p), with X0=1X_0=1 for the intercept. There are pp nonconstant predictors and p+1p+1 entries in the design vector. The cumulative distribution function of YY is FY(y)=P(Y≤y)F_Y(y) = P(Y \le y), and the τ\tau-quantile of YY, for τ∈(0,1)\tau \in (0,1), is

QY(τ)=inf⁡{y:FY(y)≥τ}.Q_Y(\tau) = \inf\{y : F_Y(y) \ge \tau\}.

The infimum handles distributions with flat regions or jumps; where FYF_Y is continuous and strictly increasing it agrees with the ordinary inverse; otherwise it remains a generalized inverse. Conditioning on the predictors gives the target:

QY∣X=x(τ)=inf⁡{y:FY∣X=x(y)≥τ},Q_{Y \mid X=x}(\tau) = \inf\{y : F_{Y\mid X=x}(y) \ge \tau\},

where:

  • FY∣X=xF_{Y\mid X=x}: the conditional cumulative distribution function of YY given X=xX = x
  • FY∣X=x(y)F_{Y\mid X=x}(y): the value of that conditional CDF evaluated at a candidate response value yy
  • inf⁡\inf: the infimum, the greatest lower bound of the set of response values satisfying the inequality
  • QY∣X=x(τ)Q_{Y \mid X=x}(\tau): the conditional τ\tau-quantile of YY at a given predictor value xx, the smallest response value whose conditional CDF reaches at least τ\tau

For intuition, consider the case where Y∣X=xY \mid X = x is normal with mean μ(x)\mu(x) and standard deviation σ(x)\sigma(x). Then

QY∣X=x(τ)=μ(x)+σ(x) Φ−1(τ),Q_{Y \mid X = x}(\tau) = \mu(x) + \sigma(x)\,\Phi^{-1}(\tau),

where:

  • Φ−1(τ)\Phi^{-1}(\tau): the quantile function of the standard normal distribution, evaluated at probability τ\tau, which is the same zz-value used for confidence intervals in the z-test
  • μ(x)\mu(x): the conditional mean of YY given X=xX = x
  • σ(x)\sigma(x): the conditional standard deviation of YY given X=xX = x

At τ=0.5\tau = 0.5 we get μ(x)\mu(x), because Φ−1(0.5)=0\Phi^{-1}(0.5) = 0. At τ=0.95\tau = 0.95 we get μ(x)+1.645σ(x)\mu(x) + 1.645\sigma(x). So if we assume normality, the conditional quantile function is just the mean function shifted by a multiple of the conditional standard deviation. Ordinary least squares estimates μ(x)\mu(x) and, when it assumes constant variance, treats σ\sigma as a single number. Quantile regression estimates QY∣X=x(τ)Q_{Y\mid X=x}(\tau) directly, which lets μ\mu and σ\sigma both vary with xx, and lets the shape vary too.

A quantile is a local summary of a distribution: it depends on where probability mass accumulates near the cut, not just on a global average. That local character explains two features that will reappear throughout the chapter. First, different quantiles can respond to the predictors in different ways, so a single slope is not enough. Second, precision depends on the density near the selected cutoff and on the predictor design. Low normal-tail density makes extreme levels difficult in our Gaussian example, but there is no universal ordering of quantile variances. The pinball loss below encodes exactly this local, asymmetric view of the data.

Conditional quantiles and pinball loss

To estimate a quantile we need a loss function minimized at that quantile. In the following expectation calculations assume E[Y2]<∞\mathbb E[Y^2]<\infty for squared error and E∣Y∣<∞\mathbb E|Y|<\infty for pinball loss. For the density-based derivatives, assume the distribution has a continuous density near the candidate cutoff. Start with the familiar case. Minimizing the expected squared error over the candidate value qq,

Lsq(q)=E[(Y−q)2],L_{\text{sq}}(q) = \mathbb{E}\left[(Y - q)^2\right],

leads to the mean. Differentiating with respect to qq (the finite second moment allows the locally integrable derivative to pass through the expectation) gives

ddqLsq(q)=−2 E[Y−q]=−2(E[Y]−q),\frac{d}{dq} L_{\text{sq}}(q) = -2\,\mathbb{E}[Y - q] = -2\left(\mathbb{E}[Y] - q\right),

which is zero exactly when q=E[Y]q = \mathbb{E}[Y]. Setting the derivative to zero and checking that the second derivative, 2>02 > 0, confirms a minimum. Squared error is married to the mean.

Now replace squared error with the asymmetric absolute-value loss known as the pinball loss, or check loss. Here u=y−qu = y - q is the signed residual between an observation yy and a candidate value qq, and τ∈(0,1)\tau \in (0,1) is the target quantile level:

ρτ(u)={τ u,u≥0,(τ−1) u,u<0.\rho_\tau(u) = \begin{cases} \tau\, u, & u \ge 0,\\[2pt] (\tau - 1)\, u, & u < 0. \end{cases}

where:

  • uu: the residual, the signed difference between the observation and the candidate value, u=y−qu = y - q
  • τ\tau: the target quantile level in (0,1)(0,1)
  • ρτ(u)\rho_\tau(u): the pinball loss at level τ\tau for residual uu
  • qq: the candidate value at which the pinball loss is being evaluated

For τ>0.5\tau > 0.5, the positive-residual branch is steeper: its slope magnitude is τ\tau, compared with 1−τ1-\tau on the negative side. A compact way to write the same function is

ρτ(u)=u(τ−1{u<0}),\rho_\tau(u) = u\left(\tau - \mathbf{1}\{u < 0\}\right),

where:

  • uu: the residual, the signed difference between the observation and the candidate value, u=y−qu = y - q
  • τ\tau: the target quantile level in (0,1)(0,1)
  • 1{⋅}\mathbf{1}\{\cdot\}: the indicator function, equal to 1 when its argument is true and 0 otherwise
  • qq: the candidate value at which the pinball loss is being evaluated, so that the loss is a function of u=y−qu = y - q and of τ\tau
  • ρτ(u)\rho_\tau(u): the pinball loss at level τ\tau for residual uu

Check the two branches: if u≥0u \ge 0 the indicator is zero and we get τu\tau u; if u<0u < 0 the indicator is one and we get (τ−1)u(\tau - 1)u, which is positive because τ−1<0\tau - 1 < 0 and u<0u < 0. At τ=0.5\tau = 0.5 both slopes have magnitude 0.50.5, and ρ0.5(u)=∣u∣/2\rho_{0.5}(u) = |u|/2, so the pinball loss is just half the absolute error.

The asymmetry is the whole point. For a high quantile, say τ=0.9\tau = 0.9, a positive residual (an observation above the fitted value) is penalized by slope τ=0.9\tau = 0.9, while a negative residual is penalized by slope 1−τ=0.11 - \tau = 0.1. For one unrestricted sample cutoff that minimizes this loss, at most 90 percent of observations lie strictly below it and at least 90 percent lie at or below it. For a low quantile the push goes the other way. This is how a single loss function encodes a target probability level. The left branch has slope τ−1\tau - 1 (magnitude 1−τ1 - \tau) and the right branch has slope τ\tau. These magnitudes are equal only when τ=0.5\tau = 0.5. Any other τ\tau makes the two arms differ in slope, and the loss is asymmetric.

To see that this loss is minimized by the τ\tau-quantile, let f(y)f(y) be the probability density function of YY and write the expected loss at a candidate value qq, where qq is the candidate value being scored, f(y)f(y) is the density of YY, and ρτ\rho_\tau is the pinball loss defined above. We obtain

L(q)=E[ρτ(Y−q)]=∫−∞q(τ−1)(y−q)f(y) dy+∫q∞τ(y−q)f(y) dy.L(q) = \mathbb{E}\left[\rho_\tau(Y - q)\right] = \int_{-\infty}^{q} (\tau - 1)(y - q) f(y)\, dy + \int_{q}^{\infty} \tau (y - q) f(y)\, dy.

The first integral collects the observations below qq, where the residual y−qy - q is negative and the loss uses the (τ−1)(\tau-1) branch; the second collects observations above qq.

where:

  • qq: the candidate value being scored as a quantile
  • f(y)f(y): the probability density function of YY
  • ρτ\rho_\tau: the pinball loss at level τ\tau, defined above
  • L(q)L(q): the expected pinball loss at the candidate value qq

Now differentiate with respect to qq. The finite first moment makes the expected loss finite; the residual-loss derivatives are bounded by 1 in magnitude, which justifies differentiation at continuity points of the CDF. Both integrands vanish at the boundary y=qy = q because each factor contains (y−q)(y-q), so the Leibniz rule gives no boundary contribution and we only need the derivative of the integrands.

dLdq=∫−∞q(1−τ)f(y) dy  −  ∫q∞τf(y) dy.\frac{dL}{dq} = \int_{-\infty}^{q} (1 - \tau) f(y)\, dy \; - \; \int_{q}^{\infty} \tau f(y)\, dy.

The derivative of (τ−1)(y−q)(\tau-1)(y-q) with respect to qq is 1−τ1-\tau, and that of τ(y−q)\tau(y-q) is −τ-\tau. At either moving integration endpoint y=qy=q, the factor y−qy-q is zero, so each boundary contribution vanishes. Recognizing the remaining integrals as probabilities gives:

where:

  • F(q)F(q): the cumulative distribution function of YY evaluated at qq
dLdq=(1−τ)F(q)−τ(1−F(q))=(1−τ)F(q)−τ+τF(q)=F(q)−τ.\begin{aligned} \frac{dL}{dq} &= (1 - \tau) F(q) - \tau\left(1 - F(q)\right) \\ &= (1 - \tau) F(q) - \tau + \tau F(q) \\ &= F(q) - \tau. \end{aligned}

The two τF(q)\tau F(q) terms combine: (1−τ)F(q)+τF(q)=F(q)(1-\tau)F(q) + \tau F(q) = F(q), leaving F(q)−τF(q) - \tau. Setting this to zero gives F(q)=τF(q)=\tau. When the CDF is strictly increasing at this cutoff, it selects the unique QY(τ)Q_Y(\tau); a flat region can give multiple minimizing values. The second derivative is f(q)≥0f(q) \ge 0, so LL is convex and this stationary point is a global minimum. The pinball loss is therefore the loss whose minimizer is the quantile, exactly as squared error is the loss whose minimizer is the mean.

For a finite sample, define F^n(q)=n−1∑i1{yi≤q}\hat F_n(q)=n^{-1}\sum_i\mathbf 1\{y_i\le q\} and let F^n(q−)\hat F_n(q^-) be the fraction strictly below qq. The subgradient interval of the average pinball loss, as a function of qq, is [F^n(q−)−τ,F^n(q)−τ][\hat F_n(q^-)-\tau,\hat F_n(q)-\tau]. A minimum occurs exactly when this interval contains zero, giving the counting rule:

#{yi<q}≤nτ≤#{yi≤q}.\#\{y_i < q\} \le n\tau \le \#\{y_i \le q\}.

In words: the number of observations strictly below the estimate is at most nτn\tau, and the number at or below it is at least nτn\tau; dividing by nn, at most a fraction τ\tau of the data lie strictly below the estimate and at least a fraction τ\tau lie at or below it. Ties at exactly qq are what allow both inequalities to hold when nτn\tau is not an integer, so the two sides can disagree by the mass pinned at qq.

The figure below makes the asymmetry visible. Each curve is a pinball loss for a different τ\tau. The two constant residual slopes, together with the kink at zero, give the quantile counting condition derived above.

PythonIn [3]
CollapseExpand
u_grid = np.linspace(-2.5, 2.5, 401)
pinball_levels = (0.1, 0.5, 0.9)
pinball_curves = {
    level: np.where(u_grid >= 0, level * u_grid, (level - 1) * u_grid)
    for level in pinball_levels
}
squared_comparison = 0.5 * u_grid**2
PythonIn [4]
CollapseExpand
import matplotlib.pyplot as plt
from book_plot_style import PALETTE, polish_axes, use_book_style

use_book_style()

fig, ax = plt.subplots(figsize=(6.0, 4.8))
for tau_level, color, line_style in zip(
    pinball_levels,
    [PALETTE["primary"], PALETTE["amber"], PALETTE["teal"]],
    ["-", "-.", ":"],
):
    ax.plot(
        u_grid,
        pinball_curves[tau_level],
        color=color,
        linewidth=1.1,
        linestyle=line_style,
        label=rf"$\tau = {tau_level}$",
    )

ax.plot(
    u_grid,
    squared_comparison,
    color=PALETTE["muted"],
    linewidth=1.6,
    linestyle="--",
    label="squared error (scaled)",
)
ax.axvline(0.0, color=PALETTE["axis"], linewidth=0.8, alpha=0.4)
ax.set_title("Pinball loss versus squared error")
ax.set_xlabel(r"Residual $u = y - q$")
ax.set_ylabel(r"Loss $\rho_\tau(u)$")
ax.set_ylim(-0.6, 2.6)
ax.legend(loc="upper center", bbox_to_anchor=(0.5, -0.18), ncol=2)
polish_axes(ax)
plt.show()
VisualizationOut [4]
CollapseExpand
Two straight-line branches meeting at the origin. The tau equals 0.1 curve is shallow on the right and steep on the left; the tau equals 0.9 curve is the mirror image; the tau equals 0.5 curve is a symmetric V shape, with a parabola plotted for comparison.
Pinball loss at three quantile levels with scaled squared error for contrast. The asymmetry grows as $\tau$ departs from 0.5, and its two constant slopes and zero kink produce the quantile counting condition. For tau above 0.5 the positive branch is steeper, while for tau below 0.5 the negative branch dominates.

Linear quantile regression as an optimization problem

Now we restrict attention to linear quantile functions. For a chosen τ\tau, we model

QY∣X=x(τ)=x⊤β(τ)=β0(τ)+β1(τ)x1+⋯+βp(τ)xp.Q_{Y \mid X = x}(\tau) = x^\top \beta(\tau) = \beta_0(\tau) + \beta_1(\tau) x_1 + \cdots + \beta_p(\tau) x_p.

The convention that x0=1x_0 = 1 absorbs the intercept β0(τ)\beta_0(\tau), so that x⊤β(τ)=∑j=0pβj(τ)xjx^\top \beta(\tau) = \sum_{j=0}^{p} \beta_j(\tau) x_j with a (p+1)(p+1)-dimensional parameter vector.

Here:

  • β(τ)\beta(\tau): the coefficient vector at quantile level τ\tau, of length p+1p + 1, indexed from j=0j = 0 to j=pj = p
  • β0(τ)\beta_0(\tau): the intercept at level τ\tau, multiplying the constant x0=1x_0 = 1
  • βj(τ)\beta_j(\tau): the coefficient on predictor xjx_j at level τ\tau, for j=1,…,pj = 1, \dots, p
  • xjx_j: the jj-th nonconstant predictor, for j=1,…,pj = 1, \dots, p
  • x1,…,xpx_1, \dots, x_p: the pp observed predictors, to which the constant x0=1x_0 = 1 is prepended
  • x∈Rp+1x \in \mathbb{R}^{p+1}: the full predictor vector with the prepended constant, so that x⊤β(τ)x^\top \beta(\tau) is the fitted τ\tau-quantile

The notation emphasizes that the coefficients depend on τ\tau: each quantile level gets its own line. The estimate is the minimizer of the average pinball loss over the sample,

β^(τ)=arg⁡min⁡β∈Rp+11n∑i=1nρτ(yi−xi⊤β).\hat\beta(\tau) = \arg\min_{\beta \in \mathbb{R}^{p+1}} \frac{1}{n} \sum_{i=1}^{n} \rho_\tau\left(y_i - x_i^\top \beta\right).

Compare this to the least-squares objective, which is a smooth quadratic in β\beta and, for a full-column-rank design, admits the mathematical solution (X⊤X)−1X⊤y(X^\top X)^{-1} X^\top y that we derived in ordinary least squares. Here the objective is a sum of piecewise linear functions of β\beta. It is convex (a sum of convex functions is convex) but it has kinks wherever a residual yi−xi⊤βy_i - x_i^\top\beta is exactly zero, and some optima have zero residuals. Flat sets of optimal coefficients can also contain points with no zero residuals. At a kink the derivative does not exist, so "set the gradient to zero and solve" does not work. We need the machinery of convex optimization.

The standard route is to convert the problem into a linear program, which we can then hand to a mature solver. The trick is to split each residual into its positive and negative parts. Define, for every observation, the positive and negative parts of the residual:

ui=max⁡(yi−xi⊤β, 0),vi=max⁡(xi⊤β−yi, 0),u_i = \max\left(y_i - x_i^\top \beta,\, 0\right), \qquad v_i = \max\left(x_i^\top \beta - y_i,\, 0\right),

where:

  • yiy_i: the observed response for the ii-th observation
  • xi⊤βx_i^\top \beta: the fitted quantile at the ii-th predictor vector
  • uiu_i: the positive part of the residual, nonzero only when the observation lies above the fit
  • viv_i: the negative part of the residual, nonzero only when the observation lies below the fit

Both are non-negative, and their difference reconstructs the signed residual: ui−vi=yi−xi⊤βu_i - v_i = y_i - x_i^\top\beta. In the linear program we drop the max definitions and treat ui≥0u_i \ge 0 and vi≥0v_i \ge 0 as the unknowns; the optimal solution automatically sets at most one of the pair strictly positive, since subtracting t=min⁡(ui,vi)>0t=\min(u_i,v_i)>0 from both preserves their difference and lowers the cost by [τ+(1−τ)]t=t[\tau+(1-\tau)]t=t. Now check that the pinball loss can be written as a weighted sum of them. Note that if yi−xi⊤β>0y_i - x_i^\top\beta > 0 then ui=yi−xi⊤βu_i = y_i - x_i^\top\beta and vi=0v_i = 0, while if yi−xi⊤β<0y_i - x_i^\top\beta < 0 then ui=0u_i = 0 and vi=xi⊤β−yiv_i = x_i^\top\beta - y_i. If the residual yi−xi⊤βy_i - x_i^\top\beta is positive then uiu_i equals it, vi=0v_i = 0, and

τui+(1−τ)vi=τ(yi−xi⊤β)=ρτ(yi−xi⊤β).\tau u_i + (1-\tau) v_i = \tau\left(y_i - x_i^\top\beta\right) = \rho_\tau\left(y_i - x_i^\top \beta\right).

If the residual is negative then ui=0u_i = 0, vi=xi⊤β−yiv_i = x_i^\top\beta - y_i, and

τui+(1−τ)vi=(1−τ)(xi⊤β−yi)=(τ−1)(yi−xi⊤β)=ρτ(yi−xi⊤β),\tau u_i + (1-\tau) v_i = (1-\tau)\left(x_i^\top\beta - y_i\right) = (\tau - 1)\left(y_i - x_i^\top\beta\right) = \rho_\tau\left(y_i - x_i^\top \beta\right),

using (1−τ)=−(τ−1)(1-\tau) = -(\tau-1) in the middle step. Either way the identity holds, and the identity is linear in the unknowns β,u,v\beta, u, v. That is precisely why the problem becomes a linear program: we minimize a linear function subject to linear constraints and non-negativity.

Written out in full, for a fixed τ\tau we solve

min⁡β, u, v  ∑i=1n[τui+(1−τ)vi]subject to{xi⊤β+ui−vi=yi,i=1,…,n,ui≥0,vi≥0,i=1,…,n,\min_{\beta,\, u,\, v} \; \sum_{i=1}^{n} \left[\tau u_i + (1-\tau) v_i\right] \quad \text{subject to} \quad \begin{cases} x_i^\top \beta + u_i - v_i = y_i, & i = 1, \dots, n,\\ u_i \ge 0, \quad v_i \ge 0, & i = 1, \dots, n, \end{cases}

where:

  • β\beta: the coefficient vector, unrestricted in sign
  • ui,viu_i, v_i: the positive and negative parts of the ii-th residual, both constrained to be non-negative
  • τ\tau: the target quantile level
  • xix_i: the ii-th predictor vector, including the intercept entry
  • yiy_i: the ii-th observed response

To pass this to a solver we stack everything into one vector. Let XX be the n×(p+1)n \times (p+1) design matrix whose ii-th row is xi⊤x_i^\top, let InI_n denote the n×nn \times n identity matrix, let 1n\mathbf{1}_n be a column of nn ones, let 0p+10_{p+1} be a column of p+1p+1 zeros, and let zz be the stacked unknown vector defined below. Collect the unknowns as z=(β,u,v)∈R(p+1)+2nz = (\beta, u, v) \in \mathbb{R}^{(p+1) + 2n}. Then the program reads

min⁡z  c⊤z\min_{z} \; c^\top z

subject to the equality constraint and the variable-bound restrictions

[XIn−In]z=y,zj free for j=1,…,p+1,zj≥0 for j=p+2,…,(p+1)+2n,\begin{bmatrix} X & I_n & -I_n \end{bmatrix} z = y, \qquad z_j \ \text{free for } j = 1,\dots,p+1, \quad z_j \ge 0 \ \text{for } j = p+2,\dots,(p+1)+2n,

where:

  • z=(β,u,v)z = (\beta, u, v): the stacked vector of unknowns, of length (p+1)+2n(p+1) + 2n
  • c=(0p+1, τ1n, (1−τ)1n)c = \left(0_{p+1},\ \tau \mathbf{1}_n,\ (1-\tau)\mathbf{1}_n\right): the linear cost vector
  • XX: the n×(p+1)n \times (p+1) design matrix
  • InI_n: the n×nn \times n identity matrix
  • yy: the observed response vector

The constraint [XIn−In]z=y\begin{bmatrix} X & I_n & -I_n \end{bmatrix} z = y is the residual decomposition xi⊤β+ui−vi=yix_i^\top\beta + u_i - v_i = y_i in matrix form, and zj≥0z_j \ge 0 enforces non-negativity of the split residuals.

Reading the block structure: the first block XβX\beta produces the fitted values, adding uu and subtracting vv reconciles them with the observed yy, and the cost vector puts weight τ\tau on positive residuals (observations above the fitted line, that is, under-predictions) and weight 1−τ1-\tau on negative residuals (observations below the fitted line, that is, over-predictions). The single equation per observation is exactly the residual decomposition we derived. The problem has 2n+p+12n + p + 1 unknowns and nn equality constraints. That is larger than a least-squares solve. The two identity blocks contain only 2n2n nonzero entries; at fixed predictor count the block matrix becomes sparse as nn grows, and a sparse representation lets solvers exploit this structure.

The dual shows how the fitted score limits sensitivity to extreme responses at fixed predictors. The dual of the program above is

max⁡a∈Rn  y⊤asubject toX⊤a=0,ai∈[τ−1, τ]  for all i,\max_{a \in \mathbb{R}^n} \; y^\top a \quad \text{subject to} \quad X^\top a = 0, \qquad a_i \in [\tau - 1,\ \tau] \ \text{ for all } i,

where:

  • a∈Rna \in \mathbb{R}^n: the dual variable vector, one multiplier per observation
  • aia_i: the dual multiplier for the ii-th observation, confined to the interval [τ−1,τ][\tau - 1, \tau]
  • yy: the observed response vector
  • XX: the n×(p+1)n \times (p+1) design matrix

Each observation gets a multiplier aia_i that is capped between τ−1\tau - 1 and τ\tau. At the solution, ai=τa_i = \tau for observations with positive residual (points above the fitted line) and ai=τ−1a_i = \tau - 1 for observations with negative residual (points below the fitted line), with aia_i taking any value in [τ−1,τ][\tau-1,\tau] when the residual is exactly zero. The constraint X⊤a=0X^\top a = 0 is the first-order condition: the fitted line is positioned so that the signed, capped residuals balance against every column of the design matrix. Every multiplier is confined to the interval [τ−1,τ][\tau - 1, \tau], whose bound on the magnitude is max⁡(τ,1−τ)≤1\max(\tau, 1 - \tau) \le 1. Because aia_i is bounded independently of yiy_i, an extreme response cannot push its own multiplier beyond this cap. The equilibrium condition X⊤a=0X^\top a = 0 balances the capped scores against the design columns; it does not guarantee a bound on finite-sample coefficient changes.

For the intercept column, X0=1nX_0=\mathbf 1_n, stationarity gives ∑iai=0\sum_i a_i=0. Let ri=yi−xi⊤βr_i=y_i-x_i^\top\beta, N−=#{i:ri<0}N_-=\#\{i:r_i<0\} and N0=#{i:ri=0}N_0=\#\{i:r_i=0\}. At nonzero residuals the dual values are fixed at τ\tau or τ−1\tau-1; at zero residuals they may take any value in [τ−1,τ][\tau-1,\tau]. The available zero-residual values balance the intercept precisely when

N−≤nτ≤N−+N0.N_-\le n\tau\le N_-+N_0.

Here N−N_- counts negative residuals, N0N_0 counts ties at the fitted value, and nτn\tau is the target count. This is the same counting inequality derived for a sample quantile. It does not require exactly a fraction τ\tau of residuals to be negative. The full vector condition also needs valid zero-residual multipliers that satisfy X⊤a=0X^\top a=0. We will read those multipliers from the LP result rather than treating an arbitrary endpoint of each subgradient interval as an ordinary gradient.

Mathematical properties

These properties are not decorative. They tell us what quantile regression preserves, what it gives up, and where its finite-sample behavior can differ from the population ideal.

  • Monotone equivariance. Population conditional quantiles commute with continuous strictly increasing transformations on the response domain. A selected empirical order statistic has the same property. A general linear quantile-regression estimator need not commute with nonlinear transformations because the transformed function may leave the linear model family.
  • Median reduction. At τ=0.5\tau = 0.5 the pinball loss is half the absolute error, so the estimator is least absolute deviations regression. For independent Laplace errors centered at zero with a common fixed positive scale, its regression coefficients are maximum likelihood estimates.
  • No ordering guarantee across τ\tau. Because each τ\tau is optimized separately, β^(τ1)\hat\beta(\tau_1) and β^(τ2)\hat\beta(\tau_2) for τ1<τ2\tau_1 < \tau_2 are not constrained to produce ordered fitted values at any given xx. Population quantiles are ordered. Appropriate consistency assumptions can recover that order in the limit, but separate finite-sample fits impose no ordering constraint.
  • Asymptotic normality. For independent identically distributed rows, a correctly specified linear conditional quantile, bounded predictors with nonsingular second-moment matrix, and a positive continuous conditional density with adequate local smoothness near that quantile, the usual regular quantile-regression limit applies. Define the density-weighted design moment DD and the plain design moment JJ by
D=E[fY∣X(Qτ(x)∣x)xx⊤],J=E[xx⊤],D = \mathbb{E}\left[f_{Y\mid X}\left(Q_\tau(x) \mid x\right) x x^\top\right], \qquad J = \mathbb{E}\left[x x^\top\right],

where:

  • fY∣X(⋅∣x)f_{Y\mid X}(\cdot \mid x): the conditional density of YY given X=xX = x, evaluated at the quantile Qτ(x)Q_\tau(x)
  • Qτ(x)=x⊤β(τ)Q_\tau(x) = x^\top\beta(\tau): the true conditional τ\tau-quantile function
  • xx: a predictor vector drawn from the population distribution (the expectation is taken over XX)
  • DD: the density-weighted design moment; density affects precision through the full sandwich covariance, together with the predictor design and τ\tau
  • JJ: the unweighted design moment E[xx⊤]\mathbb{E}[x x^\top]

Then n(β^(τ)−β(τ))→dN(0, τ(1−τ) D−1JD−1)\sqrt{n}\left(\hat\beta(\tau) - \beta(\tau)\right) \xrightarrow{d} \mathcal{N}\left(0,\ \tau(1-\tau)\, D^{-1} J D^{-1}\right) as n→∞n \to \infty, where τ(1−τ)\tau(1-\tau) is the variance of the pinball-loss score, D−1JD−1D^{-1} J D^{-1} is the sandwich matrix (bread times meat times bread), and DD and JJ are defined immediately above. The density term DD records the local information near the quantile. At fixed τ\tau and predictor distribution, multiplying all conditional densities at the quantile by the same factor cc divides the asymptotic covariance by c2c^2; more general precision comparisons depend on the whole density-weighted design. In distributions such as the normal example, low tail density can increase this covariance; the formula does not imply that every distribution has larger variance at more extreme levels.

  • Under these regular population conditions, the influence function is bounded as yy varies at a fixed predictor vector. It need not be bounded as xx varies: high-leverage predictors multiply the capped scores. This population statement does not bound every finite-sample coefficient change.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy