Skip to content

SARIMAXResultsWrapper.resid throws exception #2584

Closed

Description

@hxu

On version 0.7.0.dev0+6e66a5e, calling SARIMAXResultsWrapper.resid throws an exception here because it gets the resid method instance on the underlying results object, instead of actually calling the method and getting the ndarray. So result is a result in that line is a bound method, which of course doesn't have squeeze.

Activity

  1. ChadFulton commented on Aug 16, 2015

    @ChadFulton
    Member

    Thanks for the report! I can replicate. I'll get a patch together ASAP.

  2. ChadFulton commented on Aug 16, 2015

    @ChadFulton
    Member

    Type is major bug. Affects resid, fittedvalues, which are functions right now. They can't be assigned @cache_readonly because the various attach_dates wrapper functions don't appear (?) to allow > 1-dim data, and these are in general 2-dim objects for state space.

    I guess the quick fix will be to assign them as @cache_readonly and then change the wrapper behavior to None rather than 'dates'. Then I can fix the attach_dates wrapper.

  3. ChadFulton commented on Aug 16, 2015

    @ChadFulton
    Member

    Strange, we actually do have a unit test that tests both of these, as functions, and appears to have been passing.

  4. ChadFulton commented on Aug 16, 2015

    @ChadFulton
    Member

    Ah, of course, because the test was on a numpy array without dates, and it only tries to attach dates with Pandas or dates set.

  5. josef-pkt commented on Aug 16, 2015

    @josef-pkt
    Member

    Why are resid and fittedvalues 2d for univariate SARIMAX?

    IIUC, we will have to overwrite or generalize the wrapper somewhere creating a DataFrame instead of a series.
    (discrete.MNLogit should have 2d fittedvalues, but it doesn't have any special wrapper code that I can see.)

  6. ChadFulton commented on Aug 21, 2015

    @ChadFulton
    Member

    Why are resid and fittedvalues 2d for univariate SARIMAX?

    This was to maintain consistency with the State space wrapper, which is generic for multivariate models. But I suppose in the univariate cases we should squeeze that axis out.

  7. josef-pkt commented on Aug 21, 2015

    @josef-pkt
    Member

    If possible, then you should squeeze it. Especially for consistency with ARMA and other models.

    However, the code that @hxu linked to https://github.com/statsmodels/statsmodels/blob/master/statsmodels/base/data.py#L534 does inconsistent squeezing (should do it either also in the construction of the Series or not at all.)

  8. ChadFulton commented on Aug 21, 2015

    @ChadFulton
    Member

    The PR #2598 fixes this problem, and also fixes the inconsistent squeezing in attach_rows.

  9. bashtage commented on Jul 22, 2019

    @bashtage
    Member

    Closing as fixed in master.

  10. 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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions