add_priors.bvarmodel {bvartools}R Documentation

Add Priors for a Vector Autoregressive Models

Description

Adds prior specifications to a list of models, which was produced by function gen_var.

Usage

## S3 method for class 'bvarmodel'
add_priors(
  object,
  coef = list(v_i = 1, v_i_det = 0.1, shape = 3, rate = 1e-04, rate_det = 0.01),
  sigma = list(df = "k", scale = 1, mu = 0, v_i = 0.01, sigma_h = 0.05, constant = 1e-04),
  ssvs = NULL,
  bvs = NULL,
  ...
)

Arguments

object

a list, usually, the output of a call to gen_var.

coef

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 and structural 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'.

sigma

a named list of prior specifications for the error variance-covariance matrix of the 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'.

ssvs

optional; a named list of prior specifications for the SSVS algorithm. Not allowed for TVP models. See 'Details'.

bvs

optional; a named list of prior specifications for the BVS algorithm. See 'Details'.

...

further arguments passed to or from other methods.

Details

The arguments of the function require named lists. Possible specifications are described in the following. Note that it is important to specify the priors in the correct list. Otherwise, the provided specification will be disregarded and default values will be used.

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 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 mean of the respective endogenous variable is used as prior mean. If const = "first", the first values of the respective endogenous variable is used as prior mean.

minnesota

a list of length 4 containing parameters for the calculation of the Minnesota prior, where the element names must be kappa0, kappa1, kappa2 and kappa3. For the endogenous variable i the prior variance of the lth 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+1)^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.

max_var

a numeric specifying the maximum prior variance that is allowed for non-deterministic coefficients.

shape

a numeric specifying the prior shape parameter of the error term of the state equation. Only used for models with time varying parameters. Default is 3.

rate

a numeric specifying the prior rate parameter of the error term of the state equation. Only used for models with time varying parameters. Default is 0.0001.

rate_det

a numeric specifying the prior rate parameter of the error term of the state equation for coefficients, which correspond to deterministic terms. Only used for models with time varying parameters. Default is 0.01.

If minnesota is specified, v_i and v_i_det are ignored.

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 inverse Wishart. Default is "k", which indicates the amount of endogenous variables in the respective 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.

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 or if time varying volatilities are estimated. For models with constant volatility the default is "k", which indicates the amount 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. For models with stochastic volatility this prior refers to the error variance of the state equation.

rate

a numeric specifying the prior rate parameter of the error term. Only used, if the prior is inverse gamma or if time varying volatilities are estimated. For models with stochastic volatility this prior refers to the error variance of the state equation.

mu

numeric of the prior mean of the initial state of the log-volatilities. Only used for models with time varying volatility.

v_i

numeric of the prior precision of the initial state of the log-volatilities. Only used for models with time varying volatility.

sigma_h

numeric of the initial draw for the variance of the log-volatilities. Only used for models with time varying volatility.

constant

numeric of the constant, which is added before taking the log of the squared errors. Only used for models with time varying volatility.

covar

logical indicating whether error covariances should be estimated. Only used in combination with an inverse gamma prior or stochastic volatility, for which shape and rate must be specified.

df and scale must be specified for an inverse Wishart prior. shape and rate are required for an inverse gamma prior. For structural models or models with stochastic volatility 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.

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.

semiautomatic

an numeric vector of two elements containing the factors by which the standard errors associated with an unconstrained least squares estimate of the 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 excluded 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 excluded 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 probabilities 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,
\kappa_{4} for deterministic 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.

Value

A list of country models.

References

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. doi:10.1016/j.jeconom.2007.08.017

Korobilis, D. (2013). VAR forecasting using Bayesian variable selection. Journal of Applied Econometrics, 28(2), 204–230. doi:10.1002/jae.1271

Lütkepohl, H. (2006). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.

Examples


data("e1")
e1 <- diff(log(e1)) * 100

model <- gen_var(e1, p = 2, deterministic = 2,
                 iterations = 100, burnin = 10)

model <- add_priors(model)


[Package bvartools version 0.2.4 Index]