Nothing
knitr::opts_chunk$set( comment = "#>", collapse = TRUE, out.width = "70%", fig.align = "center", fig.width = 6, fig.asp = .618 ) orig_opts <- options("digits") options(digits = 3) set.seed(1)
library(bvhar)
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$test
By specifying cov_spec = set_sv(),
var_bayes() and vhar_bayes() fits VAR-SV and VHAR-SV with shrinkage priors, respectively.
coef_specset_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()
(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"))
(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"))
(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"))
(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"))
autoplot() also provides Bayesian visualization. type = "trace" gives MCMC trace plot.
autoplot(fit_hs, type = "trace", regex_pars = "tau")
type = "dens" draws MCMC density plot.
autoplot(fit_hs, type = "dens", regex_pars = "tau")
options(orig_opts)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.