fix: compute the seasonal ETS interval variance per step - #1243
Open
Max Gorbuk (mkzung) wants to merge 1 commit into
Open
Max Gorbuk (mkzung) wants to merge 1 commit into
Max Gorbuk (mkzung) wants to merge 1 commit into
Conversation
_compute_pred_intervals took hm = floor((h - 1) / m) from the total horizon, so ANA, AAA and AAdA used the last step's seasonal count at every step and the step-1 interval widened as the horizon grew. hm is now computed for each step, which is how the class 1 formulas in Hyndman et al. (2008), ch. 6 define it. The new test checks all six additive-error models against the c_j recursion.
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.
_compute_pred_intervalscomputes the seasonal count once, from the whole horizon:hmthen sits next tostepsin the ANA, AAA and AAdA variances, so every step gets the count of the last one. In Hyndman, Koehler, Ord and Snyder (2008), ch. 6, it is the count for the step being forecast. The visible effect is that the step-1 interval depends on how far ahead you forecast:On
main:With this change both lines read
62.02033057382857.The fix computes
hmfromsteps. The added test runs all six additive-error models through_compute_pred_intervalsand checks the variance againstsigma2 * (1 + sum of c_j**2), withc_j = alpha + beta * (phi + ... + phi**j) + gamma * [j % m == 0]. The three non-seasonal models already matched; the three seasonal ones fail onmainand pass here.tests/test_ets.pyis 84 passed andtests/test_models.py206 passed.