cv_baselines: Cross validated prediction and evaluation with baseline...

Description Usage Arguments Value Cross validation settings Examples

View source: R/cv_baselines.R

Description

Get results for the following simple forecasting methods:

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cv_baselines(
  data,
  cv_setting,
  col_id = NULL,
  col_date = "index",
  col_value = "value",
  transform = NULL,
  frequency = 4,
  h = NULL
)

Arguments

data

Univariate time series (data.frame)

cv_setting

cross validation settings. Named list requiring periods_train, periods_val periods_test and skip_span. See section "Cross validation settings" for details.

col_id

Optional ID column in data, default to "ticker"

col_date

Date column in data, default to "index"

col_value

Value column in data, default to "value"

transform

Transform data before estimation? One of NULL (default) and "normalize"

frequency

time series frequency, e.g. 4 for quarters and 12 for months

h

NULL if forecast horizon equals cv_setting$n_test, else named list of forecast horizons for accuracy measures

Value

list of type (model), h (forecast horizon, if specified), mape, smape, mase, smis and acd

Cross validation settings

Using rolling_origin to split the time series. Requiring:

Note: periods_val only relevant for deep learning models. cv_baselines and cv_arima use sum of periods_train and periods_val for training and only periods_test as hold-out test set (no learning and feedback through validation by traditional statistical models)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cv_setting <- list(
  periods_train = 90,
  periods_val = 10,
  periods_test = 10,
  skip_span = 5
)

fc_01 <- cv_baselines(
  data = tsRNN::DT_apple,
  cv_setting = cv_setting
)
fc_01

# Multiple forecast horizons
## Not run: 
fc_02 <- cv_baselines(
  data = tsRNN::DT_apple,
  cv_setting = cv_setting,
  h = list(short = 1:2, long = 3:6)
)
fc_02

## End(Not run)

thfuchs/tsRNN documentation built on April 17, 2021, 11:03 p.m.