model_error_wave | R Documentation |
model_error_wave
estimates the prediction error of models
fitted by the function model_est
when the x
variable
is a wavelet-based signal estimation of y
.
For each new observation k
included in the
out-of-sample set, the wavelet-based signal is reestimated.
This function supports
several specifications of wavelet models being a generalization
of model_error_wave_single
.
model_error_wave(x, y, h, lags, k, RMSE = TRUE)
x |
An object of class |
y |
A numeric vector or a time series for wavelet-based signal estimation. Headline inflation for estimation of a wavelet core inflation measure. |
h |
An integer to set the desired horizon. |
lags |
A data frame generated by the function |
k |
An integer to determine the number of observations to include in the out-of-sample set. |
RMSE |
logical: if |
A vector of errors for every wavelet model considered.
wav_smooth
, model_est
,
model_best
, model_fcast
wthr_wd <- list(
filter.number = 4,
type = c("wavelet", "station")
)
wthr_thr <- list(
type = c("soft", "hard"),
policy = c(
"universal",
"BayesThresh"
)
)
wthr_args <- wav_args_wthr(wthr_wd, wthr_thr, 4:5)
h <- 1:3
names(h) <- paste0("h", h)
pq <- lags(2, 1)
inf_head <- coreinf_br[["ipca"]]
# h = 2
model_error_wave(wthr_args, inf_head, h = 2, pq, 12, RMSE = TRUE)
# h = 1:3 (mean of the errors for each wavelet model estimated)
## Not run:
pred_wthr <- purrr::map_df(
h,
~ model_error_wave(wthr_args, inf_head, .x, pq, 12, RMSE = TRUE)
) %>%
dplyr::mutate(pred = purrr::possibly(rowMeans, NA)(.)) %>%
dplyr::select(pred)
pred_wthr
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.