Main Content

vec2var

Convert VEC model to VAR model

Description

Econometrics Toolbox™ VAR model functions such as simulate, forecast, and armairf are appropriate for vector autoregression (VAR) models. To simulate, forecast, or generate impulse responses from a vector error-correction (VEC) model using simulate, forecast, or armairf, respectively, convert the VEC model to its equivalent VAR model representation.

example

VAR = vec2var(VEC,C) returns the coefficient matrices (VAR) of the vector autoregressive model equivalent to the vector error-correction model with coefficient matrices (VEC). If the number of lags in the input vector error-correction model is q, then the number of lags in the output vector error-correction model is p = q + 1.

Examples

collapse all

Consider converting the following VEC(2) model to a VAR(3) model.

Δyt=[0.51-2]+[-0.140.12-0.05-0.14-0.07-0.10-0.07-0.16-0.07]Δyt-1+[-0.140.12-0.05-0.14-0.07-0.10-0.07-0.16-0.07]Δyt-2+[-0.320.74-0.381.97-0.610.44-2.19-1.152.65]yt-1+εt.

Specify the coefficient matrices (B1 and B2) of Δyt-1 and Δyt-2, and the error-correction coefficient C.

B1 = [-0.14   0.12 -0.05;
      -0.14 -0.07 -0.10;
      -0.07  -0.16 -0.07];
B2 = [-0.14   0.12 -0.05;
      -0.14 -0.07 -0.10;
      -0.07  -0.16 -0.07]; 
C  = [-0.32  0.74 -0.38;
       1.97 -0.61  0.44;
     - 2.19 -1.15  2.65];

Pack the matrices into separate cells of a 2-dimensional cell vector. Put B1 into the first cell and B2 into the second cell.

VEC = {B1 B2};

Compute the coefficient matrices of the equivalent VAR(3) model.

VAR = vec2var(VEC,C);
size(VAR)
ans = 1×2

     1     3

The specification of a cell array of matrices for the input argument indicates that the VEC(2) model is in reduced form, and VEC{1} is the coefficient of Δyt-1. Subsequent elements correspond to subsequent lags.

VAR is a 1-by-3 cell vector of 3-by-3 coefficient matrices for the VAR(3) equivalent of the VEC(2) model. Because the VEC(2) model is in reduced form, the equivalent VAR(3) model is as well. That is, VAR{1} is the coefficient of yt-1, and subsequent elements correspond to subsequent lags. The orientation of VAR corresponds to the orientation of VEC.

Display the VAR(3) model coefficients.

A1 = VAR{1}
A1 = 3×3

    0.5400    0.8600   -0.4300
    1.8300    0.3200    0.3400
   -2.2600   -1.3100    3.5800

A2 = VAR{2}
A2 = 3×3

     0     0     0
     0     0     0
     0     0     0

A3 = VAR{3}
A3 = 3×3

    0.1400   -0.1200    0.0500
    0.1400    0.0700    0.1000
    0.0700    0.1600    0.0700

Since the constant offsets between the models are equivalent, the resulting VAR(3) model is

yt=[0.51-2]+[0.540.86-0.431.830.320.34-2.26-1.313.58]yt-1+[0.14-0.120.050.140.070.100.070.160.07]yt-3+εt.

Consider converting the following structural VEC(1) model to a structural VAR(2) model.

[0.54-2.261.830.86]Δyt=[-0.07-0.070.010.02]Δyt-1+[-0.151.9-3.15-0.54]yt-1+εt.

Specify the coefficient matrices B0 and B1, and the error-correction coefficient C.

B0 = [0.54 -2.26;
      1.83  0.86];
B1 = [-0.07  -0.07
     0.01 0.02];
C = [-0.15  1.9;
     -3.15  -0.54];

Pack the matrices into separate cells of a 3-dimensional cell vector. Put B0 into the first cell and B1 into the second cell. Negate the coefficients corresponding to all nonzero differenced lag terms.

VECCoeff = {B0; -B1};

Create a lag operator polynomial that encompasses the autoregressive terms in the VEC(2) model.

