Skip to content

ENH: Improvements to new ARIMA-type estimators #6159

Open

Description

@ChadFulton

Collection of follow-ups to #5827. These can/should be broken out into individual PRs. Many are relatively straightforward and would make a good first PR.

General

  • Documentation (none was added in original PR).
  • Release notes.
  • Example notebook.
  • Double-check how sm.tsa.arima.ARIMA works with fix_params (it should fail except when the fit method is statespace).
  • Estimators that do not support seasonal models per se should support models where the only seasonal part is seasonal differencing.

GLS

  • Add support for fixed parameters
  • Improve "Returns" documentation for other_results.
  • Add documentation for why we have e.g. include_constant but not other trend specifications (e.g. that it is to maintain consistency with estimation methods with assumptions that require demeaned series).
  • Fix the following test and put it back into the GLS test suite:
@pytest.mark.low_precision('Test against Example 6.6.3 in Brockwell and Davis'
                           ' (2016)')
# @pytest.mark.xfail(reason="Source appears to find suboptimal parameters")
def test_brockwell_davis_example_663():
    # TODO: the parameters described by BD appear to be suboptimal (based on
    # llf computed from state space form), so that this test fails. Should try
    # to confirm with ITSM2000 (i.e. see if we can get it to find better
    # parameters closer to what we find, or compare llf, or something).
    # TODO: quite a slow test, and xfail anyway due to finding better
    # parameters...
    # Get the data, perform seasonal differencing
    endog = sbl.diff(12).iloc[12:]

    exog = pd.Series((sbl.index > '1983-01-01').astype(int),
                     index=sbl.index).diff(12).iloc[12:]

    res, _ = gls(endog, exog, order=(0, 0, 12), max_iter=3)

    assert_allclose(res.exog_params, -328.45, atol=1e-2)
    assert_allclose(res.ma_params,
                    [.219, .098, .031, .064, .069, .111, .081,
                     .057, .092, -0.28, .183, -.672], atol=1e-3)
    assert_allclose(res.sigma2, 12581, atol=1)

Hannan Rissanen

  • Better warnings / errors when series are short relative to lag length
  • Add support for fixed parameters
  • Seems like we could add support for seasonal parameters in this model.
  • Tests for the case with the bias-corrected estimator.

Innovations MLE

  • Add support for fixed parameters

Innovations algorithm

  • Add support for ARMA models; see Brockwell and Davis (2016) p.154 and Example 5.1.6. This estimator should be feasible given the Cython versions of the general innovations algorithm that introduced in PERF: Cythonize innovations algo and filter #5947.

