Learn R Programming

APRScenario

This package is a stab implementing Structural scenario analysis with SVARs by Juan Antolín-Díaz, Ivan Petrella and Juan F. Rubio-Ramírez, JME (2021) in R

It depends on the output of the package bsvarSIGNs although it could be adapted to the output of many other packages by changing the function get_mats.R.

See the application code APRScenario.Rmd.

Installation

devtools::install_github("giannilmbd/APRScenario", ref = "master")

See also the forked bsvarSIGNs with parallelized draws of the rotation matrix

devtools::install_github("giannilmbd/bsvarSIGNs", ref = "master")

You can also download the tar.gz package from the tar-package branch and install in in R with

install.packages("<path>APRScenario_XXXX.tar.gz", repos = NULL, type = "source");

For XXXX see the latest version Use APRScenario.Rmd as a template for the application.

Feedbacks are welcome.

Copy Link

Version

Install

install.packages('APRScenario')

Monthly Downloads

545

Version

0.0.3.0

License

GPL (>= 3)

Maintainer

Giovanni Lombardo

Last Published

July 24th, 2025

Functions in APRScenario (0.0.3.0)

plot_cond_histo

plot_cond_histo function
scenarios

scenarios function (fully optimized with Rcpp) This function computes the mean and covariances to draw from the conditional forecast The actual draw is done in the simscen function
gen_mats

gen_mats function
forc_h

forc_h function
big_b_and_M

big_b_and_M This function returns the extended b and M matrices as in APR
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 # ##############################################################################
SimScen

simscen function This function takes the mean and covariance of the conditional forecast to draw from the conditional forecast distribution The shock uncertainty is included in the simulation by default, but can be turned off.
KL

KL function APR suggest this measure to assess the "plausibility" of the conditional forecast. It is based on the Kullback-Leibler measure of distance between the unconditional forecast and the conditional/scenario forecast.
plot_bvars

plot_bvars: This function plots the IRFs generated with the BVAR
full_scenarios_core

Exported version of full_scenarios_core
plot_cond_forc

plot_cond_forc function; Data should conatain the variable "variable", the "hor" horizon and a "history"
NKdata

Example Dataset NKdata
simulate_conditional_forecasts

Simulate paths from conditional forecast distributions