VEC = LagOp(VECCoeff)
VEC = 
    2-D Lag Operator Polynomial:
    -----------------------------
        Coefficients: [Lag-Indexed Cell Array with 2 Non-Zero Coefficients]
                Lags: [0 1]
              Degree: 1
           Dimension: 2

VEC is a LagOp lag operator polynomial, and specifies the autoregressive lag operator polynomial in this equation

(B0-B1L)Δyt=Cyt-1+εt.

L is the lag operator. If you expand the quantity and solve for Δyt, then the result is the VAR(2) model in difference-equation notation.

Compute the coefficient matrices of the equivalent VAR(2) model.

VAR = vec2var(VEC,C)
VAR = 
    2-D Lag Operator Polynomial:
    -----------------------------
        Coefficients: [Lag-Indexed Cell Array with 3 Non-Zero Coefficients]
                Lags: [0 1 2]
              Degree: 2
           Dimension: 2

VEC.Coefficients{0} is A0, the coefficient matrix of yt. Subsequent elements in VAR.Coefficients correspond to subsequent lags in VEC.Lags.

VAR is the VAR(2) equivalent of the VEC(1) model. Because the VEC(1) model is structural, the equivalent VAR(2) is as well. That is, VAR.Coefficients{0} is the coefficient of yt, and subsequent elements correspond to subsequent lags in VAR.Lags.

Display the VAR(2) model coefficients in difference-equation notation.

A0 = VAR.Coefficients{0}
A0 = 2×2

    0.5400   -2.2600
    1.8300    0.8600

A1 = -VAR.Coefficients{1}
A1 = 2×2

    0.3200   -0.4300
   -1.3100    0.3400

A2 = -VAR.Coefficients{2}
A2 = 2×2

    0.0700    0.0700
   -0.0100   -0.0200

The resulting VAR(3) model is

[0.54-2.261.830.86]yt=[0.32-0.43-1.310.34]yt-1+[0.070.07-0.01-0.02]yt-2+εt.

Alternatively, reflect the lag operator polynomial VAR around lag 0 to obtain the difference-equation notation coefficients.

DiffEqnCoeffs = reflect(VAR);
A = toCellArray(DiffEqnCoeffs);
A{1} == A0
ans = 2x2 logical array

   1   1
   1   1

A{2} == A1
ans = 2x2 logical array

   1   1
   1   1

A{3} == A2
ans = 2x2 logical array

   1   1
   1   1

Both methods produce the same coefficients.

Approximate the coefficients of the structural VMA model that represents the structural VEC(8) model

{[10.2-0.10.031-0.150.9-0.251]+[0.5-0.2-0.1-0.3-0.10.10.4-0.2-0.05]L4+[0.05-0.02-0.01-0.1-0.01-0.0010.04-0.02-0.005]L8}Δyt=[-0.020.030.30.050.10.010.30.010.01]yt-1+εt

where Δyt=[Δyt,1Δyt,2Δyt,3], εt=[ε1tε2tε3t], and, for j = 1,2, and 3, Δyt,j=yt,j-yt-1,j.

Create a cell vector containing the VEC(8) model coefficient matrices. Start with the coefficient of Δyt, and then enter the rest in order by lag. Construct a vector that indicates the degree of the lag term for the corresponding coefficients.

VEC0 = {[1 0.2 -0.1; 0.03 1 -0.15; 0.9 -0.25 1],...
    [0.5 -0.2 -0.1; -0.3 -0.1 0.1; 0.4 -0.2 -0.05],...
    [0.05 -0.02 -0.01; -0.1 -0.01 -0.001; 0.04 -0.02 -0.005]};
vec0Lags = [0 4 8];
C = [-0.02 0.03 0.3; 0.05 0.1 0.01; 0.3 0.01 0.01];

vec2var requires a LagOp lag operator polynomial for an input argument that comprises a structural VEC(8) model. Construct a LagOp lag operator polynomial that describes the VEC(8) model autoregressive coefficient matrix component (i.e., the coefficients of Δyt and its lags).

VECLag = LagOp(VEC0,'Lags',vec0Lags);

