specify_prior_phi {bayesianVARs} | R Documentation |
Specify prior on PHI
Description
Configures prior on PHI, the matrix of reduced-form VAR coefficients.
Usage
specify_prior_phi(
data = NULL,
M = ncol(data),
lags = 1L,
prior = "HS",
priormean = 0,
PHI_tol = 1e-18,
DL_a = "1/K",
DL_tol = 0,
R2D2_a = 0.1,
R2D2_b = 0.5,
R2D2_tol = 0,
NG_a = 0.1,
NG_b = 1,
NG_c = 1,
NG_tol = 0,
SSVS_c0 = 0.01,
SSVS_c1 = 100,
SSVS_semiautomatic = TRUE,
SSVS_p = 0.5,
HMP_lambda1 = c(0.01, 0.01),
HMP_lambda2 = c(0.01, 0.01),
normal_sds = 10,
global_grouping = "global",
...
)
Arguments
data |
Optional. Data matrix (can be a time series object). Each of
|
M |
positive integer indicating the number of time-series of the VAR. |
lags |
positive integer indicating the order of the VAR, i.e. the number of lags of the dependent variables included as predictors. |
prior |
character, one of |
priormean |
real numbers indicating the prior means of the VAR
coefficients. One single number means that the prior mean of all own-lag
coefficients w.r.t. the first lag equals |
PHI_tol |
Minimum number that the absolute value of a VAR coefficient draw can take. Prevents numerical issues that can appear when strong shrinkage is enforced if chosen to be greater than zero. |
DL_a |
(Single) positive real number. The value is interpreted as the
concentration parameter for the local scales. Smaller values enforce heavier
shrinkage. If the argument |
DL_tol |
Minimum number that a parameter draw of one of the shrinking
parameters of the Dirichlet Laplace prior can take. Prevents numerical
issues that can appear when strong shrinkage is enforced if chosen to be
greater than zero. |
R2D2_a |
(Single) positive real number. The value is interpreted as the
concentration parameter for the local scales. Smaller values enforce heavier
shrinkage. If the argument |
R2D2_b |
(Single) positive real number. The value indicates the shape
parameter of the inverse gamma prior on the (semi-)global scales. If the
argument |
R2D2_tol |
Minimum number that a parameter draw of one of the shrinking
parameters of the R2D2 prior can take. Prevents numerical issues that can
appear when strong shrinkage is enforced if chosen to be greater than zero.
|
NG_a |
(Single) positive real number. The value is interpreted as the
concentration parameter for the local scales. Smaller values enforce heavier
shrinkage. If the argument |
NG_b |
(Single) positive real number. The value indicates the shape
parameter of the inverse gamma prior on the (semi-)global scales. If the
argument |
NG_c |
(Single) positive real number. The value indicates the scale
parameter of the inverse gamma prior on the (semi-)global scales. If the
argument |
NG_tol |
Minimum number that a parameter draw of one of the shrinking
parameters of the normal-gamma prior can take. Prevents numerical issues
that can appear when strong shrinkage is enforced if chosen to be greater
than zero. |
SSVS_c0 |
single positive number indicating the (unscaled) standard
deviation of the spike component. |
SSVS_c1 |
single positive number indicating the (unscaled) standard
deviation of the slab component. |
SSVS_semiautomatic |
logical. If |
SSVS_p |
Either a single positive number in the range |
HMP_lambda1 |
numeric vector of length 2. Both entries must be positive.
The first indicates the shape and the second the rate of the Gamma
hyperprior on own-lag coefficients. |
HMP_lambda2 |
numeric vector of length 2. Both entries must be positive.
The first indicates the shape and the second the rate of the Gamma
hyperprior on cross-lag coefficients. |
normal_sds |
numeric vector of length |
global_grouping |
One of |
... |
Do not use! |
Details
For details concerning prior-elicitation for VARs please see Gruber & Kastner (2023).
Currently one can choose between six hierarchical shrinkage priors and a
normal prior: prior="HS"
stands for the Horseshoe-prior, prior="R2D2
for
the R^2
-induced-Dirichlet-decompostion-prior, prior="NG"
for the
normal-gamma-prior, prior="DL"
for the Dirichlet-Laplace-prior,
prior="SSVS"
for the stochastic-search-variable-selection-prior,
prior="HMP"
for the semi-hierarchical Minnesota prior and prior=normal
for
the normal-prior.
Semi-global shrinkage, i.e. group-specific shrinkage for pre-specified
subgroups of the coefficients, can be achieved through the argument
global_grouping
.
Value
A baysianVARs_prior_phi
-object.
References
Gruber, L. and Kastner, G. (2023). Forecasting macroeconomic data with Bayesian VARs: Sparse or dense? It depends! arXiv:2206.04902.
Examples
# Access a subset of the usmacro_growth dataset
data <- usmacro_growth[,c("GDPC1", "CPIAUCSL", "FEDFUNDS")]
# Horseshoe prior for a VAR(2)
phi_hs <- specify_prior_phi(data = data, lags = 2L ,prior = "HS")
# Semi-global-local Horseshoe prior for a VAR(2) with semi-global shrinkage parameters for
# cross-lag and own-lag coefficients in each lag
phi_hs_sg <- specify_prior_phi(data = data, lags = 2L, prior = "HS",
global_grouping = "olcl-lagwise")
# Semi-global-local Horseshoe prior for a VAR(2) with equation-wise shrinkage
# construct indicator matrix for equation-wise shrinkage
semi_global_mat <- matrix(1:ncol(data), 2*ncol(data), ncol(data),
byrow = TRUE)
phi_hs_ew <- specify_prior_phi(data = data, lags = 2L, prior = "HS",
global_grouping = semi_global_mat)
# (for equation-wise shrinkage one can also use 'global_grouping = "equation-wise"')
# Estimate model with your prior configuration of choice
mod <- bvar(data, lags = 2L, prior_phi = phi_hs_sg, quiet = TRUE)