Repository navigation
fix(volatility): prevent look-ahead in GARCH forecasts - #83
Merged
Merged
Conversation
The initial variance was the sample variance of the next 20 returns, so a future shock raised earlier forecasts. The horizon recursion also ignored the current return. Initialization now uses only the first return, and the forecast at each row uses information available at that row. Co-authored-by: quantum-like <[email protected]>
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 #82. Supersedes the GARCH portion of #71.
Initialize variance from the first observed return and forecast using information available at each row. A later shock no longer changes forecasts made before it is observed. The one-step forecast uses the current return; longer horizons apply the conditional expectation recurrence.
At reviewed head 69bab62, after incorporating qualified main 1cd06f3, all 64 volatility tests and the full 3,956-test suite pass (57 intentional deselections). Twelve permanent regressions covering horizons 1, 2 and 5 through eager and lazy public expressions all fail against an isolated installation of published 0.1.6 and pass on this fix. The numerical oracle is independently calculated from fixed one-step variances and the closed-form multi-step expectation, not copied from the implementation.
Ruff, formatting, ty, all-file hooks, lock validation, package build/import and strict MkDocs pass. Fresh supported-platform hosted qualification is required before merge. The earlier 53-test evidence remains pinned to its original submitted revision 436eea1.
Forecast values change and warrant inclusion in the eventual qualified patch release. This PR does not publish a release. Cursor Agent source-fix authorship is retained; the expanded regressions are a separate Stefan Jansen commit. Codex assisted public-package reproductions, the numerical regressions, review, checks and this description.