Modelling the tail, not the mean
Least squares fits the mean: it minimises Σeₜ². The q-quantile of y given x is the value below which a share q of the outcomes fall, and quantile regression fits it by minimising the pinball loss Σρ_q(eₜ) with ρ_q(e)=max(q e, (q-1) e) and e=y-pred. An under-forecast costs q per unit, an over-forecast 1-q: the asymmetry pulls the line to the q-quantile. At q=0.5 the loss is half the absolute error and the fit is the median. QuantReg(y, sm.add_constant(X)).fit(q=0.05) fits the 5% quantile; res.params holds the intercept and slopes. Different quantiles can have different slopes, which is the point: the effect of x may be on the spread of the outcome, not on its centre.
Use 21-day annualised volatility to predict the next day's SPY return over 5,383 days. The slope is -0.096 at the 5% quantile, +0.087 at the 95% quantile and 0.001 at the median, while least squares finds 0.0008: the mean does not move with volatility, the tails do, in both directions. The 5% fit turns into a value at risk table, -(a+b·vol): 1.2% at a volatility of 10%, 2.2% at 20%, 6.3% at 60%. Judge it as you would a forecast. The pinball loss on the last 30% of days is 0.001295 against 0.001342 for the unconditional 5% quantile, a modest gain. The coverage, the share of days with a return below the predicted quantile, should be near 5% everywhere. The unconditional value at risk is breached on 2.2% of calm days and on 7.8% of stormy ones; the conditional one gives 6.7%, 4.3%, 2.8%: better balanced, not perfect, which is what out-of-sample honesty looks like.
- Quantile regression minimises the pinball loss max(qe,(q-1)e) and fits any quantile, not only the mean.
- Slopes can differ by quantile: volatility moves the tails of the next return and leaves its mean alone.
- Check coverage overall and by regime: a 5% value at risk should be breached about 5% of the time everywhere.
Lab · what's graded
- The quantile fit10 pts
- Slopes by quantile10 pts
- The fitted quantile5 pts
- The pinball loss15 pts
- The coverage5 pts
- Coverage by volatility tercile15 pts
- Values at risk10 pts
- Out of sample15 pts
- The quantile study15 pts