22. Quantile Regression

When the Mean Is Not the Whole Story

Author

A. J. Smit

Published

2026/03/19

1 Introduction

Quantile regression is not simply “nonlinear regression”. Its purpose is different. Ordinary regression describes how predictors affect the conditional mean of a response variable. Quantile regression instead asks how predictors affect specific parts of the response distribution, such as the lower tail, the median, or the upper tail.

That makes it useful when the mean is not the main scientific target, or when the relationship differs across the distribution of the response.

2 Key Concepts

  • Quantile regression models conditional quantiles rather than the conditional mean.
  • It is useful when different parts of the response distribution behave differently.
  • It can reveal relationships hidden by mean-based regression.
  • It is not inherently a nonlinear method, although it can be combined with smooths or interactions.
  • Interpretation depends on which quantile is being modelled.

3 When This Method Is Appropriate

You should consider quantile regression when:

  • you want to understand upper or lower limits rather than average responses;
  • the effect of predictors appears to differ across the spread of the data;
  • heterogeneity in the response is itself scientifically interesting;
  • a mean regression clearly misses biologically relevant structure.

Quantile regression therefore belongs near the end of the modelling sequence. It is a specialised extension of regression logic rather than a replacement for the ordinary mean-based framework.

4 R Functions

The most common introductory function is quantreg::rq():

quantreg::rq(y ~ x, tau = 0.5, data = df)   # median regression
quantreg::rq(y ~ x, tau = 0.9, data = df)   # upper quantile
quantreg::rq(y ~ x1 + x2, tau = 0.25, data = df)

The argument tau specifies which quantile is being modelled.

5 Worked Example Placeholder

The BCB_Stats source material treats quantile approaches in a more specialised research setting than is currently appropriate for this Tangled Bank sequence. For now, this chapter is a structured placeholder whose role is to establish where quantile regression belongs in the broader modelling grammar.

The intended workflow for the chapter is:

  1. identify why the conditional mean is not enough;
  2. choose one or more scientifically meaningful quantiles;
  3. fit the model with rq();
  4. compare fitted quantiles across the predictor range;
  5. interpret the result in terms of distributional change rather than mean change.

6 Practical Caution

Quantile regression can be extremely informative, but it is also easy to over-interpret if the scientific question is not clear. The key point is that a slope at the 90th quantile is not the same object as a slope in an ordinary least-squares regression. You are answering a different question.

7 Summary

  • Quantile regression extends regression beyond the conditional mean.
  • It is most useful when different parts of the response distribution matter.
  • It is not simply another nonlinear model, and should not be taught as though it were.
  • It belongs in the advanced extension block because it changes the inferential target rather than only the fitted shape.

The next chapter turns from model family to model purpose by distinguishing explanation from prediction. The chapter after that takes up regularisation directly.

Reuse

Citation

BibTeX citation:
@online{smit,_a._j.2026,
  author = {Smit, A. J., and J. Smit, A.},
  title = {22. {Quantile} {Regression}},
  date = {2026-03-19},
  url = {http://tangledbank.netlify.app/BCB744/basic_stats/22-quantile-regression.html},
  langid = {en}
}
For attribution, please cite this work as:
Smit, A. J., J. Smit A (2026) 22. Quantile Regression. http://tangledbank.netlify.app/BCB744/basic_stats/22-quantile-regression.html.