Skip to content

ARMAResult.predict insconsistency in 'end' paramter sm-0.5.0-10 #1857

Closed

Description

@lJoublanc

There is a really annoying inconsistency in the way ARMAResults.predict handles the end parameter in statsmodels 0.5.0-10 (from enthought distro).

If you pass pandas timestamps as the start and end paramters,

d  = pd.to_datetime("2014-07-15 08:32")
armaReg.predict(start=d,end=d + pd.to_timedelta(30,unit='m'),dynamic=True).plot(color="r")

you get an error:

C:\Users\xxx\local\Enthought\Canopy\User\lib\site-packages\statsmodels\tsa\base\tsa_model.pyc in _get_predict_end(self, end)
    201 
    202         elif freq is None: # should have a date with freq = None
--> 203             raise ValueError("When freq is None, you must give an integer "
    204                              "index for end.")
    205 

ValueError: When freq is None, you must give an integer index for end.

If instead you convert the end parameter to a string by calling __str__(), which is then parsed by statsmodels, it works fine.

Activity

  1. jseabold commented on Jul 31, 2014

    @jseabold
    Member

    Can you try it with current master? If it still doesn't work, PR would be welcome.

  2. lJoublanc commented on Jul 31, 2014

    @lJoublanc
    Author

    As it's part of the Enthought distribution, I can't really upgrade it until they release a new version. I'll let you know then...

  3. jseabold commented on Jul 31, 2014

    @jseabold
    Member

    If you can post a fully reproducible
    On Jul 31, 2014 11:36 AM, "lJoublanc" [email protected] wrote:

    As it's part of the Enthought distribution, I can't really upgrade it
    until they release a new version. I'll let you know then...

    If you can post a fully reproducible example that would be helpful.

  4. lJoublanc commented on Aug 10, 2014

    @lJoublanc
    Author

    Sorry for the delay; I'll try to do this sometime during this week. Have to do it from work so I need to make some time for that..

  5. jseabold commented on Oct 21, 2014

    @jseabold
    Member

    Wanted to check that this is solved. Can you post the example?

  6. added this to the 0.6 milestone on Oct 21, 2014
  7. jseabold commented on Oct 21, 2014

    @jseabold
    Member

    It's a different error now, but the result is the same. I suppose we can try harder here, but the main issue is that the Timestamp doesn't have any frequency associated with it when it's passed in.

    idx = pd.util.testing.getTimeSeriesData(nper=100, freq='T')['A'].index
    y = sm.tsa.arma_generate_sample([1, .75], [1, .25], nsample=100)
    y = pd.Series(y, index=idx)
    mod = sm.tsa.ARMA(y, (1, 1)).fit()
    d = pd.to_datetime('2000-01-01 01:38')
    mod.predict(start=d, end=d + pd.to_timedelta(30, unit='m'))
    

    I'll look at this for 0.6.1.

  8. josef-pkt commented on Feb 6, 2015

    @josef-pkt
    Member

    @jseabold This still has a 0.6 milestone.
    Is it still relevant? Do we push it to the 0.8 milestone?

  9. modified the milestones: 0.8, 0.6 on May 16, 2015
  10. bashtage commented on Aug 3, 2020

    @bashtage
    Member

    Fixed in master.

  11. modified the milestones: 0.8, 0.12 on Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions