%% Test Adjustment Speeds
% Tests on A answer questions about common driving forces in the system. When constructing constraints, interpret the rows and columns of the n-by- r matrix A as follows:
% Row i of A contains the adjustment speeds of variable y_{it} to disequilibrium in each of the r cointegrating relations.
% Column j of A contains the adjustment speeds of each of the n variables to disequilibrium in cointegrating relation j.
% For example, an all-zero row in A indicates a variable that is weakly exogenous with respect to the coefficients in B. Such a variable may affect other variables, but does not adjust to disequilibrium in the cointegrating relations. Similarly, a standard unit vector column in A indicates a variable that is exclusively adjusting to disequilibrium in a particular cointegrating relation.
% To demonstrate, we test for weak exogeneity of the inflation rate with respect to interest rates:

load Data_Canada
Y = Data(:,3:end); % Interest rate data
y1 = Data(:,1); % CPI-based inflation rate
YI = [y1,Y];

[hA,pValueA] = jcontest(YI,1,'ACon',[1 0 0 0]')

% The test fails to reject the null hypothesis. Again, the test is conducted with default settings. Proper economic inference would require a more careful analysis of model and rank specifications.
%
% Constrained parameter estimates are accessed via a fifth output argument from jcontest. For example, the constrained, rank 1 estimate of A is obtained by referencing the fifth output with dot (.) indexing:

[~,~,~,~,mles] = jcontest(YI,1,'ACon',[1 0 0 0]');
Acon = mles.paramVals.A

% The first row of A is 0, as specified by the constraint.
% Copyright 2015 The MathWorks, Inc.