Repository navigation
fix(garch): use a zero point forecast for GARCH and ARCH - #1291
Open
AnthonyOlakangil wants to merge 1 commit into
Open
AnthonyOlakangil wants to merge 1 commit into
AnthonyOlakangil wants to merge 1 commit into
Conversation
garch_forecast returned the simulated path y_vals as the mean, so the point forecast and the centre of every prediction interval were a single draw of the noise. GARCH/ARCH are zero-mean, so the forecast of the conditional mean is 0 at every horizon. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1280
Problem
GARCHandARCHreturn a random draw as the point forecast, and the prediction intervals are built around it.garch_forecastsimulates a path (yhat = error * sqrt(sigma2hat)witherror ~ N(0, 1)) and returns that path asmean, andGARCH.predict/GARCH.forecastthen setlo/hi = mean -/+ z * sqrt(sigma2).Both models are zero-mean (
y_t = eps_t * sigma_t), so the forecast of the conditional mean is 0 at every horizon. Becausegarch_forecastalso callsnp.random.seed(1), the first step is always the same draw, about+1.62 * sigma, so the bands are shifted rather than just noisy.Change
garch_forecastreturnsnp.zeros(h)formean.sigma2andfittedare unchanged, so the half-width of the intervals is the same as before and they are now centred on 0.The
sigma2recursion still uses the simulated path for future squared values. That is what #1264 fixes, and the two changes are independent.How tested
test_garch_forecastintests/test_garch.pynow checks thatmeanis all zeros, and a newTestGARCH::test_garch_intervals_centred_on_zerointests/test_models.pychecks the mean and that the 95% band is symmetric around 0. Both fail onmainand pass with this change.pytest tests/test_garch.py tests/test_models.py::TestGARCH tests/test_models.py::TestARCH: 18 passed.pre-commit run(ruff, mypy) on the changed files passes.Repro from the issue (
y = rng.standard_normal(500) * 10,h=5):One-step-ahead coverage of the 95% interval on 1000 simulated GARCH(1,1) series (
w=0.5, alpha=0.1, beta=0.8, length 500, fitted withGARCH(1, 1)):