back_test: Out-of-sample prediction for whole period

Description Usage Arguments Value Examples

View source: R/back_test.R

Description

Out-of-sample prediction for whole period

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
back_test(
  n.lag = 1:52,
  s.window = 52,
  n.history = 700,
  stl = TRUE,
  n.training = 156,
  UseGoogle = T,
  alpha = 1,
  nPred = 0,
  discount = 0.015,
  sepL1 = F
)

Arguments

n.lag

the number of lags to be used as regressor in Stage 2 of PRISM (by default = 1:52 for weekly data)

s.window

seasonality span in seasonal decomposition (by default = 52 for weekly data)

n.history

length of training period (e.g. in weeks) for seasonal decomposition.

stl

if TRUE, use STL seasonal decomposition; if FALSE, use classic additive seasonal decomposition.

n.training

length of training period in Stage 2, penalized linear regression (by default = 156)

UseGoogle

boolean variable indicating whether to use Google Trend data.

alpha

penalty between lasso and ridge. alpha=1 represents lasso, alpha=0 represents ridge, alpha=NA represents no penalty (by default alpha = 1).

nPred

the number of periods ahead for forecast. nPred = 0,1,2,3.

discount

exponential weighting: (1-discount)^lag.

sepL1

if TRUE, use separate L1 regularization parameters for time series components and exogenous variables (Goolgle Trend data)

Value

prediction nPred week ahead prediction of the whole periods (07 - 20).

Examples

1
2
3
4
5
6
claim_data = load_claim_data()

# It may take a few minutes.
prism_prediction = back_test()
# evaluate the out-of-sample prediction error as a ratio to naive method
evaluation_table(claim_data, prism_prediction)

PRISM.forecast documentation built on Oct. 23, 2020, 7:34 p.m.