etf <- etf_vix[1:55, 1:3]
# Split-------------------------------
h <- 5
etf_eval <- divide_ts(etf, h)
etf_train <- etf_eval$train
etf_test <- etf_eval$testBy specifying cov_spec = set_sv(),
var_bayes() and vhar_bayes() fits VAR-SV and
VHAR-SV with shrinkage priors, respectively.
coef_spec
set_bvar()set_bvhar() and
set_weight_bvhar()set_ssvs()set_horseshoe()set_ng()set_dl()sv_spec: prior settings for SV,
set_sv()intercept: prior for constant term,
set_intercept()set_sv()
#> Model Specification for SV with Cholesky Prior
#>
#> Parameters: Contemporaneous coefficients, State variance, Initial state
#> Prior: Cholesky
#> ========================================================
#> Setting for 'shape':
#> [1] rep(3, dim)
#>
#> Setting for 'scale':
#> [1] rep(0.01, dim)
#>
#> Setting for 'initial_mean':
#> [1] rep(1, dim)
#>
#> Setting for 'initial_prec':
#> [1] 0.1 * diag(dim)(fit_ssvs <- vhar_bayes(etf_train, num_chains = 2, num_iter = 20, coef_spec = set_ssvs(), cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun"))
#> Call:
#> vhar_bayes(y = etf_train, num_chains = 2, num_iter = 20, coef_spec = set_ssvs(),
#> cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun")
#>
#> BVHAR with Stochastic Volatility
#> Fitted by Gibbs sampling
#> Number of chains: 2
#> Total number of iteration: 20
#> Number of burn-in: 10
#> ====================================================
#>
#> Parameter Record:
#> # A draws_df: 10 iterations, 2 chains, and 177 variables
#> phi[1] phi[2] phi[3] phi[4] phi[5] phi[6] phi[7] phi[8]
#> 1 2.0378 -1.530 -0.4724 0.0931 0.5095 0.604 0.0211 0.4329
#> 2 0.1705 -0.800 -0.2281 -0.4403 2.9574 0.956 -0.1733 0.0617
#> 3 -0.3421 0.231 0.4953 -0.3483 -1.0906 0.743 -0.3380 0.3244
#> 4 -0.6871 -0.747 -1.1890 0.3063 -0.1388 0.391 0.6782 0.3690
#> 5 -0.5046 -0.267 0.6911 0.0282 -1.5456 0.350 1.3570 0.3457
#> 6 0.0193 -0.258 0.2529 0.0561 0.7598 0.663 0.0459 0.0450
#> 7 0.0958 -0.222 0.3133 0.3400 -0.7105 0.454 -0.0452 -0.0261
#> 8 -0.0914 -0.161 0.0668 0.7744 0.5555 0.240 0.4406 -0.0357
#> 9 0.2749 -0.271 -0.1832 0.5294 -0.0446 0.642 -0.1664 0.2108
#> 10 0.1279 -0.109 0.2152 0.5189 -0.4309 0.431 0.1078 -0.0215
#> # ... with 10 more draws, and 169 more variables
#> # ... hidden reserved variables {'.chain', '.iteration', '.draw'}(fit_hs <- vhar_bayes(etf_train, num_chains = 2, num_iter = 20, coef_spec = set_horseshoe(), cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun"))
#> Call:
#> vhar_bayes(y = etf_train, num_chains = 2, num_iter = 20, coef_spec = set_horseshoe(),
#> cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun")
#>
#> BVHAR with Stochastic Volatility
#> Fitted by Gibbs sampling
#> Number of chains: 2
#> Total number of iteration: 20
#> Number of burn-in: 10
#> ====================================================
#>
#> Parameter Record:
#> # A draws_df: 10 iterations, 2 chains, and 211 variables
#> phi[1] phi[2] phi[3] phi[4] phi[5] phi[6] phi[7]
#> 1 0.0809 -0.00752 -0.002071 3.51e-02 0.412 -0.0440 -0.267381
#> 2 0.2710 -0.02870 0.009239 -4.91e-02 0.265 0.0246 0.378291
#> 3 0.3025 -0.02276 -0.005333 -1.79e-01 0.467 0.0971 -0.243601
#> 4 0.2302 -0.06192 0.009454 6.92e-05 0.446 0.0162 -0.031784
#> 5 0.1937 -0.04257 -0.004123 -8.27e-02 0.413 0.0853 0.054823
#> 6 0.0257 -0.06237 0.001209 -3.02e-02 0.608 0.0963 -0.005127
#> 7 0.0432 -0.04532 0.002483 7.79e-02 0.329 0.2649 -0.013242
#> 8 0.0186 -0.03026 -0.000310 1.31e-02 0.855 0.3217 0.006336
#> 9 0.0516 -0.03846 0.000177 -6.36e-02 0.494 0.3535 0.005121
#> 10 -0.0325 -0.09304 -0.000295 7.51e-02 0.597 0.6762 0.000938
#> phi[8]
#> 1 0.0961
#> 2 -0.0105
#> 3 -0.0225
#> 4 -0.0450
#> 5 -0.0578
#> 6 -0.0048
#> 7 0.0981
#> 8 -0.2271
#> 9 -0.0901
#> 10 -0.1846
#> # ... with 10 more draws, and 203 more variables
#> # ... hidden reserved variables {'.chain', '.iteration', '.draw'}(fit_ng <- vhar_bayes(etf_train, num_chains = 2, num_iter = 20, coef_spec = set_ng(), cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun"))
#> Call:
#> vhar_bayes(y = etf_train, num_chains = 2, num_iter = 20, coef_spec = set_ng(),
#> cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun")
#>
#> BVHAR with Stochastic Volatility
#> Fitted by Metropolis-within-Gibbs
#> Number of chains: 2
#> Total number of iteration: 20
#> Number of burn-in: 10
#> ====================================================
#>
#> Parameter Record:
#> # A draws_df: 10 iterations, 2 chains, and 184 variables
#> phi[1] phi[2] phi[3] phi[4] phi[5] phi[6] phi[7] phi[8]
#> 1 0.0310 -0.236 0.047 0.0574 -0.43277 1.2385 1.2367 0.01190
#> 2 0.5393 -0.134 -0.667 0.4740 -0.31451 0.9378 0.5281 0.01768
#> 3 0.6390 0.293 1.239 0.4599 0.17510 0.0654 1.5424 0.05928
#> 4 0.1969 0.407 -0.331 0.3325 0.80415 0.1722 -0.0729 0.06570
#> 5 0.1418 0.310 0.575 -0.0406 -0.25316 0.1468 -0.1616 0.05086
#> 6 0.2203 0.217 -0.156 -0.0505 -0.64750 0.1343 -0.0137 -0.31815
#> 7 0.3093 0.184 -0.456 -0.4551 -0.22556 0.2007 -0.0573 0.22706
#> 8 0.0843 0.217 0.533 -0.0996 0.00243 0.1993 0.5314 -0.06193
#> 9 0.0696 0.244 -0.135 0.2670 -0.16850 0.2663 0.6235 0.00498
#> 10 0.1044 0.322 0.134 0.8611 -0.32209 0.2028 -0.4037 0.02880
#> # ... with 10 more draws, and 176 more variables
#> # ... hidden reserved variables {'.chain', '.iteration', '.draw'}(fit_dl <- vhar_bayes(etf_train, num_chains = 2, num_iter = 20, coef_spec = set_dl(), cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun"))
#> Call:
#> vhar_bayes(y = etf_train, num_chains = 2, num_iter = 20, coef_spec = set_dl(),
#> cov_spec = set_sv(), include_mean = FALSE, minnesota = "longrun")
#>
#> BVHAR with Stochastic Volatility
#> Fitted by Gibbs sampling
#> Number of chains: 2
#> Total number of iteration: 20
#> Number of burn-in: 10
#> ====================================================
#>
#> Parameter Record:
#> # A draws_df: 10 iterations, 2 chains, and 178 variables
#> phi[1] phi[2] phi[3] phi[4] phi[5] phi[6] phi[7]
#> 1 0.01572 2.43e-02 0.09985 0.452805 0.00257 0.966 -0.385
#> 2 0.01141 1.05e-02 0.09363 0.376325 0.00332 0.762 -0.857
#> 3 -0.02085 -4.18e-03 0.32863 0.420273 -0.01554 0.796 -0.569
#> 4 -0.05024 1.34e-03 0.45740 0.001273 -0.02070 0.867 -1.440
#> 5 0.02476 -6.36e-04 0.49315 0.001427 0.01904 0.939 -1.162
#> 6 0.02065 -4.09e-04 0.06319 0.000834 0.53319 0.899 -1.165
#> 7 -0.02311 -1.71e-03 -0.00409 -0.001295 0.77606 0.843 -1.230
#> 8 -0.00641 -1.91e-04 -0.01218 -0.000552 0.62804 0.858 -1.278
#> 9 -0.04667 -5.36e-05 -0.02396 -0.000157 0.58106 0.849 -1.473
#> 10 0.13723 2.86e-03 -0.00274 0.000346 0.14201 0.815 -1.168
#> phi[8]
#> 1 -0.00553
#> 2 0.00288
#> 3 0.02929
#> 4 -0.39449
#> 5 -0.18117
#> 6 -0.20312
#> 7 -0.21319
#> 8 -0.35838
#> 9 -0.33702
#> 10 -0.18744
#> # ... with 10 more draws, and 170 more variables
#> # ... hidden reserved variables {'.chain', '.iteration', '.draw'}