model_est: Estimate Direct Forecasting Model

View source: R/forecastOOP.R

model_estR Documentation

Estimate Direct Forecasting Model

Description

Given y and xreg, this function estimates a direct forecasting model as described below, in section "Details".

Usage

model_est(y, xreg, h, lags)

Arguments

y

A numeric vector or time series.

xreg

A numeric vector for the exogenous variable.

h

An integer. The horizon of prediction.

lags

A data frame generated by the function lags.

Details

Condiser the following regression:

  • y_{i,t+h} = a_0 + y_{i,t + 1 - pstart} + ... + y_{i,t + 1 - pend} + x_{i,t + 1 - qstart} + ... + x_{i,t + 1 - qend} + e_{i,t + h}.

model_est estimates the above regression for all indexes in the data frame lags (p_start \ge 1 and q_start \ge 1). Forecasting from a model with this structure is called direct forecast, where h denotes the horizon over which y is to be forecast. This approach can be used to forecast several steps ahead.

A measure of core inflation (\pi^*) should improve forecasting of headline inflation (\pi). A way of test this property is running a regression like that one above:

  • \pi_{t+h} = \alpha_0 + \sum_{i = 1}^p\beta_i\pi_{t-i+1} + \sum_{i = 1}^q\gamma_i\pi^*_{t-i+1} e_{t + h}.

Using recursive = FALSE (default) in function lags is equivalent to estimate the previous equation for headline inflation. If recursive = TRUE, i is not necessarily initiated in 1, i.e, p_start and q_start also changes in the first equation. Allowing p_start and q_start to vary, there are more models to be estimated because it opens up a lot of new possibilities.

Value

A list with following components:

model

A lm object.

n_obs

Number of observations of y.

h

The horizon from which y is being forecasted.

See Also

model_est_single model_fcast

Examples

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

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