Quantile Regression Explained: How to Run, Read and Report It

By Dr. Faheem Afzal Shah, Founder, StatFAS.com · Tool: Quantile Regression Calculator

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?

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

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

Illustrative quantile regression estimates (exam score on weekly study hours)
Quantile (τ)InterceptSlope (hours)
.1030.00.80
.5040.01.50
.9048.02.40
OLS (mean)39.51.60

Step 2: Turn coefficients into predictions

The predicted quantile at x hours is intercept + slope × x.

Predicted score quantiles at selected study hours
Hoursτ = .10τ = .50τ = .90Spread (.90 − .10)
030.040.048.018.0
1038.055.072.034.0
2046.070.096.050.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.

  1. 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.
  2. Load the data and choose the variables. Select the outcome and predictors.
  3. Choose quantiles. For example .10, .25, .50, .75 and .90.
  4. Set options. Such as standard-error method, confidence level and plots of coefficients across quantiles.
  5. Run and review. Compare coefficients across quantiles with their intervals, and check for crossing predictions.
  6. Download results. Verify every number and sentence before it enters a manuscript.
Screenshot 1 (to be supplied): statfas-quantile-regression-interface.png
Alt text: "StatFAS quantile regression calculator interface before data entry."
Caption: The Quantile Regression Calculator on StatFAS.com.
Screenshot 2: 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

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

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

Author attribution: Dr. Faheem Afzal Shah, Plant Functional Genomics and Regulatory Genomics Researcher; StatFAS.com Founder.