www.gusucode.com > econ 案例源码程序 matlab代码 > econ/TestMultipleSeriesForCointegrationUsingJcitestExample.m

    %% Test Multiple Series for Cointegration Using jcitest
%%
% Load data on term structure of interest rates in Canada:

% Copyright 2015 The MathWorks, Inc.

load Data_Canada
Y = Data(:,3:end);
names = series(3:end);
plot(dates,Y)
legend(names,'location','NW')
grid on
%%
% Test for cointegration:
[h,pValue,stat,cValue,mles] = jcitest(Y,'model','H1');
h,pValue
%%
% Plot estimated cointegrating relations $B^\prime y_{t - 1} + c_0$:
YLag = Y(2:end,:);
T = size(YLag,1);
B = mles.r2.paramVals.B;
c0 = mles.r2.paramVals.c0;  
plot(dates(2:end),YLag*B+repmat(c0',T,1))
grid on