Last chance! 50% off unlimited learning
Sale ends in
Allows the creation of dummy observation priors for bv_priors
.
See the Details section for information on common dummy priors.
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)
Numeric scalar (/vector). Mode (or the like) of the parameter.
Numeric scalar with the standard deviation.
Numeric scalar (/vector). Minimum allowed value.
Numeric scalar (/vector). Maximum allowed value.
Function taking Y, lags and the prior's parameter par to generate and return a named list with elements X and Y (numeric matrices).
Returns a named list of class bv_dummy
for
bv_priors
.
Dummy priors are often used to "reduce the importance of the deterministic
component implied by VARs estimated conditioning on the initial
observations" (Giannone et al. 2015, p. 440). One such prior is the
sum-of-coefficients (SOC) prior, which imposes the notion that a no-change
forecast is optimal at the beginning of a time series. Its key parameter
bv_soc
and bv_sur
.
Giannone, D., Lenza, M., & Primiceri, G. E. (2015). Prior Selection for Vector Autoregressions. Review of Economics and Statistics, 97, 436-451. https://doi.org/10.1162/REST_a_00483.
# 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_priors()`
priors_dum <- bv_priors(hyper = "auto", soc = soc, sur = sur)
# }
Run the code above in your browser using DataLab