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 (seeTest for Cointegration Using the Engle-Granger Test). You can estimate the remaining VEC model coefficients using ordinary least squares (OLS).
Following fromTest for Cointegration Using the Engle-Granger Test, load theData_Canada
data set. Run the Engle-Granger cointegration test on the small-term, medium-term, and long-term interest rate series.
loadData_CanadaY =数据(:,3:结束);%的利率数据[~,~,~,~,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 ofq= 2 lags in a VEC(q) model.
Because you estimatedc0
and
=[1; -b]
previously, you can conditionally estimate
,B1
,B2
, andc1
by:
Forming the required lagged differences
Regress the first difference of the series onto theqlagged differences and the estimated cointegration term.
Form the lagged difference series.
q = 2;[numObs, numDims] = (Y)大小;tBase = (q + 2): numObs;% Commensurate time base, all lagsT = length(tBase);% Effective sample sizeYLags = lagmatrix(Y,0:(q+1));% Y(t-k) on observed time baseLY = YLags(tBase,(numDims+1):2*numDims);% Y(t-1) on commensurate time base
Form multidimensional differences so that the
numDims
-wide block of columns inDelatYLags
contains(1-L)Y(t-k+1)
.
DeltaYLags = zeros(T,(q+1)*numDims);fork = 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);endDY = 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 theqlagged 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×12.2209 -1.0718
c0 = -1.2393
B1 =3×30.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×10.1516 0.1508 0.1503