EWMA and GARCH volatility forecasts for the S&P 500, scored walk-forward on years they never saw against a plain rolling window.
Download at least 15 years of daily closes for SPY, the S&P 500 fund on NYSE Arca, and compute log returns.
Check autocorrelation of returns and of squared returns to 20 lags with a Ljung-Box test, and work out the kurtosis.
Run the augmented Dickey-Fuller test on prices and on returns, and the variance ratio at 2, 5 and 10 days.
Forecast each day's variance from earlier days only: a 20-day window as the baseline, EWMA with λ = 0.94, and GARCH(1,1) refitted each month with the arch package.
Score the last five years walk-forward against each next day's squared return with QLIKE and mean squared error, and work out each forecast's skill score against the baseline.
Write a test that changes one day's return and fails if that day's forecast, or any earlier one, moves.
How you'll know it worksA walk-forward table of QLIKE, mean squared error and skill score for all three forecasts over the last five years, and a passing test that no forecast uses its own day's return.
Python with NumPy, pandas, statsmodels and arch. You download the price CSV yourself from a free source such as Stooq or Yahoo Finance; it all runs on a laptop in minutes. Uses lessons 01 to 11.
Project: Forecasting tomorrow's volatility
From insideout, Time Series: EWMA and GARCH volatility forecasts for the S&P 500, scored walk-forward on years they never saw against a plain rolling window.
Steps:
1. Download at least 15 years of daily closes for SPY, the S&P 500 fund on NYSE Arca, and compute log returns.
2. Check autocorrelation of returns and of squared returns to 20 lags with a Ljung-Box test, and work out the kurtosis.
3. Run the augmented Dickey-Fuller test on prices and on returns, and the variance ratio at 2, 5 and 10 days.
4. Forecast each day's variance from earlier days only: a 20-day window as the baseline, EWMA with λ = 0.94, and GARCH(1,1) refitted each month with the arch package.
5. Score the last five years walk-forward against each next day's squared return with QLIKE and mean squared error, and work out each forecast's skill score against the baseline.
6. Write a test that changes one day's return and fails if that day's forecast, or any earlier one, moves.
How you'll know it works: A walk-forward table of QLIKE, mean squared error and skill score for all three forecasts over the last five years, and a passing test that no forecast uses its own day's return.
Runs on: Python with NumPy, pandas, statsmodels and arch. You download the price CSV yourself from a free source such as Stooq or Yahoo Finance; it all runs on a laptop in minutes.
Help me build this on my machine, one step at a time. Ask what I've tried first, give hints before full answers, and check my work against "How you'll know it works".