Skip to content

fix: prevent future returns from changing earlier GARCH forecasts #82

Closed

Description

@stefan-jansen

Engineer 0.1.6 initializes GARCH variance from up to 20 future returns. A later shock therefore changes forecasts produced before it is observed. On base a441fb4, adding a shock at return index 10 changes the first forecast from 0.0031622777 to 0.8497117158.

Reproduce through the public garch_forecast Polars expression with 30 zero returns, then with the same returns except index 10 set to 4. Forecasts before index 10 must match. The forecast at index 10 should respond to the newly observed shock.

The public-expression test_forecast_ignores_future_returns fails on the base and passes at 436eea1. The volatility suite passes 53 tests. The original bundled test put its shock at index 20, outside the faulty initialization window, and passed on the base; the replacement test exercises the real leak.

This splits the confirmed look-ahead defect from #69 and #71. Forecast values change and require a patch release. Cursor Agent source-fix authorship is retained; the stronger regression is a separate Stefan Jansen commit. Codex assisted the reproduction, regression, review, checks, and submission preparation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions