View source: R/40_priors_setup.R
bv_priors | R Documentation |
Function to provide priors and their parameters to bvar
. Used
for adjusting the parameters treated as hyperparameters, the Minnesota prior
and adding various dummy priors through the ellipsis parameter.
Note that treating \psi
(psi) as a hyperparameter in a
model with many variables may lead to very low acceptance rates and thus
hinder convergence.
bv_priors(hyper = "auto", mn = bv_mn(), ...)
hyper |
Character vector. Used to specify the parameters to be treated
as hyperparameters. May also be set to |
mn |
List of class |
... |
Optional lists of class |
Returns a named list of class bv_priors
with options for
bvar
.
bv_mn
; bv_dummy
# Extend the hyperparameters to the full Minnesota prior
bv_priors(hyper = c("lambda", "alpha", "psi"))
# Alternatively
# bv_priors("full")
# Add a dummy prior via `bv_dummy()`
# Re-create the single-unit-root prior
add_sur <- function(Y, lags, par) {
sur <- if(lags == 1) {Y[1, ] / par} else {
colMeans(Y[1:lags, ]) / par
}
Y_sur <- sur
X_sur <- c(1 / par, rep(sur, lags))
return(list("Y" = Y_sur, "X" = X_sur))
}
sur <- bv_dummy(mode = 1, sd = 1, min = 0.0001, max = 50, fun = add_sur)
# Add the new prior
bv_priors(hyper = "auto", sur = sur)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.