forked from bsvars/bsvars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
76 lines (53 loc) · 2.45 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# bsvars
Bayesian Estimation of Structural Vector Autoregressive Models
This package provides efficient algorithms for Bayesian estimation of Structural Vector Autoregressive (SVAR) models via Markov chain Monte Carlo methods. A wide range of SVAR models is considered, including homo- and heteroskedastic specifications and those with non-normal structural shocks.
# Installation
Just open your **R** and type:
```
install.packages("bsvars")
```
The package is under intensive development. To the the newest changes install it by typing:
```
devtools::install_git("https://github.com/donotdespair/bsvars.git")
```
# Start your Bayesian analysis of data
The beginnings are as easy as ABC:
```{r, eval=FALSE, echo=TRUE}
# upload the package
library(bsvars)
# upload data
data(us_fiscal_lsuw)
# specify the model and set seed
specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4)
set.seed(123)
# run the burn-in
burn_in = estimate_bsvar_sv(1000, specification)
# estimate the model
posterior = estimate_bsvar_sv(50000, burn_in$get_last_draw(), thin = 10)
# normalise the posterior
BB = posterior$last_draw$starting_values$B # get the last draw of B
B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements
normalise_posterior(posterior, B_hat) # draws in posterior are normalised
# Now, you're ready to analyse your model!
```
# Progress bar
MCMCs for multivariate dynamic structural models might take a while to run. **bsvars** relies on efficient algorithms and fast codes developed using **cpp** code via **Rcpp** and **RcppArmadillo** packages to cut the time of computations by orders of magnitude. Still, while waiting these a few minutes, you can track the progress by looking at the beautiful progress bar:
![bsvars::progress_bar](inst/varia/progress.png)
## License
This package is distributed under license GPL (>= 3)
Copyright `r knitr::asis_output("\U00A9")` 2022 Tomasz Woźniak (email: <[email protected]>)
<!-- badges: start -->
[![R-CMD-check](https://github.com/donotdespair/bsvars/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/donotdespair/bsvars/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->