Discussion:
[pystatsmodels] Different methods for predictions
Georgios Boumis
2018-11-17 15:17:37 UTC
Permalink
I want to make out of sample forecasts and I stumbled upon different ways
like get_prediction, predict() and forecast() but I do not understand the
difference between them. By the way, only predict() seems to work for me
because using the other two I get nothing as output.
Chad Fulton
2018-11-17 16:36:23 UTC
Permalink
Post by Georgios Boumis
I want to make out of sample forecasts and I stumbled upon different ways
like get_prediction, predict() and forecast() but I do not understand the
difference between them.
- get_prediction is the most general method, and can accomodate both
in-sample prediction and out-of-sample forecasting. It returns a
PredictionResults object that includes both the predicted mean and
confidence intervals.
- predict is a wrapper around get_prediction that simply returns the
predicted mean instead of the PredictionResults object, but still allows
both in-sample prediction and out-of-sample forecasting
- forecast is a convenience method, that makes it easy to do forecasting
starting at the end of the sample. Whereas get_prediction and predict both
accept `start` and `end` arguments, forecast just accepts a `steps`
argument, which can be an integer number of steps to forecast or a date to
produce forecasts up to. Like predict, it only returns the predicted mean.

By the way, only predict() seems to work for me because using the other two
Post by Georgios Boumis
I get nothing as output.
I don't know what to tell you about this, as I've never seen anything like
that. You could file a bug report if you feel like its not working properly.

Best,
Chad
j***@gmail.com
2018-11-17 17:57:42 UTC
Permalink
I want to make out of sample forecasts and I stumbled upon different ways like get_prediction, predict() and forecast() but I do not understand the difference between them.
- get_prediction is the most general method, and can accomodate both in-sample prediction and out-of-sample forecasting. It returns a PredictionResults object that includes both the predicted mean and confidence intervals.
- predict is a wrapper around get_prediction that simply returns the predicted mean instead of the PredictionResults object, but still allows both in-sample prediction and out-of-sample forecasting
That predict and get_prediction do essentially the same computation is
specific to statespace models.
More generally, predict should do just the minimal work to get the
predicted/expected value so it is relatively efficient for
cross-validation and similar.
Also predict (at default options) should have consistent
interpretation across models, while get_prediction can have additional
model specific return attributes.
Not all models follow this pattern yet, we only settled a few years
ago on the distinction between predict and get_prediction.
- forecast is a convenience method, that makes it easy to do forecasting starting at the end of the sample. Whereas get_prediction and predict both accept `start` and `end` arguments, forecast just accepts a `steps` argument, which can be an integer number of steps to forecast or a date to produce forecasts up to. Like predict, it only returns the predicted mean.
By the way, only predict() seems to work for me because using the other two I get nothing as output.
I don't know what to tell you about this, as I've never seen anything like that. You could file a bug report if you feel like its not working properly.
Best,
Chad
Georgios Boumis
2018-11-17 20:29:49 UTC
Permalink
Thank you very much for your replies... I really enjoy digging more into to
statsmodels.tsa
Post by Chad Fulton
Post by Georgios Boumis
I want to make out of sample forecasts and I stumbled upon different
ways like get_prediction, predict() and forecast() but I do not understand
the difference between them.
Post by Chad Fulton
- get_prediction is the most general method, and can accomodate both
in-sample prediction and out-of-sample forecasting. It returns a
PredictionResults object that includes both the predicted mean and
confidence intervals.
Post by Chad Fulton
- predict is a wrapper around get_prediction that simply returns the
predicted mean instead of the PredictionResults object, but still allows
both in-sample prediction and out-of-sample forecasting
That predict and get_prediction do essentially the same computation is
specific to statespace models.
More generally, predict should do just the minimal work to get the
predicted/expected value so it is relatively efficient for
cross-validation and similar.
Also predict (at default options) should have consistent
interpretation across models, while get_prediction can have additional
model specific return attributes.
Not all models follow this pattern yet, we only settled a few years
ago on the distinction between predict and get_prediction.
Post by Chad Fulton
- forecast is a convenience method, that makes it easy to do forecasting
starting at the end of the sample. Whereas get_prediction and predict both
accept `start` and `end` arguments, forecast just accepts a `steps`
argument, which can be an integer number of steps to forecast or a date to
produce forecasts up to. Like predict, it only returns the predicted mean.
Post by Chad Fulton
Post by Georgios Boumis
By the way, only predict() seems to work for me because using the other
two I get nothing as output.
Post by Chad Fulton
I don't know what to tell you about this, as I've never seen anything
like that. You could file a bug report if you feel like its not working
properly.
Post by Chad Fulton
Best,
Chad
Continue reading on narkive:
Loading...