Preparation of nested time series follows a 3-Step Process:
Step 1: Extend the Time Series
extend_timeseries(): A wrapper for timetk::future_frame() that extends a time series
group-wise into the future.
The group column is specified by .id_var.
The date column is specified by .date_var.
The length into the future is specified with .length_future.
The ... are additional parameters that can be passed to timetk::future_frame()
Step 2: Nest the Time Series
nest_timeseries(): A helper for nesting your data into .actual_data and .future_data.
The group column is specified by .id_var
The .length_future defines the length of the .future_data.
The remaining data is converted to the .actual_data.
The .length_actual can be used to slice the .actual_data to a most recent number of observations.
The result is a "nested data frame".
Step 3: Split the Actual Data into Train/Test Splits
split_nested_timeseries(): A wrapper for timetk::time_series_split() that generates
training/testing splits from the .actual_data column.
The .length_test is the primary argument that identifies the size of the
testing sample. This is typically the same size as the .future_data.
The .length_train is an optional size of the training data.
The ... (dots) are additional arguments that can be passed to timetk::time_series_split().
Helpers
extract_nested_train_split() and extract_nested_test_split() are used to simplify extracting
the training and testing data from the actual data. This can be helpful when making
preprocessing recipes using the recipes package.