VECLag is a LagOp lag operator polynomial that describes the autoregressive component of the VEC(8) model.

Compute the coefficients of the VAR(9) model equivalent to the VEC(8) model.

VAR = vec2var(VECLag,C)
VAR = 
    3-D Lag Operator Polynomial:
    -----------------------------
        Coefficients: [Lag-Indexed Cell Array with 6 Non-Zero Coefficients]
                Lags: [0 1 4 5 8 9]
              Degree: 9
           Dimension: 3

VAR is a LagOp lag operator polynomial. All coefficients except those corresponding to lags 0, 1, 4, 5, 8, and 9 are 3-by-3 matrices of zeros. The coefficients in VAR comprise a stable, structural VAR(9) model equivalent to the original VEC(8) model. The model is stable because the error-correction coefficient has full rank.

Compute the coefficients of the VMA model approximation to the resulting VAR(9) model. Set numLags to return at most 12 lags.

numLags = 12;
VMA = arma2ma(VAR,[],numLags);

VMA is a LagOp lag operator polynomial containing the coefficient matrices of the resulting VMA(12) model in VMA.Coefficients. VMA{0} is the coefficient of εt, VMA{1} is the coefficient of εt-1, and so on.

Input Arguments

collapse all

VEC(q) model coefficients of differenced responses, specified as a numeric vector, a cell vector of n-by-n numeric matrices, or a LagOp lag operator polynomial object.

  • For a numeric vector specification:

    • The VEC(q) is a univariate time series.

    • VEC must be a length q numeric vector.

    • VEC(j) contains the scalar Bj, the coefficient of the lagged difference Δytj.

    • The coefficient of Δyt (B0) is 1.

  • For a cell vector specification:

    • VEC must have length q, and each cell contains an n-by-n numeric matrix (n > 1).

    • VEC{j} must contain Bj, the coefficient matrix of the lag term Δytj.

    • vec2var assumes that the coefficient of Δyt (B0) is the n-by-n identity.

  • For a LagOp lag operator polynomial specification:

    • VEC.Degree must be q.

    • VEC.Coefficients{0} is B0, the coefficient of Δyt. All other elements correspond to the coefficients of the subsequent lagged, differenced terms. For example, VEC.Coefficients{j} is the coefficient matrix of Δytj. VEC.Lags stores all nonzero lags.

    • To construct a model in reduced form, set VEC.Coefficients{0} to eye(VEC.Dimension).

For example, consider converting

[1001]Δyt=[0.10.210.1]Δyt1+[0.10.010.20.3]Δyt2+[0.500.11]yt1+εt

to a VAR(3) model. The model is in difference-equation notation. You can convert the model by entering

VAR = vec2var({[0.1 0.2; 1 0.1],...
     -[-0.1 0.01; 0.2 -0.3]},[0.5 0; -0.1 1]);
The VEC(2) model in lag operator notation is

([1001][0.10.210.1]L[0.10.010.20.3]L2)Δyt=[0.500.11]yt1+εt

The AR coefficient matrices of the lagged responses appear negated compared to the corresponding coefficients in difference-equation notation. To obtain the same result using LagOP lag operator polynomials, enter

VEC = LagOp({eye(2), -[0.1 0.2; 1 0.1], -[-0.1 0.01; 0.2 -0.3]});
C = [0.5 0; -0.1 1];
VAR = vec2var(VEC,C);

Error-correction coefficient, specified as an n-by-n numeric matrix. n is the number of time series in the VEC model. The dimensions of C and the matrices composing VEC must be equivalent.

Data Types: double

Output Arguments

collapse all

VAR(p) model coefficients, returned as a a numeric vector, cell vector of n-by-n numeric matrices, or a LagOp lag operator polynomial object. n is the number of time series in the VEC model.

VEC and VAR share the same data type and orientation.

vec2var converts VEC(q) models to VAR(q + 1) models. That is:

  • If VEC is a cell or numeric vector, then numel(VAR) is numel(VEC) + 1.

  • If VEC is a LagOp lag operator polynomial, then VAR.Degree is VEC.Degree + 1.

More About

collapse all

