# vartovec

Vector autoregression (VAR) to vector error-correction model (VEC)

## Syntax

```[VEC,C] = vartovec(VAR)```

## Description

Given a vector autoregression (VAR) model, ```[VEC,C] = vartovec(VAR)``` converts VAR to an equivalent vector error-correction (VEC) model. A VAR(p) model of a time series y(t) has the form:

${A}_{0}y\left(t\right)={A}_{1}y\left(t-1\right)+...+{A}_{p}y\left(t-p\right)+\epsilon \left(t\right)$

The equivalent VEC(q) model, with q = p − 1, has the form:

${B}_{0}z\left(t\right)={B}_{1}z\left(t-1\right)+...+{B}_{q}z\left(t-q\right)+Cy\left(t-1\right)+\epsilon \left(t\right)$

where z(t) = y(t) − y(t − 1) and C is the error-correction coefficient.

## Input Arguments

 `VAR` The `VAR`(p) model to be converted to an equivalent `VEC`(q) model, with q = p − 1. VAR is specified by a (p + 1)-element cell vector of square matrices {`A0` `A1` ... `Ap`} associated with coefficients at lags 0, 1, ..., p. To represent a univariate model, `VAR` may be specified as a double-precision vector. Alternatively, `VAR` may be specified as a `LagOp` object or a `vgxset` object.

## Output Arguments

 `VEC` The `VEC` representation of the input `VAR` model. The data type and orientation of `VEC` is consistent with that of `VAR` `C` The error-correction coefficient. `C` is a square matrix the same size as the coefficients of the associated `VEC`.

## Examples

### Convert a VAR Model to a VEC Model

Specify a VAR(2) model of time series yt:

${y}_{t}={A}_{1}{y}_{t-1}+{A}_{2}{y}_{t-2}+{\epsilon }_{t}$

The coefficients are:

${A}_{1}=\left[\begin{array}{cc}-0.1& 0.3\\ 0.2& -0.1\end{array}\right]$

${A}_{2}=\left[\begin{array}{cc}-0.2& 0.8\\ -0.7& -0.4\end{array}\right]$

Enter the coefficients from the difference equation directly into a cell array:

```VAR = {eye(2) [-0.1 0.3 ; 0.2 -0.1] ... [-0.2 0.8 ; -0.7 -0.4]}; ```

Use `vartovec` to convert the VAR(2) model to an equivalent VEC(1) model:

```[VEC, C] = vartovec(VAR); ```

Since the original VAR model was specified as a cell array, the VEC model is also a cell array. The error correction coefficient argument is a matrix.

You can express the same VAR(2) model as a lag operator polynomial:

$\left(I-{A}_{1}L-{A}_{2}{L}^{2}\right){y}_{t}={\epsilon }_{t}$

Specify the model with the `LagOp` constructor:

```VAR_LAG = LagOp({eye(2) [0.1 -0.3 ; -0.2 0.1] ... [0.2 -0.8 ; 0.7 0.4]}); ```

Use `vartovec` to convert the VAR(2) model to an equivalent VEC(1) model:

```[VEC_LAG, C_LAG] = vartovec(VAR_LAG) ```
```VEC_LAG = 2-D Lag Operator Polynomial: ----------------------------- Coefficients: [Lag-Indexed Cell Array with 2 Non-Zero Coefficients] Lags: [0 1] Degree: 1 Dimension: 2 C_LAG = -1.3000 1.1000 -0.5000 -1.5000 ```

Since the input model is a lag operator polynomial the output model is also is a lag operator polynomial. See Specify Lag Operator Polynomials for more information on lag operator polynomials.

## More About

collapse all

### Algorithms

• Written as a polynomial in the lag operator Ly(t) = y(t − 1), a VAR(p) model has the form:

$\left({A}_{0}-{A}_{1}L-...-{A}_{p}{L}^{p}\right)y\left(t\right)=A\left(L\right)y\left(t\right)=\epsilon \left(t\right)$

The equivalent VEC(q) model has the form:

$\left({B}_{0}-{B}_{1}L-...-{B}_{q}{L}^{q}\right)z\left(t\right)=B\left(L\right)z\left(t\right)=Cy\left(t-1\right)+\epsilon \left(t\right)$

Thus, if `VAR` is specified as a `LagOp` object `A`, coefficients of lagged values of y(t) must be represented by the opposite of their values in standard difference-equation form, and the output `VEC` will follow a similar sign convention

• If `VAR` is specified as a `vgxset` object, the conversion involves only the `AR0`, `AR`, and `nAR` components of the model. Other model components are unaffected.

## References

[1] Hamilton, J. D. "Time Series Analysis." Princeton, NJ: Princeton University Press, 1994.

[2] Lutkepohl, H. "New Introduction to Multiple Time Series Analysis." Springer-Verlag, 2007.

## See Also

Was this topic helpful?

Get trial now