Learn R Programming

forecastHybrid (version 5.0.19)

tsPartition: Generate training and test indices for time series cross validation

Description

Training and test indices are generated for time series cross validation. Generated indices are based on the training windowSize, forecast horizons and whether a rolling or non-rolling cross validation procedure is desired.

Usage

tsPartition(x, rolling, windowSize, maxHorizon)

Arguments

x

A time series

rolling

Should indices be generated for a rolling or non-rolling procedure?

windowSize

Size of window for training

maxHorizon

Maximum forecast horizon

Value

List containing train and test indices for each fold

Examples

Run this code
# NOT RUN {
tsPartition(AirPassengers, rolling = TRUE, windowSize = 10, maxHorizon = 2)

# }

Run the code above in your browser using DataLab