Skip to content

ENH: Allow seasonal-differencing-only models with non-seasonal estimators (Issue #6159) - #9811

Merged
bashtage merged 4 commits into
statsmodels:mainfrom
imann128:feature/arima-seasonal-diff-support
Jun 14, 2026
Merged

bashtage merged 4 commits into
statsmodels:mainfrom
imann128:feature/arima-seasonal-diff-support

Conversation

@imann128

Copy link
Copy Markdown
Contributor

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.py
The validate_estimator() method did not allow any model with seasonal_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 != 0 was changed to has_seasonal_ar_or_ma which targets max_seasonal_ar_order > 0 or max_seasonal_ma_order > 0.

statsmodels/tsa/arima/estimators/hannan_rissanen.py
A seasonal_order order parameter was added. When the model includes seasonal differencing, the series is differenced before estimation using the already present diff() utility, which matches how 'gls.py' handles integration.

statsmodels/tsa/arima/estimators/gls.py
The 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.py
test_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.ipynb
New example notebook using the Mauna Loa CO₂ dataset, which shows the use of alternative estimators with seasonal differencing.

imann128 added 3 commits May 28, 2026 18:13
…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
@imann128 imann128 changed the title TSA: Allow seasonal-differencing-only models with non-seasonal estimators ENH (#6159): Allow seasonal-differencing-only models with non-seasonal estimators May 28, 2026
@imann128 imann128 changed the title ENH (#6159): Allow seasonal-differencing-only models with non-seasonal estimators ENH: Allow seasonal-differencing-only models with non-seasonal estimators (Issue #6159) May 29, 2026
@bashtage

bashtage commented Jun 8, 2026

Copy link
Copy Markdown
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.

@imann128

imann128 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@bashtage sure thing

@bashtage
bashtage merged commit f52ad63 into statsmodels:main Jun 14, 2026
2 checks passed
@bashtage

Copy link
Copy Markdown
Member

Thanks.

@imann128
imann128 deleted the feature/arima-seasonal-diff-support branch June 15, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants