The goal of VARS is to implement various VAR estimation and identification approaches, as well as inference tools.
- basic VAR model and VAR tools (IRF, FEVD, HDC)
- classic VAR, i.e. OLS estimation, IV and recursive identification, bootstrap
- bayesian VAR with (narrative) sign restrictions
- add test data and code to the R package
- add function and data documentation
You can install the development version of VARS from GitHub with:
# install.packages("pak")
pak::pak("GoldenBaozi/VARS")
This is a basic example which estimates a simple VAR and identify using Cholesky decomposition, using Stock and Watson (2001) data
library(VARS)
# load data
data(SW2001)
# initialize var model
var1 <- cVAR$new(data = SW2001, p.lag = 4)
# OLS estimation
var1$est()
# recursive identification with block bootstrap
var1$identify(method = "recursive", boot.method = "block")
# compute IRF
IRF.1 <- var1$tool("IRF", 20, 0.90)
# plot preparation
shock.names <- var.names <- c("unemp", "infl", "ffr")
IRFs <- list(IRF.1)
# plot IRF
IRF.plot(var1, IRFs, 20, shock.names, var.names)
Replication of Antolín-Díaz and Rubio-Ramírez (2018), figure 2
IRFs of global oil marketFor more results, see ./tests/testthat/