recursive: Create a Recursive Time Series Model from a Parsnip or... In modeltime: The Tidymodels Extension for Time Series Modeling

Description

Create a Recursive Time Series Model from a Parsnip or Workflow Regression Model

Usage

 1 recursive(object, transform, train_tail, id = NULL, ...)

Arguments

 object An object of model_fit or a fitted workflow class transform A transformation performed on new_data after each step of recursive algorithm. Transformation Function: Must have one argument data (see examples) train_tail A tibble with tail of training data set. In most cases it'll be required to create some variables based on dependent variable. id (Optional) An identifier that can be provided to perform a panel forecast. A single quoted column name (e.g. id = "id"). ... Not currently used.

Details

What is a Recursive Model?

A recursive model uses predictions to generate new values for independent features. These features are typically lags used in autoregressive models. It's important to understand that a recursive model is only needed when the Lag Size < Forecast Horizon.

Why is Recursive needed for Autoregressive Models with Lag Size < Forecast Horizon?

When the lag length is less than the forecast horizon, a problem exists were missing values (NA) are generated in the future data. A solution that recursive() implements is to iteratively fill these missing values in with values generated from predictions.

Recursive Process

When producing forecast, the following steps are performed:

1. Computing forecast for first row of new data. The first row cannot contain NA in any required column.

2. Filling i-th place of the dependent variable column with already computed forecast.

3. Computing missing features for next step, based on already calculated prediction. These features are computed with on a tibble object made from binded train_tail (i.e. tail of training data set) and new_data (which is an argument of predict function).

4. Jumping into point 2., and repeating rest of steps till the for-loop is ended.

Recursion for Panel Data

Panel data is time series data with multiple groups identified by an ID column. The recursive() function can be used for Panel Data with the following modifications:

1. Supply an id column as a quoted column name

2. Replace tail() with panel_tail() to use tails for each time series group.

Value

An object with added recursive class