gen_var
produces the input for the estimation of a vector autoregressive (VAR) model.
gen_var(
data,
p = 2,
exogen = NULL,
s = NULL,
deterministic = "const",
seasonal = FALSE,
structural = FALSE,
iterations = 50000,
burnin = 5000
)
a time-series object of endogenous variables.
an integer vector of the lag order (default is p = 2
).
an optional time-series object of external regressors.
an optional integer vector of the lag order of the external regressors (default is s = 2
).
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.
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
.
logical indicating whether data should be prepared for the estimation of a structural VAR model.
an integer of MCMC draws excluding burn-in draws (defaults to 50000).
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.
An object of class 'bvarmodel'
, which contains the following elements:
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.
A list of model specifications.
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.
L<U+00FC>tkepohl, H. (2006). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.
# NOT RUN {
# 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