You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
summary: if exog is longer than what is required for the prediction, then the first slice is used. According to Chad the last observation for this is incorrect.
However, if we want to forecast or predict with a later start, and we accidentally used the full exog, then we get incorrect prediction.
My suggestion is to raise a ValueError if exog has the incorrect length.
As alternative and more userfriendly, we could use the pandas index to find the correct slice of the exog that corresponds to start, end dates, if available.
update:#2472 fixed the incorrect last value, but doesn't raise or warn if exog is too long.
current behavior (after 2472)
If the exog is longer than necessary, then the first observations are used up to the required length. The remaining observations of exog are ignored.
I think this is independent of whether the exog is a pandas DataFrame that would have the matching index. I still think that this will be a "surprise" for many users.
I switched to a different example and now I also need mu[steps - 1]. Most likely I didn't understand what I was doing in the previous example.
Now, I'm comparing with Stata, and have agreement at print precision 8 digits (7 decimals) in predict. For a ARMA(1,0,1) in levels of loginv ~ loggdp + logcons with our datasets.macrodata
Activity
josef-pkt commentedon Jun 25, 2015
@jseabold Do you have an opinion on this and know where to fix it?
ChadFulton commentedon Jun 25, 2015
Right now SARIMAX raises a ValueError if exog is not the right shape. I suppose we should keep them in sync whatever the decision is.
josef-pkt commentedon Jun 25, 2015
@ChadFulton solution almost works, except
mu[steps - 2](I don't know why index is shiftedline 354
then I get exactly the same prediction with a correct length exog and an exog that has the same observations at the beginning of the array.
josef-pkt commentedon Jun 25, 2015
Doing this change, I get a test failure in the last predicted value in
@jseabold Do you remember where the "results_arima_exog_forecasts_mle.csv" values come from?
ChadFulton commentedon Jun 25, 2015
For me, it only works with steps - 1.
josef-pkt commentedon Jun 27, 2015
I switched to a different example and now I also need
mu[steps - 1]. Most likely I didn't understand what I was doing in the previous example.Now, I'm comparing with Stata, and have agreement at print precision 8 digits (7 decimals) in predict. For a ARMA(1,0,1) in levels of loginv ~ loggdp + logcons with our datasets.macrodata
BUG: fix predict with exog for last observation see statsmodels#2472
josef-pkt commentedon Jun 29, 2015
still open but not prio-high and something to look into for 0.8
BUG: fix predict with exog for last observation see statsmodels#2472
BUG/ENH: Check exog in ARMA and ARIMA predict