model_error | R Documentation |
This function calculates the root mean square error or mean absolute error of
models estimated by the function model_fcast
. This function
is appropriate for forecasting evaluation of a
core inflation measure that is never revised.
model_error(k, y, xreg, lags, h, RMSE = TRUE)
k |
An integer to determine the number of observations to include in the out-of-sample set. |
y |
A numeric vector or time series of the dependet variable; tipplically the headline inflation. |
xreg |
A numeric vector or time series of the independent variable; a measure of core inflation that is never revised. |
lags |
A data frame generated by the function |
h |
An integer to set the desired horizon. |
RMSE |
Logical: if |
An integer contaning the calculated error.
model_est
, model_best
,
model_fcast
.
inf_head <- coreinf_br[["ipca"]]
inf_corems <- coreinf_br[["ipcams"]]
pq <- lags(2, 1)
model_error(24, inf_head, inf_corems, pq, 2, RMSE = TRUE)
purrr::map_dbl(1:12, ~ model_error(24, inf_head, inf_corems, pq, .x, RMSE = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.