bvartools (version 0.2.4)

gen_var: Vector Autoregressive Model Input

Description

gen_var produces the input for the estimation of a vector autoregressive (VAR) model.

Usage

gen_var(
  data,
  p = 2,
  exogen = NULL,
  s = NULL,
  deterministic = "const",
  seasonal = FALSE,
  structural = FALSE,
  tvp = FALSE,
  sv = FALSE,
  fcst = NULL,
  iterations = 50000,
  burnin = 5000
)

Value

An object of class 'bvarmodel', which contains the following elements:

data

A list of data objects, which can be used for posterior simulation. Element Y is a time-series object of dependent variables. Element Z is a time-series object of the regressors and element SUR is the corresponding matrix of regressors in SUR form.

model

A list of model specifications.

Arguments

data

a time-series object of endogenous variables.

p

an integer vector of the lag order (default is p = 2).

exogen

an optional time-series object of external regressors.

s

an optional integer vector of the lag order of the external regressors (default is s = 2).

deterministic

a character specifying which deterministic terms should be included. Available values are "none", "const" (default) for an intercept, "trend" for a linear trend, and "both" for an intercept with a linear trend.

seasonal

logical. If TRUE, seasonal dummy variables are generated as additional deterministic terms. The amount of dummies depends on the frequency of the time-series object provided in data.

structural

logical indicating whether data should be prepared for the estimation of a structural VAR model.

tvp

logical indicating whether the model parameters are time varying.

sv

logical indicating whether time varying error variances should be estimated by employing a stochastic volatility algorithm.

fcst

integer. Number of observations saved for forecasting evaluation.

iterations

an integer of MCMC draws excluding burn-in draws (defaults to 50000).

burnin

an integer of MCMC draws used to initialize the sampler (defaults to 5000). These draws do not enter the computation of posterior moments, forecasts etc.

Details

The function produces the data matrices for vector autoregressive (VAR) models, which can also include unmodelled, non-deterministic variables: $$A_0 y_t = \sum_{i=1}^{p} A_i y_{t - i} + \sum_{i=0}^{s} B_i x_{t - i} + C D_t + u_t,$$ where \(y_t\) is a K-dimensional vector of endogenous variables, \(A_0\) is a \(K \times K\) coefficient matrix of contemporaneous endogenous variables, \(A_i\) is a \(K \times K\) coefficient matrix of endogenous variables, \(x_t\) is an M-dimensional vector of exogenous regressors and \(B_i\) its corresponding \(K \times M\) coefficient matrix. \(D_t\) is an N-dimensional vector of deterministic terms and \(C\) its corresponding \(K \times N\) coefficient matrix. \(p\) is the lag order of endogenous variables, \(s\) is the lag order of exogenous variables, and \(u_t\) is an error term.

If an integer vector is provided as argument p or s, the function will produce a distinct model for all possible combinations of those specifications.

If tvp is TRUE, the respective coefficients of the above model are assumed to be time varying. If sv is TRUE, the error covariance matrix is assumed to be time varying.

References

Chan, J., Koop, G., Poirier, D. J., & Tobias, J. L. (2019). Bayesian Econometric Methods (2nd ed.). Cambridge: University Press.

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

Examples

Run this code

# Load data
data("e1") 
e1 <- diff(log(e1))

# Generate model data
data <- gen_var(e1, p = 0:2, deterministic = "const")

Run the code above in your browser using DataLab