model_error_wave_single: Error Prediction for Single Wavelet Model

model_error_wave_singleR Documentation

Error Prediction for Single Wavelet Model

Description

model_error_wave_single estimates the prediction error of models fitted by the function model_est when the x variable is y smoothed by wavelet models. For each new observation k inlucluded in the out-of-sample set, the wavelet-based signal is reestimated. This function computes the prediction error for a single wavelet specification and therefore is similar to model_error_wave that is used for computing the error for several specifications of wavelet models.

Usage

model_error_wave_single(k, y, lags, h, RMSE = TRUE, ...)

Arguments

k

An integer to determine the number of observations to include in the out-of-sample set.

y

A numeric vector or a time series for wavelet-based signal estimation. Headline inflation for estimation of a wavelet core inflation measure.

lags

A data frame generated by the function lags.

h

An integer to set the desired horizon.

RMSE

logical: if TRUE returns RMSE, if FALSE returns MAE.

...

Additional parameters to pass to function smooth_wavelet.

Value

A numeric vector of length one.

See Also

smooth_wavelet, model_error_wave, model_fcast, model_best, model_est

Examples

inf_head <- coreinf_br[["ipca"]]
pq <- lags(2, 1)

# h = 2
model_error_wave_single(
36, inf_head, pq, 2, RMSE = FALSE,
thfun = ebayesthresh.wavelet,
wtfun = "dwt",
wtfunlist = list(wf = "d6", n.levels = 4),
a = 0.5, vscale = "level", prior = "cauchy")

# h = 1:6; k = 20

purrr::map_dbl(1:6, ~ model_error_wave_single(
20, inf_head, pq, .x, RMSE = FALSE,
thfun = ebayesthresh.wavelet,
wtfun = "dwt",
wtfunlist = list(wf = "d6", n.levels = 4),
a = 0.5, vscale = "level", prior = "cauchy"))

nelson16silva/wavcoreinf documentation built on Feb. 17, 2025, 7:10 p.m.