Learn R Programming

forecastHybrid (version 5.1.20)

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)

Value

List containing train and test indices for each fold

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

Author

Ganesh Krishnan

Examples

Run this code
tsPartition(AirPassengers, rolling = TRUE, windowSize = 10, maxHorizon = 2)

Run the code above in your browser using DataLab