Learn R Programming

BVAR (version 0.1.5)

bv_priors: 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.

Usage

bv_priors(hyper = "auto", mn = bv_mn(bv_lambda(0.2, 0.4, 0.0001, 5),
  bv_alpha(2, 0.25, 1, 3), bv_psi(0.004, 0.004, "auto"), var = 10000000),
  ...)

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

Run this code
# NOT RUN {
# Extending hyperparameters to the full Minnesota prior
bv_priors(c("lambda", "alpha", "psi"))

# Add a dummy prior via `bv_dummy()`
# Create a 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)

# Adding the prior with `bv_prior()`
priors_dum <- bv_priors(hyper = "auto", sur = sur)
# }

Run the code above in your browser using DataLab