R

Quantile regression (QR)

Notes

Posted by Shsun on February 6, 2020

Ordinary linear regression assumes a constant variance for the response of dependent variable (DV). It answers “How does the conditional mean of Y depend on the covariates X?”. QR can model the conditional distribution of the response can vary with independent variables (IV), which gives you insights about extreme conditions. QR calculates the conditional mean of Y depend on covariates X at each quantile of the conditional distribution.

difference between QR and standard linear regression

Linear regression Quantile Regression
Predict conditional mean predict conditional distribution
Applies with limited n Needs sufficient data in tails
Assumes normality Distribution agnostic
Sensitive to outliers Robust to outliers
Computationally inexpensive Computationally intensive
Test whether two QR coefficients are different
1
2
3
Qreg25=rq(Y~X, tau=0.25)
Qreg75=rq(Y~X, tau=0.75)
anova(Qreg25, Qreg75)
Run several QR
1
QR=rq(Y~X, tau=seq(0.2, 0.8, by=0.1))
Reference
  1. Three things you should know about quantile regresson 2.