Learn R Programming

APRScenario (version 0.0.3.0)

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

Value

the big_b and big_M matrices of mean and IRF

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)

Examples

Run this code
# \donttest{
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)
# }

Run the code above in your browser using DataLab