acpbvar

Bayesian estimation of asymmetric structural VARs in A-form, with Empirical-Bayes hyperparameter selection and sign-restriction identification.

Overview

acpbvar implements the asymmetric A-form representation of structural Vector Autoregressions following Chan (2022). The package combines

The package has no external dependencies beyond base R.

Installation

# install.packages("devtools")
devtools::install_github("ursillofederica/acpbvar", build_vignettes = TRUE)

Quick start

library(acpbvar)

# Simulate a small structural VAR with known sign pattern
sim <- simulate_var_example(T = 200, seed = 42)
Y   <- sim$Y

# Posterior simulation under the asymmetric A-form prior
mcmc <- post_sim(Y, p = 1L, R = 1000L)

# Sign restrictions: supply (y+, pi-), demand (y+, pi+), monetary (y-, pi-, r+)
S <- rbind(
    supply   = c( 1, -1,  0),
    demand   = c( 1,  1,  0),
    monetary = c(-1, -1,  1)
)

accepted <- sign_restrict(mcmc, S, n_id = 3L, max_tries = 1000L)

# Impulse responses
irfs <- collect_irfs(accepted, n = 3L, p = 1L, H = 12L)
plot_irfs(irfs,
          var_names   = sim$var_names,
          shock_names = sim$shock_names)

The vignette acpbvar_workflow documents the full workflow, including diagnostics and recovery of the true structural impact from the simulated data-generating process.

References

License

MIT © 2026 Federica Ursillo.