Skip to content

BUG: ARMA model is not immutable #5985

Closed

Description

@bashtage

Describe the bug

ARMA mutaes on each call. This leads to many problems, including

Code Sample, a copy-pastable example if possible

import statsmodels.api as sm
import numpy as np
mod = sm.tsa.ARMA(np.random.randn(1000),(2,0))
mod.fit()
mod.fit()
...
ValueError: x contains a constant. Adding a constant with trend='c' is not allowed.
Details

Note: As you can see, there are many issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates.

Note: Please be sure you are using the latest released version of statsmodels, or a recent build of master. If your problem has been fixed in an unreleased version, you might be able to use master until a new release occurs.

Note: If you are using a released version, have you verified that the bug exists in the master branch of this repository? It helps the limited resources if we know problems exist in the current master so that they do not need to check whether the code sample produces a bug in the next release.

Expected Output

Never mutatute the model. Will need a depreacation cycle, but worth it.

Output of import statsmodels.api as sm; sm.show_versions()

Details

INSTALLED VERSIONS

Python: 3.7.3.final.0

Statsmodels

Installed: 0.10.0 (C:\Anaconda\lib\site-packages\statsmodels)

Required Dependencies

cython: 0.29.11 (C:\Anaconda\lib\site-packages\Cython)
numpy: 1.16.4 (C:\Anaconda\lib\site-packages\numpy)
scipy: 1.2.1 (C:\Anaconda\lib\site-packages\scipy)
pandas: 0.24.2 (C:\Anaconda\lib\site-packages\pandas)
dateutil: 2.8.0 (C:\Anaconda\lib\site-packages\dateutil)
patsy: 0.5.1 (C:\Anaconda\lib\site-packages\patsy)

Optional Dependencies

matplotlib: 3.1.0 (C:\Anaconda\lib\site-packages\matplotlib)
backend: module://ipykernel.pylab.backend_inline
cvxopt: Not installed
joblib: 0.13.2 (C:\Anaconda\lib\site-packages\joblib)

Developer Tools

IPython: 7.6.1 (C:\Anaconda\lib\site-packages\IPython)
jinja2: 2.10.1 (C:\Anaconda\lib\site-packages\jinja2)
sphinx: 2.1.2 (C:\Anaconda\lib\site-packages\sphinx)
pygments: 2.4.2 (C:\Anaconda\lib\site-packages\pygments)
pytest: 5.0.0 (C:\Anaconda\lib\site-packages)
virtualenv: Not installed

Activity

  1. jbrockmendel commented on Jul 19, 2019

    @jbrockmendel
    Contributor

    Never mutatute the model. Will need a depreacation cycle, but worth it.

    Are you thinking of just patching ARMA to avoid attribute setting (which I'm +1 on regardless) or getting at the root of the problem with the constructor args/kwargs?

  2. bashtage commented on Jul 19, 2019

    @bashtage
    MemberAuthor

    Both, short term patch, but start deprecation for API change

  3. added 8 commits that reference this issue on Jul 23, 2019
    def8803
    8b401b1
    0cfaddc
    a600542
    ea4dfd2
    a4830b7
    0feb0fa
    ab0f955
  4. added this to the 0.11 milestone on Dec 18, 2019
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