Activity

  1. added this to the Someday milestone on Sep 11, 2019
  2. rajathpatel23 commented on Sep 15, 2019

    @rajathpatel23

    @ChadFulton I would like to work on this enhancement, would like to request some help in guiding to start working on this enhancement.

    Thank you

  3. ChadFulton commented on Sep 16, 2019

    @ChadFulton
    MemberAuthor

    @rajathpatel23 that would be great, thanks!

    There are a number of things here that I think should be pretty self-contained, including:

    • Example notebooks: it would be great to add a notebook showing how to use the new models.
      • There are tons of options here that would be great. One would be to replicate some of the "Examples" sections from Brockwell and Davis' book.
    • Tests: we could use more unit tests in general, and there are two specific issues I called out above:
      • GLS test: the test I put in the issue, above, fails because we find better parameters than are reported in Brockwell and Davis' book. Some more investigation on this case would be useful, especially comparing against their ITSM2000 program (can be found at http://extras.springer.com/2002/978-0-387-21657-7/ITSM2000, only runs on Windows).
      • We don't have any tests for the HR estimator with the bias correction, and this is because I couldn't find any packages that implemented it. However, I notice that Gomez and Maravall (e.g. in their chapter "Automatic Modeling Methods for Univariate Series") also have implemented this bias correction in TRAMO/SEATS, and so I was thinking that it is probably available in X13-ARIMA/SEATS, and we might be able to test against that package somehow.
      • In general, it would be great to add more unit tests for any of the methods against ITSM2000 or X13-ARIMA/SEATS
    • Support for fixed parameters: GLS, innovations MLE, and Hannan Rissanen should each be able to support fixed parameters. If you wanted to try this, I would suggest picking just one to start with.

    If you have a particular interest, I can go into more details.

  4. emilmirzayev commented on Sep 18, 2019

    @emilmirzayev
    Contributor

    Hi Chad,

    How one can add examle Notebooks?
    Which directory I should put them?

    Thanks,

  5. bashtage commented on Sep 18, 2019

    @bashtage
    Member

    Three steps to add a notebook:

    1. Add your notebook to examples/notebooks
    2. Add a block to the json file that contains the metadata for notebooks.
    3. Add a nice screenshot for your notebook that makes it look interesting in docs/_static/images

    I like the format that @ChadFulton uses with the title. I used it here: https://github.com/statsmodels/statsmodels/blob/master/docs/source/_static/images/rolling_ls.png

  6. bashtage commented on Sep 18, 2019

    @bashtage
    Member

    NB: The json file determines where the example notebook appears in the docs, so please add in the correct section.

  7. modified the milestones: Someday, 0.11 on Oct 6, 2019
  8. modified the milestones: 0.11, 0.12 on Jan 24, 2020
  9. modified the milestones: 0.12, 0.13 on Oct 27, 2020
  10. 8 remaining items

  11. added a commit that references this issue on Jun 14, 2026
  12. harshhh817 commented on Jul 1, 2026

    @harshhh817

    Hi @ChadFulton — I'd like to work on the 'better warnings/errors for short series' item under Hannan-Rissanen. Is that still open? I have a background in data analysis / feature engineering and this seems like a good scoped starting point.

  13. anish19p-spec commented on Nov 7, 2026

    @anish19p-spec

    Hi @ChadFulton, I'd like to contribute, can you point me in the right direction?

  14. ChenyangLi4288 commented on Nov 9, 2026

    @ChenyangLi4288
    Contributor

    Hi @ChadFulton @bashtage, I'd like to take the Hannan-Rissanen item "Tests for the case with the bias-corrected estimator".

    Current tests only check that unbiased=None matches unbiased=True. I plan to compute the step-3 correction from Brockwell & Davis (2016) §5.1.4 independently with numpy for a simulated ARMA(1,1) and assert hannan_rissanen(..., unbiased=True) matches.

    Side note: the GLS other_results docs (#9881) and innovations MLE fixed params (#9845) items are done and can be checked off.

    I'll open a PR in a few days unless you'd prefer a different approach.

  15. bashtage commented on Nov 9, 2026

    @bashtage
    Member

    Sure, please go for it.

  16. ChenyangLi4288 commented on Nov 9, 2026

    @ChenyangLi4288
    Contributor

    Sure, please go for it.

    Thanks! One thing came up while writing the test: it fails on main. In step 3, W is computed as

    lfilter(np.r_[1, -ma_coef[1:]], [1], Z)
    

    i.e.
    (1 − θB)Z, but the Gauss-Newton derivation gives θ(B)W = Z. JDemetra+'s Hannan-Rissanen (biascorrection()) also uses the recursive form. The fix is one line, W = lfilter([1], ma_coef, Z).

    I'll include the fix in the same PR as the test, since the test can't pass without it.

  17. anish19p-spec commented on Nov 10, 2026

    @anish19p-spec

    @ChenyangLi4288 @bashtage , are there any other issues I can wokr on?

  18. fcarvajalbrown commented on Nov 24, 2026

    @fcarvajalbrown

    I went through the GLS checklist looking for something to pick up, and two of the boxes turned out to be finished already, they just never got ticked.

    If someone with rights can tick both, the list tells the truth again. What's left in GLS that needs code is the Brockwell-Davis 6.6.3 test.

  19. jjohnnystwsss commented on Nov 26, 2026

    @jjohnnystwsss
    Contributor

    Hi @ChadFulton and @bashtage, I'd like to work on the last item in the list, which is preliminary estimation of ARMA parameters using the innovations algorithm. I've looked through recent PRs, and nobody seems to be working on it.

    My plan is to extend the innovations estimator to support ARMA models so that ARIMA.fit(method="innovations") also works with AR terms. For testing, I plan to check against Example 5.1.6 in Brockwell & Davis and verify that the algorithm recovers the true parameters from theoretical autocovariances.

    Would you prefer a new function or additional arguments to innovations(), and what would be a reasonable default value for m? Would these two approaches be sufficient for validation?

  20. bashtage commented on Nov 26, 2026

    @bashtage
    Member

    The best approach would be to do what the others have done so that the API will be consistent in terms of the other approaches as well as the keyword version.

  21. Duke2nuke commented on Nov 28, 2026

    @Duke2nuke

    Hi, I’m Aarambh, a 3rd year CSE student prepping for GSoC 2027. I was reading through this list and a few of the smaller items caught my eye, like the better warnings when a series is short for the Hannan-Rissanen estimator. Are any of these still open, and is there one you’d suggest as a first PR? Happy to start with one small piece rather than the whole list.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions