Solved – Difference between forecasting and predicting in statsmodels SARIMAX

forecastingstatsmodelstime series

I am using SARIMAX model from the statsmodels library to predict(forecast) future values in a time-series.
The library contains four methods: predict(), get_predictions(), forecast(), get forecast(). I understand using the methods prefixed with "get_" allows for multistep predictions. But what is the difference between predicting and forecasting, in this library?

The documentation mentions that forecasting is more suitable for out-of-sample predictions, but would it be wrong to use it for in-sample ones as well? Does the predict function maybe contain some extra handling of over-fitting(which could be a problem when predicting in-sample)?

The results objects also contain two methods that all for both
in-sample fitted values and out-of-sample forecasting. They are
predict and get_prediction. The predict method only returns point
predictions (similar to forecast), while the get_prediction method
also returns additional results (similar to get_forecast).

In general, if your interest is out-of-sample forecasting, it is
easier to stick to the forecast and get_forecast methods.

Note my question is different to the question about the linguistic meaning of these two words.

Best Answer

All 4 are part of "standard" convention/pattern for prediction across all models, forecast is specific to tsa. So it depends on what you want.

  1. get_prediction is the most general and has extras like confidence or prediction intervals, and can be used in- and out-of-sample

  2. get_forecast is a special case of get_prediction restricted to out-of-sample prediction starting at the end of the sample period.

  3. predict, and forecast in tsa, are only supposed to compute the minimum to get and return the actual mean prediction. It should usually be faster if we don't need more as for example for cross-validation. But in statespace models there might not be much difference because it still needs to compute/predict the full state.

predict is analogue to the one in scikit-learn and returns only the predicted values (mean or expected value).

Source: https://github.com/statsmodels/statsmodels/issues/3687

Related Question