Repository navigation
ENH: Allow seasonal-differencing-only models with non-seasonal estimators (Issue #6159) - #9811
Merged
bashtage merged 4 commits intoJun 14, 2026
Conversation
…tors hannan_rissanen, yule_walker, burg, and innovations now accept SARIMA models where the only seasonal component is differencing (P=0, D>0, Q=0). - specification.py: validate_estimator checks has_seasonal_ar_or_ma - hannan_rissanen.py: add seasonal_order param, apply seasonal diff - gls.py: guard checks seasonal AR/MA only, not seasonal differencing - test_model.py: add test_alternative_estimators_seasonal_differencing - examples: add notebook demonstrating seasonal-differencing usage
- Remove unused has_seasonal variable in specification.py - Fix continuation line indentation in specification.py - Remove trailing whitespace in hannan_rissanen.py - Fix test: replace invalid method='gls' with valid estimator calls - Add blank line fix and remove unused variables in test_model.py
Member
|
Could you clear all output cells in the jupyter notebook. We only store unrun notebooks and run them when building docs. Storing executed nbs has a large impace on git size since a single pixel change in a PNG requires a massive diff. |
Contributor
Author
|
@bashtage sure thing |
Member
|
Thanks. |
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.
Summary:
Presently, 'hannan_rissanen', 'yule_walker', 'burg', and 'innovations' estimators were rejecting any model with a non-seasonal time period, even if the seasonal component was purely differencing (P=0, D>0, Q=0). This PR aims to make these estimators accept models where the seasonal component is differencing.
Changes:
statsmodels/tsa/arima/specification.pyThe
validate_estimator()method did not allow any model withseasonal_periods != 0. This was a very broad condition as it should only block models with seasonal MA or AR terms, as differencing is handled before estimation. That's why the check condition i.e.seasonal_periods != 0was changed tohas_seasonal_ar_or_mawhich targetsmax_seasonal_ar_order > 0 or max_seasonal_ma_order > 0.statsmodels/tsa/arima/estimators/hannan_rissanen.pyA
seasonal_orderorder parameter was added. When the model includes seasonal differencing, the series is differenced before estimation using the already presentdiff()utility, which matches how 'gls.py' handles integration.statsmodels/tsa/arima/estimators/gls.pyThe internal condition used to check the arma_estimator against the model spec now also checks for seasonal AR/MA rather than seasonal structure.
statsmodels/tsa/arima/tests/test_model.pytest_alternative_estimators_seasonal_differencing()was added, which checks whether each estimator correctly accepts seasonal-differencing-only models and accurately rejects any models with seasonal AR or MA terms.examples/notebooks/arima_alternative_estimators_seasonal_differencing.ipynbNew example notebook using the Mauna Loa CO₂ dataset, which shows the use of alternative estimators with seasonal differencing.