crossv_ts: Generate test/train sets for time-series

Description Usage Arguments Details References

View source: R/crossv_ts.R

Description

Generate test/train sets for time series. Each training set consists of observations before the test set. This method also called "evaluation on a rolling forecasting origin".

Usage

1
2
3
crossv_ts(n, horizon = 1L, test_size = 1L, test_partial = FALSE,
  train_partial = TRUE, train_size = n, test_start = NULL, from = 1L,
  to = n, by = 1L)

Arguments

n

A positive, scalar integer representing the number of observations (items to choose from).

horizon

Difference between the first test set observation and the last training set observation

test_size

A scalar integer indicating the size of the test set.

test_partial, train_partial

A logical scalar or positive scalar integer which handles how partial test (train) sets are handled. If TRUE, then partial test (train) sets are allowed. If FALSE, then partial test (train) sets are not allowed. If it is an integer, then it is the minimum allowable size of a test (train) set.

train_size

The maximum size of the training set. This allows for a rolling window training set, instead of using all observations from the start of the time series.

test_start

An integer vector of the starting index values of the test set.

from, to, by

Integer scalar values used to generate values of test_start if test_start = NULL. In that case, test_start = seq(from, to, by).

Details

In time-series cross-validation the training set only uses observations that are prior to the test set. Suppose the time series has n observations, the training set has a maximum size of r <= n and minimum size of s >= r. and the test set has a maximum size of p <= n and minimum size of q >= p.

For indices i in {1, …, N}:

References


jrnold/ramsleep documentation built on May 29, 2019, 11:43 a.m.