mat_forc: mat_forc function...

View source: R/mat_forc.r

mat_forcR Documentation

mat_forc function ############################################################################## NB: HERE WE USE Antolin-Diaz et al notation # B is reduced form; # A is structural; # d is intercepts # M is reduced so that E(uu')=Sigma=(A_0A_0')^(-1) and M_0=A_0^(-1)*Q # Note that the code returns conflicting notation: # B=>A_0^(-1)*Q and # A=>B # ##############################################################################

Description

mat_forc function ############################################################################## NB: HERE WE USE Antolin-Diaz et al notation # B is reduced form; # A is structural; # d is intercepts # M is reduced so that E(uu')=Sigma=(A_0A_0')^(-1) and M_0=A_0^(-1)*Q # Note that the code returns conflicting notation: # B=>A_0^(-1)*Q and # A=>B # ##############################################################################

Usage

mat_forc(
  h = 1,
  n_draws,
  n_var,
  n_p,
  data_ = NULL,
  matrices = NULL,
  max_cores = 1
)

Arguments

h

(integer) forecast horison

n_draws

(integer) Number of draws

n_var

(integer) Number of variables

n_p

(integer) Number of lags

data_

(matrix optional) The data, stacking Y over X (data and laggs) – columns are observations (default taken from matrices$Z) NB: this is not necessarily the same as the data used to estimate the model If run counterfactuals in previoius historical period (ie not forecast) must pass the data up to previous period relative to counterfactual

matrices

Optional matrices object from gen_mats() (default taken from calling environment)

max_cores

maximum number of cores to use for parallel processing (default: 1 for Windows compatibility)

Value

the big_b and big_M matrices of mean and IRF

Examples


library(APRScenario)
data(NKdata)

# Minimal example with a toy specification
spec <- bsvarSIGNs::specify_bsvarSIGN$new(as.matrix(NKdata[,2:4]), p = 1)
est <- bsvars::estimate(spec, S = 10)  # Use small S for fast test
matrices<-gen_mats(posterior = est, specification = spec)

# Example usage for matrix forecasting
result <- mat_forc(h = 4, n_draws = 10, n_var = 3, n_p = 1,
                   matrices = matrices)


APRScenario documentation built on Dec. 22, 2025, 1:06 a.m.