%% Estimate VEC Model Parameters Using jcitest
% In addition to testing for multiple cointegrating relations, jcitest produces maximum likelihood estimates of VEC model coefficients under the rank restrictions on B. Estimation information is returned in an optional fifth output argument, and can be displayed by setting an optional input parameter. For example, the following estimates a VEC(2) model of the data, and displays the results under each of the rank restrictions r = 0, r = 1, and r = 2:

load Data_Canada
Y = Data(:,3:end); % Interest rate data
[~,~,~,~,mles] = jcitest(Y,'model','H1','lags',2,...
    'display','params');

%
% mles is a tabular array of structure arrays, with each structure containing information for a particular test under a particular rank restriction. Since both tabular arrays and structure arrays use similar indexing, you can access the tabular array and then the structure using dot notation. For example, to access the rank 2 matrix of cointegrating relations:

B = mles.r2.paramVals.B

% Copyright 2015 The MathWorks, Inc.