% figure7a.m

% Ron Alquist

% Bank of Canada

% January 2009


% This program returns Figure 7a of Alquist and Kilian's "What Do We Learn From the Price of

% Crude Oil Futures?"

clear all;

load prices.txt;

load impvol1m.txt;

date = prices(:,1:2);

s = prices(:,3);

f1m = prices(:,4);

sprd1m = 100*(f1m-s)./s;

sprdmat = [date sprd1m];

b = find(sprdmat(:,1)==1989 & sprdmat(:,2)==1);

e = find(sprdmat(:,1)==2006 & sprdmat(:,2)==12);

sprdmat1 = sprdmat(b:e,:);

sprd1m1 = sprdmat1(:,3);

b1 = find(impvol1m(:,1)==1989 & impvol1m(:,2)==1);

e1 = find(impvol1m(:,1)==2006 & impvol1m(:,2)==12);

ivmat = impvol1m(b1:e1,:);

iv1mdm = ivmat(:,3) - mean(ivmat(:,3));

time = [1989 + 1/12 : 1/12 : 2007]';

[ax, h1, h2] = plotyy(time, -sprd1m1, time, iv1mdm, 'plot');

set(get(ax(1), 'Ylabel'), 'String', 'Percent');

set(h1, 'Color', 'k', 'LineWidth', 3);

axis(ax(1), [1989 2007 -6 6]);

ylim1 = get(ax(1), 'Ylim');

set(ax(1), 'Ytick', [ylim1(1) : 3 : ylim1(2)]);

set(ax(1), 'Xcolor', 'k', 'Ycolor', 'k');

set(get(ax(2), 'Ylabel'), 'String', 'US Dollars');

set(h2, 'LineStyle', '--', 'Color', 'b', 'LineWidth', 3);

set(ax(2), 'Xcolor', 'k', 'Ycolor', 'k');

axis(ax(2), [1989 2007 -100 100]);

ylim2 = get(ax(2), 'Ylim');

set(ax(2), 'Ytick', [ylim2(1) : 50 : ylim2(2)]);

legh = legend([h1 h2], '1-Month Spread*(-1) (Left Scale)', '1-Month Ahead Implied Volatility (Right Scale)');