VARfit: VAR(p) (Vector Autoregression) Model Fitting.

Description Usage Arguments Value See Also Examples

View source: R/VARfit.R

Description

Estimates a VAR(p) model from data. The function's purpose is to be used before the ACtest or archBootTest functions, and doesn't have the same full functionality as for example the function VAR in the vars package.

Usage

1
VARfit(y, p = 1, const = TRUE, trend = FALSE, exogen = NULL, univariate = FALSE)

Arguments

y

an N x K matrix containing the time series to be modeled.

p

the lag length of the VAR(p) process.

const

if TRUE (default) the model will include a constant.

trend

if TRUE the model will include a trend.

exogen

a matrix or vector of exogenous variable(s). Must have the same number of rows as 'y' does.

univariate

if TRUE univariate (i.e. an AR(p) model for each timeseries) estimates will also be printed.

Value

a list of class "VARfit" with the following slots:

y

the data matrix.

p

the lag length p.

N

the the number of observations/rows in the time series 'y'.

K

the the number of variables in the time series 'y'.

const

TRUE if the model included a constant.

trend

TRUE if the model included a trend.

exogen

the exogen variable(s).

Z

the [N - p] x [Kp + numberOf(const, trend, dummy)] design matrix, where the lags of the y matrix are appended.

call

how the function VARfit() was called.

coef

a matrix of the estimated parameters.

resid

the [N - p] x K matrix of residuals.

uniCoef

a matrix of the estimated parameter for the univariate case (an AR(p) for each column in 'y').

uniResid

the [N - p] x K matrix of residuals from the univariate (AR(p)) cases.

univariate

the 'univariate' argument.

NnonLagVar

the number of non-endogenous variables (i.e. the number of 'exogen' variables + const + trend).

description

who fitted the model and when.

time

computation time taken for the estimation.

See Also

ACtest to test for error autocorrelations, and archBootTest to test for ARCH errors.

Examples

1
fit <- VARfit(y = VodafoneCDS, p = 3, const = TRUE, trend = FALSE)

VARtests documentation built on May 2, 2019, 5:03 a.m.

Related to VARfit in VARtests...