This function faciliates the forecasting approach in Ward et al.
2014. It forecasts the last num_ahead
points of the time series:
fit the model to all but the last num_ahead
time points
make 1-step ahead forecasts for the num_ahead
time points
forecast_iterated(fun, timeseries, num_ahead = 5, ...)
fun | a function for doing the forecasting. It should have arguments:
and should return a data.frame with at least the observed and predicted
values (with the column names |
---|---|
timeseries | the time series to forecast |
num_ahead | the number of points at the end of the time series to forecast |
... | arguments to pass to |
a data.frame of the observed and predicted values, with any other
remaining values returned by fun
. If any error occurs, then NA values for
the observed and predicted