Quantile Regression
Quantile Regression estimates the effect of regressors on different quantiles of the distribution of — not just the mean as in OLS. It reveals how affects the "low", "median" and "high" groups differently (e.g. an effect on low-income vs high-income individuals).
When to use
Use Quantile Regression when you care about heterogeneous effects across the distribution, or when is skewed/has outliers so the OLS mean is unrepresentative. Median regression () is more robust to outliers than OLS.
Model specification
The -th conditional quantile of given :
Estimated by minimizing the asymmetrically weighted absolute errors (check function ):
Running in EcoLab
- Modeling module → Quantile regression family → Quantile.
- Select , the variables, and a list of quantiles (e.g. 0.1, 0.25, 0.5, 0.75, 0.9).
- Run; read per quantile + the quantile-process plot; bootstrap SE; export the replication code.
Replication code
- Stata
- R
- Python
* --- Quantile Regression ---
* Simultaneous quantile regression with bootstrap SE
sqreg lnwage educ exper, quantiles(0.25 0.5 0.75) reps(100)
* View results for each quantile
estimates table, stats(N)
# --- Quantile Regression ---
library(quantreg)
# Estimate at multiple quantiles
fit <- rq(lnwage ~ educ + exper, tau = c(0.25, 0.5, 0.75),
data = df)
summary(fit, se = "boot", R = 200)
# Quantile-process plot
plot(summary(rq(lnwage ~ educ + exper, tau = seq(0.05, 0.95, 0.05),
data = df), se = "boot"))
import statsmodels.api as sm
import pandas as pd
X = sm.add_constant(df[['educ', 'exper']])
y = df['lnwage']
# Estimate at multiple quantiles
quantiles = [0.25, 0.50, 0.75]
results = {}
for q in quantiles:
model = sm.QuantReg(y, X)
res = model.fit(q=q)
results[q] = res
print(f"\n=== Quantile {q} ===")
print(res.summary())
Limitations
- SE typically requires bootstrap; heavier computation than OLS.
- Interpreting many quantiles is more complex than a single mean coefficient.