VAR: Vector Autoregression

Description Usage Arguments Examples

View source: R/fastVAR.R

Description

Fit a VAR model by creating the lagged design matrix and fitting a multivariate response matrix to it. Note that the VAR response matrix omits the first p responses from the input matrix Y. This is because observations in Y are modeled by the p previous values, so the first p observations cannot be modeled.

Usage

1
2
  VAR(y, freq = rep(NA, ncol(y)), p = 1, intercept = T,
    weights = NULL, l2penalty = NULL, getdiag = T)

Arguments

y

A matrix where each column represents an individual time series

freq

only used if the time series are periodic. freq is a vector of frequencies for each of the time series, as in 'ts(y, freq = ...)'. If the time series are not periodic, then this vector can be a vector of NA

p

the number of lags to include in the design matrix

intercept

logical. If true, include an intercept term in the model

weights

weights applied to the multiresponse linear regression. Better predictions might come from weighting observations far in the past less so they impact the objective value less. Either NULL, "exponential", or "linear"

l2penalty

a ridge regression penalty, useful when the design matrix is very wide, which may happen if p is large.

getdiag

logical. If true, return diagnostics

Examples

1
2
data(Canada)
  VAR(Canada, p = 3, intercept = F)

jeffwong/fastVAR documentation built on May 19, 2019, 4:02 a.m.