Y2Z: Create a regressor matrix for a VAR(p) model

Description Usage Arguments Value Examples

View source: R/aux_funs.R

Description

Matrix Y is transformed into Z notation; see Lütkepohl (2005, p. 70). This transformation facilitates estimation of VAR(p) models.

Usage

1
Y2Z(Y, p, const = TRUE)

Arguments

Y

A (K x N+p) matrix carrying the data for estimation. There are N observations for each of the K variables with p pre-sample values.

p

An integer scalar. The lag length of the VAR(p) system.

const

A boolean scalar, indicating wether a constant should be included. Defaults to TRUE.

Value

A ([K * p + 1] x N) or ([K * p] x N)matrix. The dimension depends on whether a constant is included. If it is included, the first row consists of ones. The next K rows will contain the data lagged by one time period. The remaining rows will contain further lags up to order p. The columns will contain time periods of which there are now N left after setting aside p pre-sample values for as lags.

Examples

1
2
3
4
5
6
K <- 3
N <- 6
p <- 2

Y <- matrix(seq_len(K*N), nrow = K)
Z <- Y2Z(Y, p)

nielsaka/zeitreihe documentation built on March 17, 2020, 8:38 p.m.