1 Why Averages Are Not Enough
Most causal inference estimators target an average treatment effect (ATE) or a conditional mean. But averages hide distributional heterogeneity that is often the most policy-relevant feature of a programme.
Consider a job training programme. The average effect on earnings might be zero - but this average could mask a positive effect for initially low earners (the programme helps those most at risk) and a negative effect for high earners (opportunity cost of training time). A policymaker asking "should we fund this programme?" needs the full distributional picture, not just the mean.
Similarly, the returns to education may differ dramatically at different quantiles of the wage distribution: a college degree might substantially raise earnings at the bottom (by lifting workers out of low-wage jobs) while having little effect at the top (where earnings are driven by occupation choice and connections, not just credentials).
Quantile regression, introduced by Koenker and Bassett [1978], is the workhorse tool for estimating conditional distributions and, in a causal context, quantile treatment effects.
2 What Is Quantile Regression?
2.1 The Quantile Function
The τth quantile of a random variable Y is the value Q_Y(τ) such that Pr(Y ≤ Q_Y(τ)) = τ The 50th percentile (τ = 0.5) is the median; the 25th and 75th percentiles are the quartiles.
Quantile regression estimates the conditional quantile function Q_Y(τ | X = x) the τth quantile of Y given that covariates equal x. In linear quantile regression:
where the coefficient vector β(τ) is quantile-specific different for different quantiles τ.
2.2 Estimation: The Check Function
The OLS estimator minimises the sum of squared residuals. The quantile regression estimator minimises the sum of asymmetrically weighted absolute residuals, using the check function (or pinball loss):
where,
The check function ρ_τ penalises positive residuals by τ and negative residuals by 1 - τ. When τ = 0.5, it reduces to equal weighting of positive and negative residuals the LAD (least absolute deviations) estimator for the median.
2.3 A Numerical Example
Suppose we have earnings Y and education S (years of schooling). Running quantile regressions at τ = 0.25, 0.50, 0.75, 0.90:
The pattern shows that returns to education are larger at higher quantiles of the earnings distribution a finding that would be completely obscured by OLS, which recovers only the mean coefficient of around 0.10.
3 Interpretation: Conditional vs. Unconditional Quantiles
A key subtlety: Koenker and Bassett [1978] estimate conditional quantile functions Q_Y(τ | X = x). The 75th percentile of earnings among workers with 16 years of schooling is not the same as the 75th percentile of earnings in the overall population.
Firpo et al. [2009] introduced Unconditional Quantile Regression (UQR), which estimates the effect of a covariate on the unconditional (marginal) quantile of Y the quantile of Y in the overall population, ignoring X. UQR uses the influence function of the quantile functional and is implemented in the UQR R package and the rifreg Stata command.
For causal inference questions (what is the effect of education on the 75th percentile of earnings in the full population?), unconditional quantile regression is often more relevant than conditional quantile regression.
4 Quantile Treatment Effects (QTE)
4.1 The Observational Case
In a causal setting with binary treatment Dᵢ ∈ {0, 1}, the Quantile Treatment Effect at quantile τ is:
the difference between the τth quantile of the potential treated outcome distribution and the τth quantile of the potential untreated outcome distribution.
Under unconfoundedness (Dᵢ ⊥ (Yᵢ(0), Yᵢ(1)) | Xᵢ) QTE(τ) can be estimated from observational data by combining inverse probability weighting with quantile regression:
- Estimate propensity scores ê(Xᵢ) = Pr(Dᵢ = 1 | Xᵢ).
- Construct IPW-weighted quantile regression: minimise Σᵢ [Dᵢ / ê(Xᵢ)] ρ_τ(Yᵢ - q) for the treated distribution and Σᵢ [(1 - Dᵢ) / (1 - ê(Xᵢ))] ρ_τ(Yᵢ - q) for the control distribution.
- The difference of the two estimated quantiles gives QTÊ(τ).
4.2 Quantile Treatment Effects with Instrumental Variables
When treatment is endogenous, IV methods can be combined with quantile regression. The Instrumental Variables Quantile Regression (IVQR) estimator, due to Chernozhukov and Hansen [2005], identifies the structural quantile treatment effect:
where Zᵢ is an instrument and the identification assumption is that Zᵢ is independent of the error εᵢ. The IVQR estimator recovers α by searching for the value that makes the quantile regression residuals εᵢ = Yᵢ - Dᵢα - Xᵢ′β uncorrelated with the instrument Zᵢ.
IVQR is computationally intensive but has been automated in the quantreg R package (via rq() with a two-stage option) and the ivqte Stata package.
5 Code: Quantile Regression in R
Listing 1: Quantile regression in R using the quantreg package
6 Common Mistakes
• Confusing conditional and unconditional QTE. Conditional QTE (Q_{Y|X} difference) and unconditional QTE (Q_Y difference) answer different questions. Policy questions typically concern the unconditional distribution.
• Rank invariance. The IVQR structural interpretation requires rank invariance: the treatment-vs-control rank of each individual is fixed. This is a strong assumption (a person at the 40th percentile of untreated earnings must also be at the 40th percentile of treated earnings). Violating rank invariance invalidates the structural QTE interpretation.
• Not testing for quantile-varying effects. Report a plot of QTE̅(τ) across quantiles, not just a single quantile. The Kolmogorov-Smirnov or Koenker and Xiao [2002] tests check whether the quantile function is constant (i.e., whether QR adds information beyond OLS).
7 Where to Learn More
• Koenker [2005]: comprehensive textbook on quantile regression.
• Chernozhukov et al. [2013]: inference for quantile treatment effects in randomised experiments.
• quantreg R package: implements QR, IVQR, and inference [Koenker, 2023].
• Firpo et al. [2009]: unconditional quantile regression via RIF regression.
8 Conclusion
Average treatment effects answer "what is the typical effect?" but distributional treatment effects answer "who benefits and how much?" Quantile regression provides a flexible, nonparametric tool for estimating conditional quantile functions from observational data. In causal settings, quantile treatment effects extend the IV, matching, and RCT frameworks to the full outcome distribution. When the policy question concerns inequality, targeting, or heterogeneous benefits, quantile methods are indispensable.
References
- Chernozhukov, V. and Hansen, C. (2005). An IV model of quantile treatment effects. Econometrica, 73(1):245-261.
- Chernozhukov, V., Lee, S., and Rosen, A. M. (2013). Intersection bounds: Estimation and inference. Econometrica, 81(2):667-737.
- Firpo, S., Fortin, N. M., and Lemieux, T. (2009). Unconditional quantile regressions. Econometrica, 77(3):953-973.
- Koenker, R. and Bassett, G. (1978). Regression quantiles. Econometrica, 46(1):33-50.
- Koenker, R. and Xiao, Z. (2002). Inference on the quantile regression process. Econometrica, 70(4):1583-1612.
- Koenker, R. (2005). Quantile Regression. Cambridge University Press.
- Koenker, R. (2023). quantreg: Quantile Regression. R package version 5.97.