Adds prior specifications to a list of models, which was produced by
function gen_var
or gen_vec
.
add_priors(
object,
coef = list(v_i = 1, v_i_det = 0.1),
coint = list(v_i = 0, p_tau_i = 1),
sigma = list(df = "k", scale = 1),
ssvs = NULL,
bvs = NULL
)
a named list of prior specifications for the coefficients of the
models. For the default specification all prior means are set to zero and the diagonal elements of
the inverse prior variance-covariance matrix are set to 1 for coefficients corresponding to non-deterministic
terms. For deterministic coefficients the prior variances are set to 10 via v_i_det = 0.1
.
The variances need to be specified as precisions, i.e. as inverses of the variances.
For further specifications such as the Minnesota prior see 'Details'.
a named list of prior specifications for cointegration coefficients of country-specific VEC models. See 'Details'.
a named list of prior specifications for the error variance-covariance matrix of the country models. For the default specification of an inverse Wishart distribution the prior degrees of freedom are set to the number of endogenous variables and the prior variances to 1. See 'Details'.
optional; a named list of prior specifications for the SSVS algorithm. See 'Details'.
optional; a named list of prior specifications for the BVS algorithm. See 'Details'.
A list of country models.
Argument coef
can contain the following elements
v_i
a numeric specifying the prior precision of the coefficients. Default is 1.
v_i_det
a numeric specifying the prior precision of coefficients corresponding to deterministic terms. Default is 0.1.
coint_var
a logical specifying whether the prior mean of the first own lag of an
endogenous variable in a VAR model should be set to 1. Default is FALSE
.
const
a numeric or character specifying the prior mean of coefficients, which correspond
to the intercept. If a numeric is provided, all prior means are set to this value.
If const = "mean"
, the means of the series of endogenous variables are used as prior means.
If const = "first"
, the first values of the series of endogenous variables are used as prior means.
minnesota
a list of length 4 containing parameters for the calculation of
the Minnesota prior, where the element names are kappa0
, kappa1
, kappa2
and kappa3
.
For the endogenous variable \(i\) the prior variance of the \(l\)th lag of regressor \(j\) is obtained as
$$ \frac{\kappa_{0}}{l^2} \textrm{ for own lags of endogenous variables,}$$
$$ \frac{\kappa_{0} \kappa_{1}}{l^2} \frac{\sigma_{i}^2}{\sigma_{j}^2} \textrm{ for endogenous variables other than own lags,}$$
$$ \frac{\kappa_{0} \kappa_{2}}{l^2} \frac{\sigma_{i}^2}{\sigma_{j}^2} \textrm{ for exogenous variables,}$$
$$ \kappa_{0} \kappa_{3} \sigma_{i}^2 \textrm{ for deterministic terms,}$$
where \(\sigma_{i}\) is the residual standard deviation of variable \(i\) of an unrestricted
LS estimate. For exogenous variables \(\sigma_{i}\) is the sample standard deviation.
For VEC models the function only provides priors for the non-cointegration part of the model. The residual standard errors \(\sigma_i\) are based on an unrestricted LS regression of the endogenous variables on the error correction term and the non-cointegration regressors.
max_var
a numeric specifying the maximum prior variance that is allowed for non-deterministic coefficients.
If minnesota
is specified, v_i
and v_i_det
are ignored.
Argument coint
can contain the following elements:
coint_v_i
numeric between 0 and 1 specifying the shrinkage of the cointegration space prior. Default is 0.
coint_p_tau_i
numeric of the diagonal elements of the inverse prior matrix of the central location of the cointegration space \(sp(\beta)\). Default is 1.
Argument sigma
can contain the following elements:
df
an integer or character specifying the prior degrees of freedom of the error term. Only
used, if the prior is invese Wishart.
Default is "k"
, which indicates the amout of endogenous variables in the respective country model.
"k + 3"
can be used to set the prior to the amount of endogenous variables plus 3. If an integer
is provided, the degrees of freedom are set to this value in all models.
If a VEC model is estimated, the rank \(r\) of the cointegration matrix
is automatically added.
scale
a numeric specifying the prior error variance of endogenous variables. Default is 1.
shape
a numeric or character specifying the prior shape parameter of the error term. Only
used, if the prior is inverse gamma.
Default is "k"
, which indicates the amout of endogenous variables in the respective country model.
"k + 3"
can be used to set the prior to the amount of endogenous variables plus 3. If a numeric
is provided, the shape parameters are set to this value in all models.
If a VEC model is estimated, the rank \(r\) of the cointegration matrix
is automatically added.
rate
a numeric specifying the prior rate parameter of the error term. Only used, if the prior is inverse gamma.
df
and scale
must be specified for an inverse Wishart prior. shape
and rate
are required for an inverse gamma prior. For structural models only a gamma prior specification
is allowed.
Argument ssvs
can contain the following elements:
inprior
a numeric between 0 and 1 specifying the prior probability of a variable to be included in the model. Default is 0.5.
tau
a numeric vector of two elements containing the prior standard errors
of restricted variables (\(\tau_0\)) as its first element and unrestricted variables (\(\tau_1\))
as its second. Default is c(0.05, 10)
.
semiautomatic
an numeric vector of two elements containing the factors by which the standard errors associated with an unconstrained least squares estimate of the VAR model are multiplied to obtain the prior standard errors of restricted (\(\tau_0\)) and unrestricted (\(\tau_1\)) variables, respectively. This is the semiautomatic approach described in George et al. (2008).
covar
logical indicating if SSVS should also be applied to the error covariance matrix as in George et al. (2008).
exclude_det
logical indicating if deterministic terms should be exempted from the SSVS algorithm.
minnesota
a numeric vector of length 4 containing parameters for the calculation of the Minnesota-like inclusion priors. See below.
Either tau
or semiautomatic
must be specified.
The argument bvs
can contain the following elements
inprior
a numeric between 0 and 1 specifying the prior probability of a variable to be included in the model.
covar
logical indicating if BVS should also be applied to the error covariance matrix.
exclude_det
logical indicating if deterministic terms should be exempted from the BVS algorithm.
minnesota
a numeric vector of length 4 containing parameters for the calculation of the Minnesota-like inclusion priors. See below.
If either ssvs$minnesota
or bvs$minnesota
is specified, prior inclusion probabilites
are calculated in a Minnesota-like fashion as
\(\frac{\kappa_1}{l}\) | for own lags of endogenous variables, |
\(\frac{\kappa_2}{l}\) | for other endogenous variables, |
\(\frac{\kappa_3}{1 + l}\) | for exogenous variables, |
for lag \(l\) with \(\kappa_1\), \(\kappa_2\), \(\kappa_3\), \(\kappa_4\) as the first, second,
third and forth element in ssvs$minnesota
or bvs$minnesota
, respectively.
Chan, J., Koop, G., Poirier, D. J., & Tobias J. L. (2019). Bayesian econometric methods (2nd ed.). Cambridge: Cambridge University Press.
George, E. I., Sun, D., & Ni, S. (2008). Bayesian stochastic search for VAR model restrictions. Journal of Econometrics, 142(1), 553--580. https://doi.org/10.1016/j.jeconom.2007.08.017
Korobilis, D. (2013). VAR forecasting using Bayesian variable selection. Journal of Applied Econometrics, 28(2), 204--230. https://doi.org/10.1002/jae.1271
L<U+00FC>tkepohl, H. (2006). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.
# NOT RUN {
data("e1")
e1 <- diff(log(e1)) * 100
model <- gen_var(e1, p = 2, deterministic = 2,
iterations = 100, burnin = 10)
model <- add_priors(model)
# }
Run the code above in your browser using DataLab