%% Test Purchasing Power Parity Using jcontest
% Load data on Australian and U.S. prices:

load Data_JAustralian
p1 = DataTable.PAU; % Log Australian Consumer Price Index
p2 = DataTable.PUS; % Log U.S. Consumer Price Index
s12 = DataTable.EXCH; % Log AUD/USD Exchange Rate
Y = [p1 p2 s12];
plot(dates,Y)
datetick('x','yyyy')
legend(series(1:3),'Location','Best')
grid on

%
% Pretest the individual series for stationarity:

[h0,pValue0] = jcontest(Y,1,'BVec',{[1 0 0]',[0 1 0]',[0 0 1]'})

%
% Test for cointegration:

[h1,pValue1] = jcitest(Y)

%
% Test for purchasing power parity (p1 = p2 + s12):

[h2,pValue2] = jcontest(Y,1,'BCon',[1 -1 -1]')

% Copyright 2015 The MathWorks, Inc.