Skip to content

BUG VAR.predict is broken #4784

Closed
Closed

Description

@Freakwill

The following error says that TimeSeriesModel (super or super's super object) has no _get_predict_start. But VAR needs it. I only find _get_predict_index in TimeSeriesModel.

File "/Users/william/Folders/临时文件夹/script.py", line 17, in
print(results.model.predict(['2015']))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/statsmodels/tsa/vector_ar/var_model.py", line 535, in predict
start = self._get_predict_start(start, lags)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/statsmodels/tsa/vector_ar/var_model.py", line 529, in _get_predict_start
return super(VAR, self)._get_predict_start(start)
AttributeError: 'super' object has no attribute '_get_predict_start'

Activity

  1. added this to the 0.10 milestone on Jul 6, 2018
  2. Freakwill commented on Jul 6, 2018

    @Freakwill
    Author

    I think, just change one of them

  3. josef-pkt commented on Jul 6, 2018

    @josef-pkt
    Member

    @Freakwill Thanks for reporting. This is most likely a refactoring victim, and AFAICS, there is no test coverage for it.

    Note predict is a model method and the first argument is params. There is no corresponding results predict method for insample dynamic prediction. I only have seen the forecast method in use for VAR.
    We need a unit test case to check if the function has just been renamed or has now a incompatible behavior.

    You should be able to use VARMAX as workaround for dynamic insample prediction in a VAR model. VARMAXResults has predict and get_prediction and a dynamic keyword.

  4. changed the title [-]I find a bug[/-] [+]BUG VAR.predict is broken[/+] on Jul 6, 2018
  5. ChadFulton commented on Jul 6, 2018

    @ChadFulton
    Member

    Yes, unfortunately the use of the new date / time handling in 6c1f892#diff-e2d6024b9d0ed6c0410bf2fffc1f1254R342 was overridden subsequently. I can make a PR to replace the working behavior.

  6. ChadFulton commented on Jul 6, 2018

    @ChadFulton
    Member

    Fixed by #4785 along with another bug I happened to notice.

  7. realdtrump commented on Aug 20, 2018

    @realdtrump

    The bug has reappeared when trying to use predict method for VAR:
    AttributeError: 'super' object has no attribute '_get_predict_start'

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