error_vin_wavmap: Forecast Error Mapping Wavelet Models for Vintages

Description Usage Arguments Value See Also Examples

View source: R/wav_best.R

Description

error_vin_wavmap is a functional that computes the root-mean-squared forecast error (RMSE) or mean absolute forecast error (MAE) of the direct forecast for several wavelet models using data vintages.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
error_vin_wavmap(
  x,
  .vin,
  lags,
  .H,
  .K,
  ic = BIC,
  .var = "all",
  .diff = FALSE,
  dev = "RMSE",
  xreg = NULL,
  ...
)

Arguments

x

A tibble returned by the function wavsigmap::map_wav_args.

.vin

List of data vintages (data frame) for each variable. The first vintage is related to the dependent variable and the number of columns of each data frame must be the same as the number of the out-of-sample forecasts (.K). The latest observation must be the last column of the data frame. If wav = TRUE, the length of the list can be one, otherwise, must be greater than one.

lags

A integer vector defining the lags of the regressors. If wav = FALSE, the length of the vector lags have to be the same as the length of .vin. However, if wav = TRUE, an additional element in lags must be add such that the last element in the vector lags is the lag of the wavelet regressor.

.H

An integer representing the maximum horizon step.

.K

An integer, the number of pseudo-out-of-sample forecasts.

ic

Information criterion, BIC or AIC. When searching for the best model the dataset is adjusted so that every model have the same data length for appropriate comparasion.

.var

A string to determine how the model will be specificated: "all" (default), "ar" or "ar_out".

.diff

Logical FALSE or TRUE. If TRUE, the dependent variable is differentiated. See wavdrcast-package for the implication on the model specification and wavelet variable.

dev

A string, "RMSE" or "MAE".

xreg

Data frame. Exogeunous variable not subjected to be lagged. The number of rows must be the same as in df.

...

Further arguments passed to wavsigmap::signal.

Value

A tibble containing wavelet options and mean of the forecast error.

See Also

wavsigmap::map_wav_args, wavsigmap::signal, error_vin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 set.seed(1)
v1 <- tibble::tibble(v1_t1 = c(sample(100, 98, replace = TRUE), NA, NA),
                     v1_t2 = c(v1_t1[1:98], 500, NA),
                     v1_t3 = c(v1_t2[1:99], 280))

wavmap <- wavsigmap::map_wav_args(list(
wavelet = c("haar", "s8"),
thresh.fun = c("universal",  "adaptive")
))

error_vin_wavmap(wavmap, .vin = list(v1),
lags = c(1, 1),
.H = 2, .K = 3)

nelson16silva/wavdrcast documentation built on April 25, 2021, 7:03 a.m.