Quantile Regression

Quantile regression models a quantile of the response rather than its mean. Ordinary least squares fits the conditional mean; replace squared error with an asymmetric loss and the same machinery fits a conditional median, a conditional 90th percentile, or any level you choose.

The general principle behind that swap is stated compactly in the forecasting literature: “a forecast method that minimizes the MAE will lead to forecasts of the median, while minimizing the RMSE will lead to forecasts of the mean.” Quantile regression generalizes the idea โ€” the loss function chooses the estimand, and there is nothing special about the mean except that squared error is convenient.

The loss that does it

The quantile (or pinball) loss penalizes misses asymmetrically. For a forecast \(f_{p,t}\) of the \(p\) quantile,

\[Q_{p,t} = \begin{cases} 2(1-p)(f_{p,t} - y_t), & y_t < f_{p,t} \\ 2p\,(y_t - f_{p,t}), & y_t \ge f_{p,t} \end{cases}\]

and minimizing it over the data produces an estimate of that quantile โ€” “a low value of \(Q_{p,t}\) indicates a better estimate of the quantile.” Read the weights to see the mechanism: at \(p = 0.9\) the penalty for being too low is nine times the penalty for being too high, which targets the conditional 90th percentile. For a continuous conditional distribution at the correct quantile, the population exceedance probability is 10%; ties or point masses can make it smaller, and a fitted finite-sample model need not attain exactly 10% exceedance.

One case anchors the family: “when \(p = 0.5\), the quantile score \(Q_{0.5,t}\) is the same as the absolute error.” Median regression is least-absolute-deviations regression, which is where the robustness to outliers comes from โ€” an extreme point moves a median fit far less than it moves a least-squares fit. See pinball loss and regression models.

Why reach for it

  • Intervals without a distributional assumption. Fit the 0.05 and 0.95 quantiles and you have a 90% interval directly โ€” which is how intervals are assembled anyway: “prediction intervals are usually constructed from quantiles by setting \(\ell_{\alpha,t} = f_{\alpha/2,t}\) and \(u_{\alpha,t} = f_{1-\alpha/2,t}\).” The difference is that you have estimated those quantiles rather than derived them from an assumed shape. See prediction intervals.
  • Spread that changes with the predictors. The usual shortcut โ€” fit the mean, add a constant multiple of the residual standard deviation โ€” assumes the spread is the same everywhere. Where large customers are also more variable, or variance grows with the level, that produces intervals that are too wide in one region and too narrow in another. Quantile regression lets the width vary because each quantile is fitted separately.
  • Asymmetric decisions. When being short costs more than being long, the level you want is a quantile set by the ratio of the two costs, not the mean. See quantile forecasts.
  • Questions about the tail specifically. “What does a bad week look like?” is a question about a high quantile, and a mean model answers a different question however well it fits.

The contrast with the default is worth stating plainly, because the default is an assumption rather than a neutral choice: “most time series models produce normally distributed forecasts โ€” that is, we assume that the distribution of possible future values follows a normal distribution.” Quantile regression declines that assumption and pays for it with more estimation. See probabilistic forecasts.

What it costs

  • One fit per quantile. Three levels means three models to fit, monitor, and explain. Nothing ties them together unless you add something that does.
  • Estimated quantiles can cross. Fitted independently, the 0.9 line can fall below the 0.8 line in some region โ€” impossible for a real distribution and a sign of noise or thin data there. Check monotonicity before shipping.
  • Extreme quantiles need a lot of data. A 0.99 quantile is estimated from the behavior of roughly the top 1% of observations, so the effective sample for it is small even when the dataset is large.
  • Coefficients are per quantile. A predictor can matter for the upper tail and not for the median, which is informative and means there is no single “the coefficient” to report.

So the decision rule is simple enough. If you need a central estimate and the spread is roughly constant, fit the mean. If you need a specific quantile, or the spread varies, or the decision is asymmetric, model the quantile you actually need. And score it with the quantile loss rather than with MAE or RMSE โ€” scoring a 0.9 quantile by absolute error rewards pulling it toward the middle, which is precisely what you were avoiding. For the whole distribution at once, see CRPS; for the level itself, quantile level.

Further reading


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.