ssvs {bvartools} | R Documentation |
Stochastic Search Variable Selection
Description
ssvs
employs stochastic search variable selection as proposed by George et al. (2008)
to produce a draw of the precision matrix of the coefficients in a VAR model.
Usage
ssvs(a, tau0, tau1, prob_prior, include = NULL)
Arguments
a |
an M-dimensional vector of coefficient draws. |
tau0 |
an M-dimensional vector of prior standard deviations for restricted
coefficients in vector |
tau1 |
an M-dimensional vector of prior standard deviations for unrestricted
coefficients in vector |
prob_prior |
an M-dimensional vector of prior inclusion probabilites for the coefficients
in vector |
include |
an integer vector specifying the positions of coefficients in vector |
Details
The function employs stochastic search variable selection (SSVS) as proposed
by George et al. (2008) to produce a draw of the diagonal inverse prior covariance matrix
\underline{V}^{-1}
and the corresponding vector of inclusion parameters \lambda
of the vectorised coefficient matrix a = vec(A)
for the VAR model
y_t = A x_t + u_t,
where y_{t}
is a K-dimensional vector of endogenous variables,
x_{t}
is a vector of explanatory variabes
and the error term is u_t \sim \Sigma
.
Value
A named list containing two components:
v_i |
an |
lambda |
an M-dimensional vector of inclusion parameters. |
References
George, E. I., Sun, D., & Ni, S. (2008). Bayesian stochastic search for VAR model restrictions. Journal of Econometrics, 142(1), 553–580. doi:10.1016/j.jeconom.2007.08.017
Examples
# Load data
data("e1")
data <- diff(log(e1))
# Generate model data
temp <- gen_var(data, p = 2, deterministic = "const")
y <- t(temp$data$Y)
x <- t(temp$data$Z)
k <- nrow(y)
tt <- ncol(y)
m <- k * nrow(x)
# Obtain SSVS priors using the semiautomatic approach
priors <- ssvs_prior(temp, semiautomatic = c(0.1, 10))
tau0 <- priors$tau0
tau1 <- priors$tau1
# Prior for inclusion parameter
prob_prior <- matrix(0.5, m)
# Priors
a_mu_prior <- matrix(0, m)
a_v_i_prior <- diag(c(tau1^2), m)
# Initial value of Sigma
sigma_i <- solve(tcrossprod(y) / tt)
# Draw parameters
a <- post_normal(y = y, x = x, sigma_i = sigma_i,
a_prior = a_mu_prior, v_i_prior = a_v_i_prior)
# Run SSVS
lambda <- ssvs(a = a, tau0 = tau0, tau1 = tau1,
prob_prior = prob_prior)