model_error: Error Prediction Two Variables

model_errorR Documentation

Error Prediction Two Variables

Description

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.

Usage

model_error(k, y, xreg, 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 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 lags.

h

An integer to set the desired horizon.

RMSE

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

Value

An integer contaning the calculated error.

See Also

model_est, model_best, model_fcast.

Examples

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))

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