From four models to one fair contest
Every tool of this skill answers one question: how large will tomorrow's move be? A constant variance, an exponentially weighted average, a GARCH(1,1) and a HAR regression on the daily high-low range give four different answers, and the only honest way to choose between them is a contest with fair rules. Each forecast for day t may use only data before day t. GARCH is fitted once on the first 1,000 days and never refitted. All four are scored on the days after that, against the squared return, with a loss that punishes under-predicting the variance more than over-predicting it. Only NumPy is needed.
The EWMA and the GARCH both update a variance state with yesterday's squared return. GARCH has more room: its parameters are chosen by maximising a Gaussian likelihood, here over a small grid with the long-run variance σ² fixed to the sample value (variance targeting). The HAR model reads the range instead. Its feature for day t is built from the Parkinson variance of the days before: yesterday's value, the mean of the last 5 days and the mean of the last 22. Its target is the squared return, which is noisy but has the right level, and it is refitted every 21 days on the previous 750 days. The score is the mean QLIKE, y/h-ln(y/h)-1 with y the proxy and h the forecast, and the Diebold-Mariano statistic tells whether a difference between two forecasters is larger than luck.
- Fair rules: a forecast for day t uses only data before day t, the GARCH is fitted before the scoring period and filtered forward with fixed parameters.
- QLIKE is the loss, the squared return is the proxy, and Diebold-Mariano tells whether two forecasters really differ.
- Ladder: constant, EWMA, GARCH, HAR on the range; each step lowers the loss on SPY, but the last gap is within noise.
Lab · what's graded
- A range-based variance10 pts
- An EWMA forecaster15 pts
- A GARCH filter15 pts
- Fitting a GARCH on a grid15 pts
- A HAR forecaster20 pts
- The QLIKE loss10 pts
- The Diebold-Mariano statistic5 pts
- The contest10 pts