Documentation

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

`$\Delta {y}_{t}=\alpha \left({\beta }^{\prime }{y}_{t-1}+{c}_{0}\right)+\sum _{i=1}^{2}{B}_{i}\Delta {y}_{t-i}+{c}_{1}+{\epsilon }_{t}.$`

Because you estimated `c0` and $\beta$ = `[1; -b]` previously, you can conditionally estimate $\alpha$, `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 ${k}^{th}$ `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); end 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,b,c0,B1,B2,c1`
```alpha = 3×1 -0.6336 0.0595 0.0269 ```
```b = 2×1 2.2209 -1.0718 ```
```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 0.1516 0.1508 0.1503 ```