This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Estimate VEC Model Parameters Using egcitest

This example shows how to estimate the parameters of a vector error-correction (VEC) model. Before estimating VEC model parameters, you must determine whether there are any cointegrating relations (see Test for Cointegration Using the Engle-Granger Test). You can estimate the remaining VEC model coefficients using ordinary least squares (OLS).

Following from Test for Cointegration Using the Engle-Granger Test, load the Data_Canada data set. Run the Engle-Granger cointegration test on the small-term, medium-term, and long-term interest rate series.

load Data_Canada
Y = Data(:,3:end); % Interest rate data
[~,~,~,~,reg] = egcitest(Y,'test','t2');
c0 = reg.coeff(1);
b = reg.coeff(2:3);
beta = [1;-b];

Suppose that a model selection procedure indicates the adequacy of q = 2 lags in a VEC(q) model. Subsequently, the model is


Because you estimated c0 and β = [1; -b] previously, you can conditionally estimate α, B1, B2, and c1 by:

  1. Forming the required lagged differences

  2. Regress the first difference of the series onto the q lagged differences and the estimated cointegration term.

Form the lagged difference series.

q = 2;
[numObs,numDims] = size(Y);
tBase = (q+2):numObs;                    % Commensurate time base, all lags
T = length(tBase);                       % Effective sample size
YLags = lagmatrix(Y,0:(q+1));            % Y(t-k) on observed time base
LY = YLags(tBase,(numDims+1):2*numDims); % Y(t-1) on commensurate time base

Form multidimensional differences so that the kth numDims-wide block of columns in DelatYLags contains (1-L)Y(t-k+1).

DeltaYLags = zeros(T,(q+1)*numDims);
for k = 1:(q+1)
    DeltaYLags(:,((k-1)*numDims+1):k*numDims) = ...
               YLags(tBase,((k-1)*numDims+1):k*numDims) ...
             - YLags(tBase,(k*numDims+1):(k+1)*numDims);
DY = DeltaYLags(:,1:numDims);        % (1-L)Y(t)
DLY = DeltaYLags(:,(numDims+1):end); % [(1-L)Y(t-1),...,(1-L)Y(t-q)]

Regress the first difference of the series onto the q lagged differences and the estimated cointegration term. Include an intercept in the regression.

X = [(LY*beta-c0),DLY,ones(T,1)]; 
P = (X\DY)'; % [alpha,B1,...,Bq,c1]
alpha = P(:,1);
B1 = P(:,2:4);
B2 = P(:,5:7);
c1 = P(:,end);

Display the VEC model coefficients.

alpha = 3×1


b = 2×1


c0 = -1.2393
B1 = 3×3

    0.1649   -0.1465   -0.0416
   -0.0024    0.3816   -0.3716
    0.0815    0.1790   -0.1528

B2 = 3×3

   -0.3205    0.9506   -0.9514
   -0.1996    0.5169   -0.5211
   -0.1751    0.6061   -0.5419

c1 = 3×1


See Also


Related Examples

More About