6
$\begingroup$

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.

$\endgroup$
1
  • 4
    $\begingroup$ What the documentation seems to say is that the only difference is that "forecast" is ONLY for predictions at the end of the data (out of sample), whereas "predict" returns predictions from any origin (either from within the sample, or at the end of it). There is definitely not any "extra handling of over-fitting", it seems to be just a question of supplying a more flexible/complicated interface versus a more limited but simpler interface. $\endgroup$
    – Chris Haug
    Commented Jul 29, 2020 at 15:14

1 Answer 1

3
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.