Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/bsvars/bsvarSIGNs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwang15 committed Jul 18, 2024
2 parents 327ccd4 + 2488463 commit 31a7fe0
Show file tree
Hide file tree
Showing 9 changed files with 452 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
^bsvarSIGNs\.Rproj$
^\.Rproj\.user$
^/inst/varia$
^_pkgdown\.yml$
^docs$
^pkgdown$
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ rsconnect/
.DS_Store
.quarto
*.so
docs
6 changes: 4 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Type: Package
Title: Bayesian Estimation of Structural Vector Autoregressions Identified by Sign, Zero, and Narrative Restrictions
Version: 0.1.9000
Date: 2024-01-11
Authors@R: c(person("Xiaolei", "Wang", , "adamwang15@gmail.com", role = c("aut", "cre")),person("Tomasz", "Woźniak", , "wozniak.tom@pm.me", role = c("aut"), comment = c(ORCID = "0000-0003-2212-2378")))
Authors@R: c(person("Xiaolei", "Wang", , "adamwang15@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0009-0005-6192-9061")),person("Tomasz", "Woźniak", , "wozniak.tom@pm.me", role = c("aut"), comment = c(ORCID = "0000-0003-2212-2378")))
Maintainer: Xiaolei Wang <adamwang15@gmail.com>
Description: Implements state-of-the-art algorithms for the Bayesian analysis of Structural Vector Autoregressions identified by sign, zero, and narrative restrictions. The core model is based on the flexible Vector Autoregression with the estimated hyper-parameters of the Minnesota prior as in Giannone, Lenza, Primiceri (2015) <doi:10.1162/REST_a_00483>. The sign restrictions are implemented employing the methods outlined by Rubio-Ramírez, Waggoner & Zha (2010) <doi:10.1111/j.1467-937X.2009.00578.x>, while identification through sign and zero restrictions follows the approach developed by Arias, Rubio-Ramírez, & Waggoner (2018) <doi:10.3982/ECTA14468>. Furthermore, our tool provides algorithms for identification via sign and narrative restrictions, in line with the methods introduced by Antolín-Díaz and Rubio-Ramírez (2018) <doi:10.1257/aer.20161852>. Users can also estimate a model with sign, zero, and narrative restrictions imposed at once. The package facilitates predictive and structural analyses using impulse responses, forecast error variance and historical decompositions, forecasting and conditional forecasting, as well as analyses of structural shocks and fitted values. All this is complemented by colourful plots, user-friendly summary functions, and comprehensive documentation. The `bsvarSIGNs` package is aligned regarding code structure, objects, and workflows with the R package 'bsvars' by Woźniak (2024) <doi:10.32614/CRAN.package.bsvars>, and they constitute an integrated toolset.
Description: Implements state-of-the-art algorithms for the Bayesian analysis of Structural Vector Autoregressions identified by sign, zero, and narrative restrictions. The core model is based on a flexible Vector Autoregression with estimated hyper-parameters of the Minnesota prior as in Giannone, Lenza, Primiceri (2015) <doi:10.1162/REST_a_00483>. The sign restrictions are implemented employing the methods proposed by Rubio-Ramírez, Waggoner & Zha (2010) <doi:10.1111/j.1467-937X.2009.00578.x>, while identification through sign and zero restrictions follows the approach developed by Arias, Rubio-Ramírez, & Waggoner (2018) <doi:10.3982/ECTA14468>. Furthermore, our tool provides algorithms for identification via sign and narrative restrictions, in line with the methods introduced by Antolín-Díaz and Rubio-Ramírez (2018) <doi:10.1257/aer.20161852>. Users can also estimate a model with sign, zero, and narrative restrictions imposed at once. The package facilitates predictive and structural analyses using impulse responses, forecast error variance and historical decompositions, forecasting and conditional forecasting, as well as analyses of structural shocks and fitted values. All this is complemented by colourful plots, user-friendly summary functions, and comprehensive documentation. The `bsvarSIGNs` package is aligned regarding objects, workflows, and code structure with the R package 'bsvars' by Woźniak (2024) <doi:10.32614/CRAN.package.bsvars>, and they constitute an integrated toolset.
License: GPL (>= 3)
Imports:
R6,
Expand All @@ -21,6 +21,8 @@ Depends:
R (>= 2.10),
bsvars
Suggests: tinytest
URL: https://bsvars.github.io/bsvarSIGNs/
BugReports: https://github.com/bsvars/bsvarSIGNs/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.2
29 changes: 18 additions & 11 deletions R/bsvarSIGNs-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#'
#' @description Implements state-of-the-art algorithms for the Bayesian analysis
#' of Structural Vector Autoregressions identified by sign, zero, and narrative
#' restrictions. The core model is based on the flexible Vector Autoregression
#' with the estimated hyper-parameters of the Minnesota prior as in
#' restrictions. The core model is based on a flexible Vector Autoregression with
#' estimated hyper-parameters of the Minnesota prior as in
#' Giannone, Lenza, Primiceri (2015) <doi:10.1162/REST_a_00483>. The sign
#' restrictions are implemented employing the methods outlined by
#' restrictions are implemented employing the methods proposed by
#' Rubio-Ramírez, Waggoner & Zha (2010) <doi:10.1111/j.1467-937X.2009.00578.x>,
#' while identification through sign and zero restrictions follows the approach
#' developed by Arias, Rubio-Ramírez, & Waggoner (2018) <doi:10.3982/ECTA14468>.
Expand All @@ -40,8 +40,8 @@
#' forecasting and conditional forecasting, as well as analyses of structural
#' shocks and fitted values. All this is complemented by colourful plots,
#' user-friendly summary functions, and comprehensive documentation. The
#' `bsvarSIGNs` package is aligned regarding code structure, objects, and
#' workflows with the R package 'bsvars' by
#' `bsvarSIGNs` package is aligned regarding objects, workflows, and code
#' structure with the R package 'bsvars' by
#' Woźniak (2024) <doi:10.32614/CRAN.package.bsvars>, and they constitute an
#' integrated toolset.
#'
Expand Down Expand Up @@ -127,17 +127,24 @@
#' Woźniak (2024) bsvars: Bayesian Estimation of Structural Vector Autoregressive Models. R package version 3.1, <doi:10.32614/CRAN.package.bsvars>.
#'
#' @examples
#' # specify sign and zero restrictions on the impulse response
#' # investigate the effects of the optimism shock
#' data(optimism)
#'
#' # specify identifying restrictions:
#' # + no effect on productivity (zero restriction)
#' # + positive effect on stock prices (positive sign restriction)
#' sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5)
#'
#' # specify the model
#' spec = specify_bsvarSIGN$new(optimism * 100,
#' specification = specify_bsvarSIGN$new(optimism * 100,
#' p = 4,
#' sign_irf = sign_irf)
#'
#' # estimate the model
#' posterior = estimate(specification, S = 100)
#'
#' # estimate the hyper-parameters
#' spec$prior$estimate_hyper()
#' # compute and plot impulse responses
#' irf = compute_impulse_responses(posterior, horizon = 40)
#' plot(irf, probability = 0.68)
#'
#' # estimate the model
#' post = estimate(spec, S = 1000)
NULL
Loading

0 comments on commit 31a7fe0

Please sign in to comment.