Skip to content

Commit

Permalink
MAINT: Standrdized forecast API
Browse files Browse the repository at this point in the history
Standardize API to match statespace
  • Loading branch information
bashtage committed Jul 30, 2020
1 parent 601f1bc commit f2d1787
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions statsmodels/tsa/ar_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,9 @@ def predict(
Returns
-------
array_like
predictions : {ndarray, Series}
Array of out of in-sample predictions and / or out-of-sample
forecasts. An (npredict x k_endog) array.
forecasts.
"""
params = array_like(params, "params")
exog = array_like(exog, "exog", ndim=2, optional=True)
Expand Down Expand Up @@ -2248,7 +2248,7 @@ def get_prediction(

return PredictionResults(mean, mean_var)

def forecast(self, steps=1, dynamic=False, exog=None):
def forecast(self, steps=1, exog=None):
"""
Out-of-sample forecasts
Expand All @@ -2259,23 +2259,15 @@ def forecast(self, steps=1, dynamic=False, exog=None):
sample. Can also be a date string to parse or a datetime type.
However, if the dates index does not have a fixed frequency,
steps must be an integer.
dynamic : {bool, int, str, datetime, Timestamp}, optional
Integer offset relative to `start` at which to begin dynamic
prediction. Prior to this observation, true endogenous values
will be used for prediction; starting with this observation and
continuing through the end of prediction, forecasted endogenous
values will be used instead. Datetime-like objects are not
interpreted as offsets. They are instead used to find the index
location of `dynamic` which is then used to to compute the offset.
exog : array_like
exog : {ndarray, Series}
A replacement exogenous array. Must have the same shape as the
exogenous data array used when the model was created.
Returns
-------
array_like
Array of out of in-sample predictions and / or out-of-sample
forecasts. An (npredict x k_endog) array.
forecasts.
See Also
--------
Expand All @@ -2288,7 +2280,7 @@ def forecast(self, steps=1, dynamic=False, exog=None):
else:
end = steps
return self.predict(
start=start, end=end, dynamic=dynamic, exog_oos=exog
start=start, end=end, dynamic=False, exog_oos=exog
)

@Substitution(predict_params=_predict_params)
Expand Down

0 comments on commit f2d1787

Please sign in to comment.