specify_prior_sigma {bayesianVARs} | R Documentation |
Specify prior on Sigma
Description
Configures prior on the variance-covariance of the VAR.
Usage
specify_prior_sigma(
data = NULL,
M = ncol(data),
type = c("factor", "cholesky"),
factor_factors = 1L,
factor_restrict = c("none", "upper"),
factor_priorfacloadtype = c("rowwiseng", "colwiseng", "normal"),
factor_priorfacload = 0.1,
factor_facloadtol = 1e-18,
factor_priorng = c(1, 1),
factor_priormu = c(0, 10),
factor_priorphiidi = c(10, 3),
factor_priorphifac = c(10, 3),
factor_priorsigmaidi = 1,
factor_priorsigmafac = 1,
factor_priorh0idi = "stationary",
factor_priorh0fac = "stationary",
factor_heteroskedastic = TRUE,
factor_priorhomoskedastic = NA,
factor_interweaving = 4,
cholesky_U_prior = c("HS", "DL", "R2D2", "NG", "SSVS", "normal", "HMP"),
cholesky_U_tol = 1e-18,
cholesky_heteroscedastic = TRUE,
cholesky_priormu = c(0, 100),
cholesky_priorphi = c(20, 1.5),
cholesky_priorsigma2 = c(0.5, 0.5),
cholesky_priorh0 = "stationary",
cholesky_priorhomoscedastic = as.numeric(NA),
cholesky_DL_a = "1/n",
cholesky_DL_tol = 0,
cholesky_R2D2_a = 0.4,
cholesky_R2D2_b = 0.5,
cholesky_R2D2_tol = 0,
cholesky_NG_a = 0.5,
cholesky_NG_b = 0.5,
cholesky_NG_c = 0.5,
cholesky_NG_tol = 0,
cholesky_SSVS_c0 = 0.001,
cholesky_SSVS_c1 = 1,
cholesky_SSVS_p = 0.5,
cholesky_HMP_lambda3 = c(0.01, 0.01),
cholesky_normal_sds = 10,
expert_sv_offset = 0,
quiet = FALSE,
...
)
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. |
type |
character, one of |
factor_factors |
Number of latent factors to be estimated. Only required
if |
factor_restrict |
Either "upper" or "none", indicating whether the factor
loadings matrix should be restricted to have zeros above the diagonal
("upper") or whether all elements should be estimated from the data
("none"). Setting |
factor_priorfacloadtype |
Can be
For details please see Kastner (2019). |
factor_priorfacload |
Either a matrix of dimensions |
factor_facloadtol |
Minimum number that the absolute value of a factor
loadings draw can take. Prevents numerical issues that can appear when
strong shrinkage is enforced if chosen to be greater than zero. Only
required if |
factor_priorng |
Two-element vector with positive entries indicating the
Normal-Gamma prior's hyperhyperparameters |
factor_priormu |
Vector of length 2 denoting prior mean and standard
deviation for unconditional levels of the idiosyncratic log variance
processes. Only required if |
factor_priorphiidi |
Vector of length 2, indicating the shape parameters
for the Beta prior distributions of the transformed parameters
|
factor_priorphifac |
Vector of length 2, indicating the shape parameters
for the Beta prior distributions of the transformed parameters
|
factor_priorsigmaidi |
Vector of length |
factor_priorsigmafac |
Vector of length |
factor_priorh0idi |
Vector of length 1 or |
factor_priorh0fac |
Vector of length 1 or |
factor_heteroskedastic |
Vector of length 1, 2, or |
factor_priorhomoskedastic |
Only used if at least one element of
|
factor_interweaving |
The following values for interweaving the factor
loadings are accepted (Only required if
For details please see Kastner et al. (2017). A value of 4 is the highly recommended default. |
cholesky_U_prior |
character, one of |
cholesky_U_tol |
Minimum number that the absolute value of an free
off-diagonal element of an |
cholesky_heteroscedastic |
single logical indicating whether time-varying
( |
cholesky_priormu |
Vector of length 2 denoting prior mean and standard
deviation for unconditional levels of the log variance processes. Only
required if |
cholesky_priorphi |
Vector of length 2, indicating the shape parameters
for the Beta prior distributions of the transformed parameters
|
cholesky_priorsigma2 |
Vector of length 2, indicating the shape and the
rate for the Gamma prior distributions on the variance of the log variance
processes. (Currently only one global setting for all |
cholesky_priorh0 |
Vector of length 1 or |
cholesky_priorhomoscedastic |
Only used if
|
cholesky_DL_a |
(Single) positive real number. The value is interpreted
as the concentration parameter for the local scales. Smaller values enforce
heavier shrinkage. A matrix of dimension |
cholesky_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. |
cholesky_R2D2_a |
(Single) positive real number. The value is interpreted
as the concentration parameter for the local scales. Smaller values enforce
heavier shrinkage. A matrix of dimension |
cholesky_R2D2_b |
single positive number, where greater values indicate
heavier regularization. |
cholesky_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. |
cholesky_NG_a |
(Single) positive real number. The value is interpreted
as the concentration parameter for the local scales. Smaller values enforce
heavier shrinkage. A matrix of dimension |
cholesky_NG_b |
(Single) positive real number. The value indicates the
shape parameter of the inverse gamma prior on the global scales.
|
cholesky_NG_c |
(Single) positive real number. The value indicates the
scale parameter of the inverse gamma prior on the global scales.
Expert option would be to set the scale parameter proportional to NG_a. E.g.
in the case where a discrete hyperprior for NG_a is chosen, a desired
proportion of let's say 0.2 is achieved by setting NG_c="0.2a" (character
input!). |
cholesky_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. |
cholesky_SSVS_c0 |
single positive number indicating the (unscaled)
standard deviation of the spike component. |
cholesky_SSVS_c1 |
single positive number indicating the (unscaled)
standard deviation of the slab component. |
cholesky_SSVS_p |
Either a single positive number in the range |
cholesky_HMP_lambda3 |
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 the contemporaneous coefficients. |
cholesky_normal_sds |
numeric vector of length |
expert_sv_offset |
... Do not use! |
quiet |
logical indicating whether informative output should be omitted. |
... |
Do not use! |
Details
bvar
offers two different specifications for the errors: The user can
choose between a factor stochastic volatility structure or a cholesky
stochastic volatility structure. In both cases the disturbances
\boldsymbol{\epsilon}_t
are assumed to follow a M
-dimensional
multivariate normal distribution with zero mean and variance-covariance matrix
\boldsymbol{\Sigma}_t
. In case of the cholesky specification
\boldsymbol{\Sigma}_t = \boldsymbol{U}^{\prime -1} \boldsymbol{D}_t
\boldsymbol{U}^{-1}
, where \boldsymbol{U}^{-1}
is upper unitriangular (with ones on
the diagonal). The diagonal matrix \boldsymbol{D}_t
depends upon latent
log-variances, i.e. \boldsymbol{D}_t=diag(exp(h_{1t}),\dots, exp(h_{Mt})
. The
log-variances follow a priori independent autoregressive processes
h_{it}\sim N(\mu_i + \phi_i(h_{i,t-1}-\mu_i),\sigma_i^2)
for
i=1,\dots,M
. In case of the factor structure,
\boldsymbol{\Sigma}_t = \boldsymbol{\Lambda} \boldsymbol{V}_t \boldsymbol{\Lambda}^\prime +
\boldsymbol{G}_t
. The diagonal matrices \boldsymbol{V}_t
and
\boldsymbol{G}_t
depend upon latent log-variances, i.e.
\boldsymbol{G}_t=diag(exp(h_{1t}),\dots, exp(h_{Mt})
and
\boldsymbol{V}_t=diag(exp(h_{M+1,t}),\dots, exp(h_{M+r,t})
. The log-variances
follow a priori independent autoregressive processes h_{it}\sim N(\mu_i +
\phi_i(h_{i,t-1}-\mu_i),\sigma_i^2)
for i=1,\dots,M
and
h_{M+j,t}\sim N(\phi_ih_{M+j,t-1},\sigma_{M+j}^2)
for j=1,\dots,r
.
Value
Object of class bayesianVARs_prior_sigma
.
References
Kastner, G. (2019). Sparse Bayesian Time-Varying Covariance Estimation in Many Dimensions Journal of Econometrics, 210(1), 98–115, doi:10.1016/j.jeconom.2018.11.007
Kastner, G., Frühwirth-Schnatter, S., and Lopes, H.F. (2017). Efficient Bayesian Inference for Multivariate Factor Stochastic Volatility Models. Journal of Computational and Graphical Statistics, 26(4), 905–917, doi:10.1080/10618600.2017.1322091.
See Also
Examples
# Access a subset of the usmacro_growth dataset
data <- usmacro_growth[,c("GDPC1", "CPIAUCSL", "FEDFUNDS")]
# examples with stochastic volatility (heteroscedasticity) -----------------
# factor-decomposition with 2 factors and colwise normal-gamma prior on the loadings
sigma_factor_cng_sv <- specify_prior_sigma(data = data, type = "factor",
factor_factors = 2L, factor_priorfacloadtype = "colwiseng", factor_heteroskedastic = TRUE)
# cholesky-decomposition with Dirichlet-Laplace prior on U
sigma_cholesky_dl_sv <- specify_prior_sigma(data = data, type = "cholesky",
cholesky_U_prior = "DL", cholesky_DL_a = 0.5, cholesky_heteroscedastic = TRUE)
# examples without stochastic volatility (homoscedasticity) ----------------
# factor-decomposition with 2 factors and colwise normal-gamma prior on the loadings
sigma_factor_cng <- specify_prior_sigma(data = data, type = "factor",
factor_factors = 2L, factor_priorfacloadtype = "colwiseng",
factor_heteroskedastic = FALSE, factor_priorhomoskedastic = matrix(c(0.5,0.5),
ncol(data), 2))
# cholesky-decomposition with Horseshoe prior on U
sigma_cholesky_dl <- specify_prior_sigma(data = data, type = "cholesky",
cholesky_U_prior = "HS", cholesky_heteroscedastic = FALSE)
# Estimate model with your prior configuration of choice
mod <- bvar(data, prior_sigma = sigma_factor_cng_sv, quiet = TRUE)