select_model_hmnc: Select the optimal Harmonic Regression Model

Description Usage Arguments Value Examples

View source: R/select_model_hmnc.R

Description

double seasonal harmonic regression is implemented. If grid.search = TRUE, grid search is applied by searching the number of Fourier terms for yearly seasonality. search.length and length.out are for grid search. The search is based on the minimum mean absolute percentage error with parallel computing. More details about parallel computing can be found in doParallel.

Usage

1
2
3
4
5
6
7
8
9
select_model_hmnc(
  train.y,
  valid.y = NULL,
  s1 = 7,
  s2 = 365.25,
  grid.search = FALSE,
  search.length = c(20, 40),
  length.out = 5
)

Arguments

train.y

A numeric vector for training.

valid.y

A numeric vector for validating If grid.search = FALSE, valid.y = NULL.

s1

Period of the shorter seasonal period.

s2

Period of the longer seasonal period.

grid.search

If TRUE, a grid search is applied.

search.length

Grid search parameter. Only used if grid.search = TRUE. It is the range of the number of the Fourier term of yearly seasonality.

length.out

Grid search parameter. Only used if grid.search = TRUE. It is the desired length of search sequence.

Value

A list contains:

Examples

1
2
3
4
5
data(tickets)
data.ls = train_test_split(tickets, var = "date", train.window = c(20140701, 20180630), test.window = c(20180701, 20190630))
train.y = data.ls$train.dat[,2]
valid.y = data.ls$test.dat[,2]
select.ls = select_model_hmnc(train.y, valid.y, grid.search = TRUE, length.out = 5)

placeboo/amplify documentation built on Oct. 6, 2020, 9:04 a.m.