bv_dummy | R Documentation |
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)
mode , sd |
Numeric scalar. Mode / standard deviation of the parameter. Note that the mode of psi is set automatically by default, and would need to be provided as vector. |
min , max |
Numeric scalar. Minimum / maximum allowed value. Note that for psi these are set automatically or need to provided as vectors. |
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). |
Dummy priors are often used to "reduce the importance of the deterministic
component implied by VARs estimated conditioning on the initial
observations" (Giannone, Lenza and Primiceri, 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 \mu
controls the tightness - i.e. for
low values the model is pulled towards a form with as many unit roots as
variables and no cointegration.
Another such prior is the single-unit-root (SUR) prior, that allows for
cointegration relationships in the data. It pushes variables either towards
their unconditional mean or towards the presence of at least one unit root.
These priors are implemented via Theil mixed estimation, i.e. by adding
dummy-observations on top of the data matrix. They are available via the
functions bv_soc
and bv_sur
.
Returns a named list of class bv_dummy
for
bv_priors
.
bv_soc()
: Sum-of-coefficients dummy prior
bv_sur()
: Single-unit-root dummy prior
Giannone, D. and Lenza, M. and Primiceri, G. E. (2015) Prior Selection for Vector Autoregressions. The Review of Economics and Statistics, 97:2, 436-451, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1162/REST_a_00483")}.
bv_priors
; bv_minnesota
# 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)
# Add the new custom dummy priors
bv_priors(hyper = "auto", soc = soc, sur = sur)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.