协整检验使用Engle-Granger测试工程师t
This example shows how to test the null hypothesis that there are no cointegrating relationships among the response series composing a multivariate model.
LoadData_Canada
into the MATLAB® Workspace. The data set contains the term structure of Canadian interest rates[141]. Extract the short-term, medium-term, and long-term interest rate series.
loadData_CanadaY = Data(:,3:end);% Multivariate response series
Plot the response series.
figure plot(dates,Y,'LineWidth',2) xlabel'Year'; ylabel'Percent'; names = series(3:end); legend(names,'location','NW') title'{\bf Canadian Interest Rates, 1954-1994}'; axistightgridon
情节显示证据之间的协整three series, which move together with a mean-reverting spread.
To test for cointegration, compute both the
(t1
) and
(t2
) Dickey-Fuller statistics.egcitest
compares the test statistics to tabulated values of the Engle-Granger critical values.
[h,pValue,stat,cValue] = egcitest(Y,'test',{'t1','t2'})
h =1x2 logical array0 1
pValue =1×20.0526 0.0202
stat =1×2-3.9321 -25.4538
cValue =1×2-3.9563 -22.1153
The test fails to reject the null of no cointegration, but just barely, with ap-value only slightly above the default 5% significance level, and a statistic only slightly above the left-tail critical value. The test does reject the null of no cointegration.
The test regressesY(:,1)
onY(:,2:end)
and (by default) an interceptc0
. The residual series is
[Y(:,1) Y(:,2:end)]*beta
-c0
=Y(:,1)
-Y(:,2:end)*b
-c0
.
The fifth output argument ofegcitest
contains, among other regression statistics, the regression coefficientsc0
andb
.
Examine the regression coefficients to examine the hypothesized cointegrating vectorbeta
=[1; -b]
.
[~,~,~,~,reg] = egcitest(Y,'test','t2'); c0 = reg.coeff(1); b = reg.coeff(2:3); beta = [1;-b]; h = gca; COrd = h.ColorOrder; h.NextPlot ='ReplaceChildren'; h.ColorOrder = circshift(COrd,3);
plot(dates,Y*beta-c0,'LineWidth',2); title'{\bf Cointegrating Relation}'; axistight; legendoff; gridon;
The combination appears relatively stationary, as the test confirms.