bv_priors: Prior settings

View source: R/40_priors_setup.R

bv_priorsR Documentation

Prior settings

Description

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.

Usage

bv_priors(hyper = "auto", mn = bv_mn(), ...)

Arguments

hyper

Character vector. Used to specify the parameters to be treated as hyperparameters. May also be set to "auto" or "full" for an automatic / full subset. Other allowed values are the Minnesota prior's parameters "lambda", "alpha" and "psi" as well as the names of additional dummy priors included via ....

mn

List of class "bv_minnesota". Options for the Minnesota prior, set via bv_mn.

...

Optional lists of class bv_dummy with options for dummy priors. Must be assigned a name in the function call. Created with bv_dummy.

Value

Returns a named list of class bv_priors with options for bvar.

See Also

bv_mn; bv_dummy

Examples

# 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)

BVAR documentation built on May 29, 2024, 5:34 a.m.