train_test_index: train_test_index

View source: R/train_test_index.R

train_test_indexR Documentation

train_test_index

Description

Generate train/test indexes to train and evaluate the models using rolling-origin-update evaluation (ROUE).

Usage

train_test_index(
  X,
  n = NULL,
  date_start = NULL,
  date_end = NULL,
  horizon = 1,
  frequency = c("month", "quarter")
)

Arguments

X

A df/tibble containing the predictors.

n

A numeric indicating the size of the initial window. Cannot be used with date_start and date_end - if missing defaults to NULL.

date_start

A character indicating the starting date of the initial window. It must be of the form "YYYY-MM-01". Cannot be used with n

  • if missing defaults to NULL.

date_end

A character indicating the last date of the initial window. It must be of the form "YYYY-MM-01". Cannot be used with n

  • if missing defaults to NULL.

horizon

A integer indicating the number of consecutive values in test set sample - if missing defaults to 1.

frequency

A character indicating the date frequency. Must be one of "month or "quarter".

Details

Note: if X has non-consecutive dates, it is better to generate train/test indexes using n rather than date_start and date_end to avoid unexpected results.

Value

A list with 2 items: one for training indexes, one for test indexes.


aflatoune/approche-directe documentation built on May 30, 2022, 1:56 p.m.