forecast_iterated: Iterated one-step forecasting (no refitting)

Description Usage Arguments Value

View source: R/utils-forecasting.R

Description

This function faciliates the forecasting approach in Ward et al. 2014. It forecasts the last num_ahead points of the time series:

  1. fit the model to all but the last num_ahead time points

  2. make 1-step ahead forecasts for the num_ahead time points

Usage

1
forecast_iterated(fun, timeseries, num_ahead = 5, ...)

Arguments

fun

a function for doing the forecasting. It should have arguments:

training

the data for training the model

observed

the observed values to be forecasted

...

any optional arguments

and should return a data.frame with at least the observed and predicted values (with the column names observed and predicted). Other columns are optional, and may be specific to the forecasting method)

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 fun

Value

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


weecology/MATSS-forecasting documentation built on Nov. 28, 2020, 10:19 a.m.