shrinkDTVPVAR {shrinkTVPVAR} | R Documentation |
Markov Chain Monte Carlo (MCMC) for TVP-VAR-SV models under dynamic shrinkage priors
Description
shrinkDTVPVAR
samples from the joint posterior distribution of the parameters of a
TVP-VAR-SV model as described in Cadonna et al. (2020) and returns the MCMC draws. The prior on
the VAR coefficients is a dynamic shrinkage prior, as described in Knaus and Frühwirth-Schnatter (2023).
The model can be written as:
Y_t = c_t + \Phi_{1,t} Y_{t-1} + \Phi_{2,t} Y_{t-2} + \cdots + \Phi_{p,t} Y_{t-p} + \epsilon_t
where \epsilon_t \sim \mathcal{N}_m(0, \Sigma_t)
.
Usage
shrinkDTVPVAR(
y,
p = 1,
mod_type = "double",
const = TRUE,
niter = 5000,
nburn = round(niter/2),
nthin = 1,
display_progress = TRUE,
TVP_params_beta = list(),
TVP_params_sigma = list()
)
Arguments
y |
matrix or data frame containing the time series data. The rows correspond to the time points and the columns to the variables. |
p |
positive integer indicating the number of lags in the VAR model. The default value is 1. |
mod_type |
character string that reads either |
const |
logical value indicating whether a constant should be included in the model. The default value is |
niter |
positive integer, indicating the number of MCMC iterations
to perform, including the burn-in. Has to be larger than or equal to |
nburn |
non-negative integer, indicating the number of iterations discarded
as burn-in. Has to be smaller than or equal to |
nthin |
positive integer, indicating the degree of thinning to be performed. Every |
display_progress |
logical value indicating whether the progress bar and other informative output should be
displayed. The default value is |
TVP_params_beta |
optional named list containing hyperparameter values for the TVP prior of the beta_mean matrix.
Not all have to be supplied, with those missing being replaced by the default values. Any list elements that are misnamed will be ignored and a warning will be thrown.
Can either be a list of depth 1, which results in all equations having the same hyperparameters, or a list of lists of length
|
TVP_params_sigma |
optional named list containing hyperparameter values for the TVP prior of the Sigma matrix.
The structure is the same as for |
Details
The elements of the VAR coefficients \Phi_{i,t}
are assumed to follow component-wise random walks.
For further details concerning the algorithms and the model please refer to the papers by Cadonna et al. (2020) and Knaus and Frühwirth-Schnatter (2023).
Value
A list of class "shrinkDTVPVAR"
containing:
beta |
an |
beta_mean |
an |
theta_sr |
an |
xi2 |
an |
c_xi |
an |
kappa2 |
an |
kappa2_B |
an |
a_xi |
an |
tau2 |
an |
c_tau |
an |
lambda2 |
an |
lambda2_B |
an |
a_tau |
an |
Sigma |
an |
psi |
an |
rho_p |
an |
pred_objs |
a list with objects needed for prediction methods. |
final_lambda |
an |
final_lambda_SIGMA |
an array with the values of lambda of the variance-covariance matrix Sigma at time T of the dynamic shrinkage process. Used for predicting. |
rho_p_SIGMA |
an array with the rho_p values of the variance-covariance matrix Sigma. Used for predicting. |
beta_consts |
a list of |
psi_consts |
a list of |
data |
a list with the original data used for estimation. |
Author(s)
Peter Knaus peter.knaus@wu.ac.at
References
Cadonna, A., Frühwirth-Schnatter, S., & Knaus, P. (2020). Triple the Gamma—A Unifying Shrinkage Prior for Variance and Variable Selection in Sparse State Space and TVP Models. Econometrics, 8(2), 20.
Knaus, P., Bitto-Nemling, A., Cadonna, A., & Frühwirth-Schnatter, S. (2021). Shrinkage in the Time-Varying Parameter Model Framework Using the R
Package shrinkTVP
. Journal of Statistical Software, 100(13), 1–32.
Knaus, P., & Frühwirth-Schnatter, S. (2023). The Dynamic Triple Gamma Prior as a Shrinkage Process Prior for Time-Varying Parameter Models. arXiv preprint arXiv:2312.10487.
See Also
TV_heatmap
, density_plotter
, state_plotter
Examples
## Not run:
set.seed(123)
sim <- simTVPVAR(p = 2)
data <- sim$data
res <- shrinkDTVPVAR(data, p = 2)
# Visualize the results
plot(res)
plot(res$theta_sr)
# Change prior to triple gamma
res2 <- shrinkDTVPVAR(data, p = 2, mod_type = "triple")
# Modify the hyperparameter setup
hyperparam <- list(learn_a_xi = FALSE, learn_c_xi = FALSE,
learn_a_tau = FALSE, learn_c_tau = FALSE,
a_xi = 0.5, c_xi = 0.5, a_tau = 0.5, c_tau = 0.5)
res3 <- shrinkDTVPVAR(data, p = 2, mod_type = "triple",
TVP_params_beta = hyperparam,
TVP_params_sigma = hyperparam)
## End(Not run)