Quantile Regression Explained: How to Run, Read and Report It
Ordinary least squares (OLS) regression answers one question: how does the average outcome change with a predictor? Often the more interesting question is about the rest of the distribution. Does study time help the weakest students as much as the strongest? Do the highest earners gain more from education than the lowest? Quantile regression (Koenker & Bassett, 1978) models any chosen quantile of the outcome, so it can show effects that vary across the distribution. This guide explains the method, a worked example, how to read the output and how to report it.
What is quantile regression?
Quantile regression estimates the conditional quantile of an outcome (the median, the 10th percentile, the 90th percentile and so on) as a linear function of predictors. With τ = .50 it gives median regression, a robust alternative to the mean. By estimating several quantiles, you obtain a picture of how the whole conditional distribution shifts, widens or skews as a predictor changes. Koenker (2005) is the standard reference, and Cade and Noon (2003) give a readable introduction aimed at applied researchers.
When should you use quantile regression?
- The effect of a predictor plausibly differs between low and high outcome values.
- The residual spread changes with the predictor (heteroscedasticity that is itself of interest).
- The outcome is skewed or has outliers, for example income, hospital stay or reaction time.
- Interest is in the tails, such as the lowest-performing or the highest-risk group.
- You want a regression that does not depend on normally distributed errors.
Quantile regression versus OLS. If the distribution of the outcome shifts in parallel as a predictor changes, all quantile slopes will be similar and OLS tells the story. When quantile slopes differ, OLS averages over that variation and may hide it. Quantile regression does not "fix" a poor model: you still need a sensible set of predictors.
The mathematical foundation
For quantile τ (between 0 and 1), the model is:
Qτ(y | x) = β0(τ) + β1(τ)x1 + … + βk(τ)xk
Instead of minimising squared residuals, quantile regression minimises an asymmetric absolute loss, the check function:
Σ ρτ(yi − xi′β), where ρτ(u) = u · (τ − I(u < 0))
A residual above the fitted line (u > 0) is weighted by τ, and a residual below it (u < 0) by 1 − τ. For τ = .90, a point 4 units above the line costs 4 × .90 = 3.6, whereas a point 4 units below costs 4 × (1 − .90) = 0.4. The line is therefore pushed upward until about 90% of points lie below it. The estimates are found by linear programming. Standard errors are typically obtained by bootstrap or by rank-based and kernel methods.
Assumptions and data requirements
- Continuous or approximately continuous outcome. Heavily discrete outcomes (few distinct values) cause ties and unstable estimates.
- Correct specification of the quantile function. The conditional quantile should be reasonably linear in the predictors, or the relevant transformations must be included.
- Independent observations. Clustered or repeated data need methods that account for dependence.
- No distributional assumption on the errors. Normality is not required, which is a main attraction.
- Adequate sample size, especially for extreme quantiles. Estimating the 5th or 95th percentile needs enough observations in the tail; with small samples, stay close to the middle.
- Non-crossing estimates. Separately fitted quantile lines can cross, which is logically impossible for conditional quantiles; if they cross within the data range, simplify the model.
Original research example (illustrative)
Background. A researcher studies how weekly study hours relate to exam scores in a large first-year course.
Objective and question. Does the benefit of additional study hours differ between low-scoring and high-scoring students?
Data. Exam score (0–100) regressed on weekly study hours. The coefficients below are invented for teaching.
Step 1: Estimate several quantiles
| Quantile (τ) | Intercept | Slope (hours) |
|---|---|---|
| .10 | 30.0 | 0.80 |
| .50 | 40.0 | 1.50 |
| .90 | 48.0 | 2.40 |
| OLS (mean) | 39.5 | 1.60 |
Step 2: Turn coefficients into predictions
The predicted quantile at x hours is intercept + slope × x.
| Hours | τ = .10 | τ = .50 | τ = .90 | Spread (.90 − .10) |
|---|---|---|---|---|
| 0 | 30.0 | 40.0 | 48.0 | 18.0 |
| 10 | 38.0 | 55.0 | 72.0 | 34.0 |
| 20 | 46.0 | 70.0 | 96.0 | 50.0 |
Check: at 10 hours, 30.0 + 0.80 × 10 = 38.0; 40.0 + 1.50 × 10 = 55.0; 48.0 + 2.40 × 10 = 72.0; spread = 72.0 − 38.0 = 34.0. The spread equals (48.0 − 30.0) + (2.40 − 0.80) × hours = 18.0 + 1.60 × hours, which gives 34.0 at 10 hours and 50.0 at 20 hours. Note that the 90th percentile line reaches 96 at 20 hours, close to the 100-point ceiling, which is a reminder that a linear quantile line should not be extrapolated beyond the data range.
Step 3: Compare with OLS
The OLS slope (1.60) is close to the median slope (1.50) and sits between the 10th and 90th percentile slopes, as an average of the conditional distribution should. It reports one number and conceals that the same extra hour is associated with about 0.8 points at the bottom of the distribution and 2.4 points at the top, a threefold difference.
Step 4: Interpret
For students at the 10th percentile of conditional scores, each additional weekly study hour is associated with a 0.80-point higher score; at the median, 1.50 points; at the 90th percentile, 2.40 points. The distribution of scores therefore fans out as study time increases. Substantively, students who already do well appear to convert extra hours into larger gains than students who struggle, which may point to differences in study quality or prior knowledge. Whether these slopes differ statistically requires confidence intervals or a formal test of equality of slopes across quantiles. Because the data are observational, none of this establishes that study time causes the differences.
How to run quantile regression with the StatFAS Quantile Regression Calculator
Open statfas.com/quantile-regression-calculator.html.
- Prepare your data. One row per observation, one column for the outcome and one per predictor, with a header row and numeric codes. Inspect the outcome's distribution first.
- Load the data and choose the variables. Select the outcome and predictors.
- Choose quantiles. For example .10, .25, .50, .75 and .90.
- Set options. Such as standard-error method, confidence level and plots of coefficients across quantiles.
- Run and review. Compare coefficients across quantiles with their intervals, and check for crossing predictions.
- Download results. Verify every number and sentence before it enters a manuscript.
statfas-quantile-regression-interface.pngAlt text: "StatFAS quantile regression calculator interface before data entry."
Caption: The Quantile Regression Calculator on StatFAS.com.
statfas-quantile-regression-example-data.png · Alt: "Exam score and study hours data loaded in the StatFAS quantile regression calculator."Screenshot 3:
statfas-quantile-regression-settings.png · Alt: "Quantile selection settings in StatFAS."Screenshot 4:
statfas-quantile-regression-results.png · Alt: "Quantile regression coefficient table and plot from StatFAS." Use only genuine captures of the tool.Reading the output
- Coefficients by quantile. Each slope describes the change in that conditional quantile per unit of the predictor. Mistake: describing a quantile slope as the effect "for the people at that quantile" as if individuals stay at the same rank.
- Intervals. Wide intervals at the extreme quantiles are normal. Mistake: over-interpreting differences between slopes that are within each other's uncertainty.
- Pattern across quantiles. Rising slopes mean the distribution widens upward; falling slopes mean it compresses; flat slopes mean a location shift only.
- Comparison with OLS. A large gap between OLS and median slopes suggests skew or outliers.
- Goodness of fit. The pseudo-R² (a quantile-specific measure based on the check function) is not comparable with OLS R². Report it per quantile if used.
- Crossing. If predicted quantile lines cross within the data range, the model is misspecified.
APA 7 reporting example (based on the illustrative data)
Quantile regression was used to examine the association between weekly study hours and exam scores at the 10th, 50th and 90th percentiles of the conditional score distribution. The estimated slope increased across quantiles: 0.80 points per hour at τ = .10, 1.50 at τ = .50 and 2.40 at τ = .90, compared with 1.60 from ordinary least squares. The widening gap indicates that the conditional distribution of scores spreads out as study time increases. Table 1 presents coefficients with 95% confidence intervals.
Essential elements: the quantiles estimated and why, the standard-error method, coefficients with intervals for each quantile, a comparison with OLS if relevant, the sample size, and a figure or table showing coefficients across quantiles. Do not report only the median unless the median is the stated aim.
Common mistakes and troubleshooting
- Interpreting quantile effects as individual effects. They describe the conditional distribution, not change within a person.
- Estimating extreme quantiles in small samples. The estimates are unstable. Stay near the middle or collect more data.
- Ignoring crossing. Fix the model specification or use a non-crossing estimator.
- Multiple testing across quantiles. Examining many quantiles invites false positives; pre-specify a small set.
- Treating differences between quantile slopes as established without a test. Use intervals or a slope-equality test.
- Extrapolating a linear quantile line beyond the data. The upper quantile in the example approaches the score ceiling.
- Ignoring clustering. Students in the same class are not independent; use appropriate standard errors.
- Applying it to a binary outcome. Use logistic regression instead.
Limitations and alternatives
Quantile regression requires larger samples than mean regression for tail quantiles, estimates each quantile separately, and is harder to explain to a general audience. Alternatives include OLS with robust standard errors if only the mean matters, generalised linear models for skewed outcomes, and stepwise or other variable-selection approaches when the main challenge is choosing predictors rather than modelling the distribution. For first-pass checks use the descriptive statistics calculator and the correlation calculator. To choose among methods, see the hypothesis analysis suggester guide.
Frequently asked questions
What is the difference between quantile regression and OLS?
OLS models the conditional mean; quantile regression models a chosen conditional quantile, so it can show how effects differ across the outcome distribution.
When should I use quantile regression?
When effects may differ at the low or high end, when variance changes with predictors, when the outcome is skewed or has outliers, or when the tails are of direct interest.
Does it assume normal residuals?
No. It makes no normality assumption about the errors.
How many quantiles should I estimate?
A small, pre-specified set (for example .10, .25, .50, .75, .90) is usually enough and limits multiple testing.
Conclusion
Quantile regression is most valuable when "the average effect" is not the whole story. Pre-specify a small set of quantiles, report intervals, check for crossing, and interpret the results as statements about the conditional distribution. When you are ready to apply it to your data, the StatFAS Quantile Regression Calculator provides a browser-based route, and its results should be checked by you before publication.
References
- Cade, B. S., & Noon, B. R. (2003). A gentle introduction to quantile regression for ecologists. Frontiers in Ecology and the Environment, 1(8), 412–420.
- Koenker, R. (2005). Quantile regression. Cambridge University Press.
- Koenker, R., & Bassett, G., Jr. (1978). Regression quantiles. Econometrica, 46(1), 33–50.