Quantile regression is a statistical method that models the relationship between independent variables and a specified conditional quantile of the dependent variable, rather than the conditional mean. Unlike ordinary least squares regression, it estimates the median or any other percentile of the response distribution, providing a complete view of the stochastic relationship between variables.
Glossary
Quantile Regression

What is Quantile Regression?
A statistical technique for estimating the conditional quantiles of a response variable, enabling the construction of asymmetric prediction intervals.
This technique minimizes a weighted sum of absolute residuals, where positive and negative errors are penalized asymmetrically based on the target quantile. By fitting multiple quantile functions simultaneously, practitioners can construct non-parametric prediction intervals that naturally capture heteroscedasticity and non-Gaussian error distributions without assuming a specific parametric form for the variance.
Key Characteristics of Quantile Regression
Unlike ordinary least squares which estimates the conditional mean, quantile regression models the conditional median or other quantiles, providing a complete view of the relationship between variables and enabling asymmetric prediction intervals.
Asymmetric Loss Function
Quantile regression minimizes the pinball loss (check function), which applies different linear penalties for over-prediction versus under-prediction. For a given quantile τ, the loss is:
- τ × |residual| for positive residuals (under-prediction)
- (1-τ) × |residual| for negative residuals (over-prediction) This asymmetry is what forces the model to estimate the conditional τ-th quantile rather than the mean. The check function is non-differentiable at zero, typically requiring linear programming or subgradient methods for optimization.
Non-Parametric Prediction Intervals
By fitting models at multiple quantile levels simultaneously—commonly the 5th, 50th, and 95th percentiles—quantile regression constructs distribution-free prediction intervals without assuming normality or constant variance.
- The interval [Q̂₀.₀₅, Q̂₀.₉₅] provides a 90% coverage band
- Unlike mean-based intervals, these adapt to heteroscedasticity, widening where variance is high and narrowing where it is low
- No parametric distributional assumptions are required, making the intervals valid under arbitrary error structures
Robustness to Outliers
The conditional median (τ = 0.5) is inherently robust to outliers in the response variable, unlike the conditional mean which can be arbitrarily distorted by a single extreme value.
- The median minimizes absolute deviations (L1 loss), not squared deviations (L2 loss)
- Breakdown point: the median tolerates up to 50% contamination before breaking
- This makes quantile regression particularly valuable for financial data with fat-tailed distributions, sensor data with sporadic errors, and biological measurements with anomalous readings
Heteroscedasticity Characterization
Quantile regression explicitly models how the spread of the response distribution changes with covariates. By examining how the gap between upper and lower quantiles varies across the input space, practitioners can:
- Detect and quantify variance heterogeneity without pre-specifying a variance function
- Identify regions where predictions are inherently more uncertain
- Build conditional density estimators by interpolating across a grid of quantile levels This capability is critical for risk management applications where tail behavior depends on market conditions.
Linear Programming Formulation
Linear quantile regression can be solved efficiently as a linear programming problem by introducing slack variables for positive and negative residuals. The primal formulation minimizes:
- Σᵢ [τ × ξᵢ⁺ + (1-τ) × ξᵢ⁻]
- Subject to: yᵢ - xᵢᵀβ = ξᵢ⁺ - ξᵢ⁻ with ξᵢ⁺, ξᵢ⁻ ≥ 0 This reformulation transforms the non-differentiable check function into a constrained optimization solvable via simplex or interior-point methods. Modern implementations leverage sparse matrix techniques for high-dimensional problems.
Quantile Crossing Prevention
A known issue when fitting multiple quantile regressions independently is quantile crossing, where a lower quantile estimate exceeds a higher one (e.g., Q̂₀.₉₀ < Q̂₀.₁₀), violating basic probability laws.
- Simultaneous estimation constrains all quantile functions to be non-decreasing in τ
- Monotone B-spline approaches enforce ordering through constrained basis expansions
- Non-crossing constraints can be added directly to the optimization problem
- Deep quantile regression models often use a single shared representation with monotone output layers to guarantee coherence
Quantile Regression vs. Ordinary Least Squares
A feature-level comparison between quantile regression and ordinary least squares (OLS) for predictive modeling tasks requiring confidence calibration and asymmetric uncertainty quantification.
| Feature | Quantile Regression | Ordinary Least Squares |
|---|---|---|
Objective Function | Minimizes weighted absolute residuals (check loss) | Minimizes sum of squared residuals (L2 loss) |
Output | Conditional quantiles (e.g., median, 90th percentile) | Conditional mean only |
Distributional Assumptions | None (distribution-free) | Assumes homoscedastic, normally distributed errors |
Robustness to Outliers | ||
Asymmetric Prediction Intervals | ||
Heteroscedasticity Handling | ||
Interpretability | Directly models tail behavior and spread | Limited to central tendency |
Computational Cost | Higher (requires solving linear program per quantile) | Lower (closed-form solution via matrix inversion) |
Applications in Machine Learning
Quantile regression extends beyond classical mean estimation to model the full conditional distribution of a response variable. These applications demonstrate its critical role in building calibrated, uncertainty-aware machine learning systems.
Prediction Interval Construction
Quantile regression is the foundational mechanism for building non-parametric prediction intervals without assuming a Gaussian error distribution. By simultaneously fitting models for the 5th and 95th conditional quantiles, a calibrated 90% prediction interval is formed. This approach naturally captures heteroscedasticity, where prediction uncertainty varies across the input space—intervals widen automatically in sparse data regions and narrow in dense ones. Unlike mean-variance models, quantile-based intervals are robust to outliers and make no assumptions about the shape of the error distribution, making them ideal for safety-critical regression tasks.
Risk Management & Value-at-Risk
In quantitative finance, quantile regression directly models Value-at-Risk (VaR)—the maximum expected loss at a given confidence level over a specific horizon. A model trained on the 1st percentile predicts the loss threshold that is exceeded only 1% of the time. This conditional approach allows VaR estimates to adapt dynamically to market volatility regimes, incorporating features like recent returns and macroeconomic indicators. The technique extends naturally to Expected Shortfall estimation and is mandated by regulatory frameworks such as Basel III for calculating capital reserves against tail risk.
Heteroscedastic Uncertainty Quantification
Standard regression models assume constant noise (homoscedasticity), producing identical error bounds for all predictions. Quantile regression explicitly models heteroscedastic aleatoric uncertainty by learning how the spread of outcomes changes with inputs. Key applications include:
- Sensor fusion: Predicting wider error bounds for noisy sensor readings in adverse weather conditions
- Medical prognosis: Estimating wider survival time intervals for patients with complex comorbidities
- Demand forecasting: Generating wider prediction intervals during promotional periods with volatile consumer behavior
The spread between upper and lower quantiles provides a direct, interpretable measure of prediction reliability at each data point.
Censored Data & Survival Analysis
Quantile regression handles right-censored data—where the true outcome is only known to exceed a certain threshold—without requiring the proportional hazards assumption of Cox models. In survival analysis, it directly estimates conditional quantiles of time-to-event distributions. This is critical in:
- Clinical trials: Estimating median survival time when many patients are still alive at study end
- Predictive maintenance: Modeling time-to-failure for equipment that hasn't broken yet
- Customer churn: Predicting when users will disengage, accounting for active users whose churn time is unobserved
Weighted quantile regression reweights uncensored observations to account for censoring probabilities, producing unbiased estimates.
Counterfactual Outcome Distributions
Quantile regression enables estimation of full counterfactual distributions rather than just average treatment effects. By fitting quantile models on treated and control groups separately, analysts can compare the entire outcome distribution under different interventions. This reveals heterogeneous treatment effects that mean-based methods miss—a policy might have zero average effect but significantly reduce extreme negative outcomes. Applications include evaluating the distributional impact of economic policies, understanding how a medical treatment affects different severity levels, and assessing whether an educational intervention helps struggling students more than high-performers.
Gradient Boosting with Quantile Loss
Modern gradient boosting libraries like LightGBM and XGBoost support quantile regression by specifying the pinball loss function. This combines the flexibility of tree-based models with distributional modeling, enabling:
- Non-linear quantile functions: Capturing complex interactions without manual feature engineering
- Automatic feature selection: Trees inherently perform variable selection for each quantile
- Scalability: Training on millions of samples with hundreds of features
A common production pattern trains multiple boosted models at different quantile levels (e.g., 0.1, 0.5, 0.9) to output a full predictive distribution, often outperforming deep learning approaches on tabular data with mixed feature types.
Frequently Asked Questions
Explore the core concepts behind quantile regression and its role in building reliable, non-parametric prediction intervals for machine learning models.
Quantile regression is a statistical technique that estimates the conditional quantiles (e.g., median, 95th percentile) of a response variable given a set of predictors, rather than estimating the conditional mean. Unlike Ordinary Least Squares (OLS) , which minimizes the sum of squared residuals to predict the average outcome, quantile regression minimizes a weighted sum of absolute residuals. This asymmetric loss function—often called the pinball loss or check function—allows the model to target any specific percentile of the distribution. This fundamental difference makes quantile regression robust to outliers and heteroscedasticity, as it does not assume a constant variance across the data. It provides a complete view of the conditional distribution, revealing how predictors influence not just the center, but the entire spread and tails of the outcome variable.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core concepts that complement quantile regression for building well-calibrated, uncertainty-aware machine learning models.
Prediction Interval Coverage Probability (PICP)
The empirical metric that measures the percentage of true outcomes falling within a constructed prediction interval. For a model targeting 95% confidence, a well-calibrated system should achieve a PICP close to 0.95. This metric directly validates whether a quantile regression model's estimated lower and upper quantiles (e.g., 0.025 and 0.975) achieve their nominal coverage.
- Formula: PICP = (1/n) * Σ I(y_i ∈ [L_i, U_i])
- Used alongside Mean Prediction Interval Width (MPIW) to assess sharpness
- A PICP below the target signals undercoverage and miscalibration
Aleatoric Uncertainty
The irreducible, intrinsic noise inherent in the data-generating process itself. Quantile regression is a primary tool for modeling this type of uncertainty in regression tasks. By predicting multiple conditional quantiles, the model captures the heteroscedastic spread of outcomes—where variance changes across the input space.
- Examples: sensor noise, inherent stochasticity in financial markets
- Cannot be reduced by collecting more training data
- Quantile regression directly estimates this by learning the conditional distribution's shape
Distribution Calibration
A regression calibration criterion requiring that the predicted cumulative distribution function (CDF) matches the empirical distribution of outcomes across the entire dataset. Quantile regression naturally supports this by estimating multiple quantile levels (e.g., 0.1, 0.25, 0.5, 0.75, 0.9) to reconstruct the full predictive distribution.
- More stringent than top-label calibration used in classification
- Evaluated using the Probability Integral Transform (PIT) histogram
- A uniform PIT histogram indicates perfect distribution calibration
Epistemic Uncertainty
The reducible model uncertainty arising from a lack of knowledge or training data. While quantile regression primarily captures aleatoric uncertainty, combining it with techniques like Deep Ensembles or Monte Carlo Dropout allows separation of epistemic uncertainty. The spread across ensemble members' quantile predictions indicates where the model lacks knowledge.
- High in out-of-distribution (OOD) regions
- Can be reduced by gathering more representative training samples
- Critical for safe deployment in high-stakes regression tasks
Proper Scoring Rules
Loss functions that are minimized only when the predicted probability distribution matches the true data-generating distribution. For quantile regression, the pinball loss (also called quantile loss) is the proper scoring rule that incentivizes honest quantile estimates.
- Pinball Loss: ρ_τ(y, q) = (y - q)(τ - I(y < q)) for quantile τ
- Encourages calibrated forecasts without overconfidence
- The sum of pinball losses across multiple quantiles approximates the Continuous Ranked Probability Score (CRPS)

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us