marcopeix/TimeSeriesForecastingInPython

In CH9, "res.forecast" should be used instead of "res.get_predicted_mean"

Opened this issue · 0 comments

Ch9 does not seem to be doing a good job of predicting one period ahead.
Although the code is trying to forecast GDP one period ahead of the train data, it seems to be predicting the last value of train data.

To fulfill the objective, "res.forecast()" should be used instead of "res.get_predicted_mean()".

For example, in the definition of "recursive_forecast", instead of

predictions = res.get_prediction(exog=exog)
oos_pred = predictions.predicted_mean.iloc[-window:]
pred_SARIMAX.extend(oos_pred)

,

predictions = res.forecast(step = 1, exog=exog.iloc[i])
pred_SARIMAX.extend(predictions)

would be work.