error: Forecast Error of the Direct Forecast

Description Usage Arguments Details Value See Also Examples

View source: R/error.R

Description

Compute the root-mean-squared forecast error (RMSE) or mean absolute forecast error (MAE) of direct forecast OLS method for forecasting.

Usage

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

Arguments

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

wav

Logical. If TRUE, a wavelet-based signal is add to df, where the signal is related to the explained variable, the first column of df.

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.

Details

See wavdrcast-package and model.

Value

A double vector with forecasts error (RMSE or MAE) from 1 to .H step-ahead.

See Also

model, fcast

Examples

1
2
3
4
5
6
7
8
9
cpi <- inf[1]
error(df = cpi,
lags = c(1, 1), .H = 2, .K = 8,
wav = TRUE, wt = "modwt", a = 1)

lgdp <- gdp[1]
error(df = lgdp,
lags = c(1, 1), .H = 2, .K = 8,
wav = TRUE, .diff = TRUE, wt = "modwt", a = 1)

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