bvhar_ssvs {bvhar} | R Documentation |
Fitting Bayesian VHAR of SSVS Prior
Description
This function fits BVAR(p) with stochastic search variable selection (SSVS) prior.
Usage
bvhar_ssvs(
y,
har = c(5, 22),
num_chains = 1,
num_iter = 1000,
num_burn = floor(num_iter/2),
thinning = 1,
bayes_spec = choose_ssvs(y = y, ord = har, type = "VHAR", param = c(0.1, 10),
include_mean = include_mean, gamma_param = c(0.01, 0.01), mean_non = 0, sd_non = 0.1),
init_spec = init_ssvs(type = "auto"),
include_mean = TRUE,
minnesota = c("no", "short", "longrun"),
verbose = FALSE,
num_thread = 1
)
## S3 method for class 'bvharssvs'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'bvharssvs'
knit_print(x, ...)
Arguments
y |
Time series data of which columns indicate the variables |
har |
Numeric vector for weekly and monthly order. By default, |
num_chains |
Number of MCMC chains |
num_iter |
MCMC iteration number |
num_burn |
Number of warm-up (burn-in). Half of the iteration is the default choice. |
thinning |
Thinning every thinning-th iteration |
bayes_spec |
A SSVS model specification by |
init_spec |
SSVS initialization specification by |
include_mean |
Add constant term (Default: |
minnesota |
Apply cross-variable shrinkage structure (Minnesota-way). Two type: |
verbose |
Print the progress bar in the console. By default, |
num_thread |
|
x |
|
digits |
digit option to print |
... |
not used |
Details
SSVS prior gives prior to parameters \alpha = vec(A)
(VAR coefficient) and \Sigma_e^{-1} = \Psi \Psi^T
(residual covariance).
\alpha_j \mid \gamma_j \sim (1 - \gamma_j) N(0, \kappa_{0j}^2) + \gamma_j N(0, \kappa_{1j}^2)
\gamma_j \sim Bernoulli(q_j)
and for upper triangular matrix \Psi
,
\psi_{jj}^2 \sim Gamma(shape = a_j, rate = b_j)
\psi_{ij} \mid w_{ij} \sim (1 - w_{ij}) N(0, \kappa_{0,ij}^2) + w_{ij} N(0, \kappa_{1,ij}^2)
w_{ij} \sim Bernoulli(q_{ij})
Gibbs sampler is used for the estimation. See ssvs_bvar_algo how it works.
Value
bvhar_ssvs
returns an object named bvharssvs
class.
It is a list with the following components:
- phi_record
MCMC trace for vectorized coefficients (phi
\phi
) with posterior::draws_df format.- eta_record
MCMC trace for upper triangular element of cholesky factor (eta
\eta
) with posterior::draws_df format.- psi_record
MCMC trace for diagonal element of cholesky factor (psi
\psi
) with posterior::draws_df format.- omega_record
MCMC trace for indicator variable for
eta
(omega\omega
) with posterior::draws_df format.- gamma_record
MCMC trace for indicator variable for
alpha
(gamma\gamma
) with posterior::draws_df format.- chol_record
MCMC trace for cholesky factor matrix
\Psi
with list format.- ols_coef
OLS estimates for VAR coefficients.
- ols_cholesky
OLS estimates for cholesky factor
- coefficients
Posterior mean of VAR coefficients.
- omega_posterior
Posterior mean of omega
- pip
Posterior inclusion probability
- param
posterior::draws_df with every variable: alpha, eta, psi, omega, and gamma
- chol_posterior
Posterior mean of cholesky factor matrix
- covmat
Posterior mean of covariance matrix
- df
Numer of Coefficients:
3m + 1
or3m
- p
3 (The number of terms. It contains this element for usage in other functions.)
- week
Order for weekly term
- month
Order for monthly term
- m
Dimension of the data
- obs
Sample size used when training =
totobs
-p
- totobs
Total number of the observation
- call
Matched call
- process
Description of the model, e.g.
"VHAR_SSVS"
- type
include constant term (
"const"
) or not ("none"
)- spec
SSVS specification defined by
set_ssvs()
- init
Initial specification defined by
init_ssvs()
- iter
Total iterations
- burn
Burn-in
- thin
Thinning
- chain
The numer of chains
- HARtrans
VHAR linear transformation matrix
- y0
Y_0
- design
X_0
- y
Raw input
References
Kim, Y. G., and Baek, C. (2023). Bayesian vector heterogeneous autoregressive modeling. Journal of Statistical Computation and Simulation.
Kim, Y. G., and Baek, C. (n.d.). Working paper.
See Also
Vectorization formulation var_vec_formulation
Gibbs sampler algorithm ssvs_bvar_algo