Skip to content

BUG: ARMAX dynamic insample predict with exog - wrong exog #2475

Closed

Description

@josef-pkt

I'm not able to replicate dynamic prediction with exog from Stata.

My impression is that the exog slice is wrong in dynamic prediction, or I still doen't understand this.

ARMA with dynamic=False agrees with Stata at several decimals

Activity

  1. josef-pkt commented on Jun 28, 2015

    @josef-pkt
    MemberAuthor

    @ChadFulton Do you have an example from SARIMAX, that would provide a test and comparison case for ARMAX versus SARIMAX?

  2. josef-pkt commented on Jun 28, 2015

    @josef-pkt
    MemberAuthor

    bug: if dynamic, then we need to use exog from the starting point.

    exog_f is exog from predict argument, name is reused for concatenated

            if dynamic:
                if self.k_exog > 0:
                    # need the last k_ar exog for the lag-polynomial
                    exog = np.vstack((self.exog[start-k_ar:, self.k_trend:], exog_f))
    

    now I get exactly the same dynamic prediction as Stata.

    problem: start is not available with date handling. In my example I use integer index directly

  3. josef-pkt commented on Jun 28, 2015

    @josef-pkt
    MemberAuthor

    all current tests still pass with the above change

  4. ChadFulton commented on Jun 28, 2015

    @ChadFulton
    Member

    If you still need this, I have a unit test against the Stata dynamic prediction for the Freidman example. In the test_sarimax.py file, the tests TestFriedmanPredict and TestFriedmanForecast cover both the dynamic and non-dynamic cases for prediction and forecasting.

  5. josef-pkt commented on Jun 28, 2015

    @josef-pkt
    MemberAuthor

    Thanks, I just finished a set of unit tests (and will push after dinner). I'm pretty confident it works now correctly for ARIMAX, but I haven't checked any forecast standard errors (neither Stata nor statsmodels).

    However, we should take advantage of cross-testing and reusing ARIMA/SARIMAX unit tests.

  6. added a commit that references this issue on Jun 28, 2015
    1d1cdeb
  7. added a commit that references this issue on Jul 4, 2015
    637a2ea
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions