bvartools (version 0.0.1)

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 = 2, deterministic = "const",
  seasonal = FALSE)

Arguments

data

a time-series object of endogenous variables.

p

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

exogen

an optional time-series object of external regressors.

s

an optional integer of the lag order of the exogenous variables (default is s = 2).

deterministic

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

seasonal

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

Value

A list containing the following elements:

Y

a matrix of endogenous variables.

Z

a matrix of regressor variables.

Details

The function produces the variable matrices of a vector autoregressive (VAR) model, which can also include exogenous variables: $$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_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.

In matrix notation the above model can be written as $$Y = P Z + U,$$ where \(Y\) is a \(K \times T\) matrix of endogenous variables, \(Z\) is a \(Kp + M(1+s) + N \times T\) matrix of regressor variables, and \(U\) is a \(K \times T\) matrix of errors. The function gen_var generates the matrices \(Y\) and \(Z\).

References

L<U+00FC>tkepohl, H. (2007). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.

Examples

Run this code
# NOT RUN {
data("e1")
e1 <- diff(log(e1))
data <- gen_var(e1, p = 2, deterministic = "const")

# }

Run the code above in your browser using DataCamp Workspace