Learn R Programming

BVAR (version 0.1.5)

bv_dummy: Dummy prior settings

Description

Allows the creation of dummy observation priors for bv_priors.

Usage

bv_dummy(mode = 1, sd = 1, min = 0.0001, max = 5, fun)

bv_soc(mode = 1, sd = 1, min = 0.0001, max = 50)

bv_sur(mode = 1, sd = 1, min = 0.0001, max = 50)

Arguments

mode

Numeric scalar. Mode (or the like) of the parameter.

sd

Numeric scalar. Standard deviation (or the like) of the parameter.

min

Numeric scalar. Minimum allowed value.

max

Numeric scalar. Maximum allowed value.

fun

Function taking Y, lags and the prior's parameter par to generate and return a named list with elements X and Y (numeric matrices).

Value

Returns a named list of class bv_dummy for bv_priors.

Examples

Run this code
# NOT RUN {
# Create a sum-of-coefficients prior
add_soc <- function(Y, lags, par) {
  soc <- if(lags == 1) {diag(Y[1, ]) / par} else {
    diag(colMeans(Y[1:lags, ])) / par
  }
  Y_soc <- soc
  X_soc <- cbind(rep(0, ncol(Y)), matrix(rep(soc, lags), nrow = ncol(Y)))

  return(list("Y" = Y_soc, "X" = X_soc))
}

soc <- bv_dummy(mode = 1, sd = 1, min = 0.0001, max = 50, fun = add_soc)

# 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 them to the prior list with `bv_prior()`
priors_dum <- bv_priors(hyper = "auto", soc = soc, sur = sur)
# }

Run the code above in your browser using DataLab