error_wavmap: Forecast Error Mapping Wavelet Models

Description Usage Arguments Value See Also Examples

View source: R/wav_best.R

Description

error_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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
error_wavmap(
  x,
  df,
  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.

df

A data frame. The first column of the data frame must be the base variable for constructing the dependent variable, the multiperiod ahead value to be forecasted, x_{t + h}. If wav = TRUE, ncol of df can be equal to one (just the dependent variable), otherwise, ncol(df) must be greater than one, even if .var = "ar".

lags

An integer vector defining the lags of the regressors. If wav = FALSE, the length of the vector lags have to be the same as the number of columns in df. However, if wav = TRUE, an additional element in lags must be add such that the last element in the vector lags is the lag associatd with 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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
wavmap <- wavsigmap::map_wav_args(list(
wavelet = c("haar", "s8"),
thresh.fun = c("universal",  "adaptive")
))

error_wavmap(wavmap, df = inf[1],
             lags = c(1, 1),
             .H = 2, .K = 4)

error_wavmap(wavmap, df = gdp[1],
             lags = c(1, 1),
             .H = 2, .K = 4, .diff = TRUE) %>%
             dplyr::filter(dplyr::near(
             mean, min(mean, na.rm = TRUE)))

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