Learn R Programming

dfms (version 0.2.2)

.VAR: (Fast) Barebones Vector-Autoregression

Description

Quickly estimate a VAR(p) model using Armadillo's inverse function.

Usage

.VAR(x, p = 1L)

Value

A list containing matrices Y = x[-(1:p), ], X which contains lags 1 - p of x combined column-wise, A which is the \(np \times n\) transition matrix, where n is the number of series in x, and the VAR residual matrix res = Y - X %*% A.

A list with the following elements:

Y

x[-(1:p), ].

X

lags 1 - p of x combined column-wise.

A

\(np \times n\) transition matrix, where n is the number of series in x.

res

VAR residual matrix: Y - X %*% A.

Arguments

x

data numeric matrix with time series in columns - without missing values.

p

positive integer. The lag order of the VAR.

Examples

Run this code
var = .VAR(diff(EuStockMarkets), 3)
str(var)
var$A
rm(var)

Run the code above in your browser using DataLab