bv_fcast: Forecast settings

View source: R/50_fcast_setup.R

bv_fcastR Documentation

Forecast settings

Description

Provide forecast settings to predict.bvar. Allows adjusting the horizon of forecasts, and for setting up conditional forecasts. See the Details section for further information.

Usage

bv_fcast(horizon = 12, cond_path = NULL, cond_vars = NULL)

Arguments

horizon

Integer scalar. Horizon for which to compute forecasts.

cond_path

Optional numeric vector or matrix used for conditional forecasts. Supply variable path(s) on which forecasts are conditioned on. Unrestricted future realisations should be filled with NA. Note that not all variables can be restricted at the same time.

cond_vars

Optional character or numeric vector. Used to subset cond_path to specific variable(s) via name or position. Not needed when cond_path is constructed for all variables.

Details

Conditional forecasts are calculated using the algorithm by Waggoner and Zha (1999). They are set up by imposing a path on selected variables.

Value

Returns a named list of class bv_fcast with options for bvar or predict.bvar.

References

Waggoner, D. F., & Zha, T. (1999). Conditional Forecasts in Dynamic Multivariate Models. Review of Economics and Statistics, 81:4, 639-651, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1162/003465399558508")}.

See Also

predict.bvar; plot.bvar_fcast

Examples

# Set forecast-horizon to 20 time periods for unconditional forecasts
bv_fcast(horizon = 20)

# Define a path for the second variable (in the initial six periods).
bv_fcast(cond_path = c(1, 1, 1, 1, 1, 1), cond_var = 2)

# Constrain the paths of the first and third variables.
paths <- matrix(NA, nrow = 10, ncol = 2)
paths[1:5, 1] <- 1
paths[1:10, 2] <- 2
bv_fcast(cond_path = paths, cond_var = c(1, 3))

BVAR documentation built on May 29, 2024, 5:34 a.m.