Difference-Equation Notation

A VAR(p) or VEC(q) model written in difference-equation notation isolates the present value of the response vector and its structural coefficient matrix on the left side of the equation. The right side of the equation contains the sum of the lagged responses, their coefficient matrices, the present innovation vector, and, for VEC models, the error-correction term.

That is, a VAR(p) model written in difference-equation notation is

A0yt=a+A1yt1+A2yt2+...+Apytp+εt.

A VEC(q) model written in difference equation notation is

B0Δyt=b+B1Δyt1+B2Δyt2+...+BqΔytq+Cyt1+εt.

For the variable and parameter definitions, see VAR(p) Model and VEC(q) Model.

Lag Operator Notation

A VAR(p) or VEC(q) model written in lag-operator notation positions all response terms to the left side of the equation. The right side of the equation contains the model constant offset vector, the present innovation, and, for VEC models, the error-correction term.

That is, a VAR(p) model written in lag-operator notation is

A(L)yt=a+εt

where A(L)=A0A1LA2L2...ApLp and Ljyt=ytj.

A VEC(q) model written in difference equation notation is

B(L)Δyt=b+Cyt1+εt

where B(L)=B0B1LB2L2...BqLq.

For the variable and parameter definitions, see VAR(p) Model and VEC(q) Model.

When comparing lag operator notation to difference-equation notation, the signs of the lag terms are opposites. For more details, see Lag Operator Notation.

VAR(p) Model

A VAR(p) model is a multivariate, autoregressive time series model that has this general form:

A0yt=a+A1yt1+A2yt2+...+Apytp+εt.

  • yt is an n-dimensional time series.

  • A0 is the n-by-n invertible structural coefficient matrix. For models in reduced form, A0 = In, which is the n-dimensional identity matrix.

  • a is an n-dimensional vector of constant offsets.

  • Aj is the n-by-n coefficient matrix of yt–j, j = 1,...,p.

  • εt is an n-dimensional innovations series. The innovations are serially uncorrelated, and have a multivariate normal distribution with mean 0 and n-by-n covariance matrix Σ.

VEC(q) Model

A VEC(q) model is a multivariate, autoregressive time series model that has this general form:

B0Δyt=b+B1Δyt1+B2Δyt2+...+BqΔytq+Cyt1+εt.

  • yt is an n-dimensional time series.

  • Δ is the first difference operator, that is, Δyt = ytyt–1.

  • B0 is the n-by-n invertible structural coefficient matrix. For models in reduced form, B0 = In, which is the n-dimensional identity matrix.

  • b is an n-dimensional vector of constant offsets.

  • Bj is the n-by-n coefficient matrix of Δyt–j, j = 1,...,q.

  • εt is an n-dimensional innovations series. The innovations are serially uncorrelated, and have a multivariate normal distribution with mean 0 and n-by-n covariance matrix Σ.

  • C is the n-by-n error-correction or impact coefficient matrix.

Tips

  • To accommodate structural VEC models, specify the input argument VEC as a LagOp lag operator polynomial.

  • To access the cell vector of the lag operator polynomial coefficients of the output argument VAR, enter toCellArray(VAR).

  • To convert the model coefficients of the output argument from lag operator notation to the model coefficients in difference-equation notation, enter

    VARDEN = toCellArray(reflect(VAR));
    VARDEN is a cell vector containing q + 1 coefficients corresponding to the response terms in VAR.Lags in difference-equation notation. The first element is the coefficient of yt, the second element is the coefficient of yt–1, and so on.

  • The constant offset of the converted VAR model is the same as the constant offset of the VEC model.

Algorithms

  • vec2var does not impose stability requirements on the coefficients. To check for stability, use isStable.

    isStable requires a LagOp lag operator polynomial as input. For example, to check whether VAR, the cell array of n-byn numeric matrices, composes a stable time series, enter

    varLagOp = LagOp([eye(n) var]);
    isStable(varLagOp)

    A 0 indicates that the polynomial is not stable. If VAR is a LagOp lag operator polynomial, then pass it to isStable.

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.

Version History

Introduced in R2015b