% figure5.m

% Ron Alquist

% Bank of Canada

% January 2009


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

% Crude Oil Futures?"

clear all;

load prices.txt;

load pd.txt;

pddm = pd(:,3) - mean(pd(:,3));

date = prices(:,1:2);

s = prices(:,3);

f12m = prices(:,8);

sprd12m = 100*(f12m - s)./s;

sprdmat = [date sprd12m];

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

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

sprdmat1 = sprdmat(b:e,:);

sprd12m1 = sprdmat1(:,3);

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

plot(time,-1.5*sprd12m1,'b',time,pddm,'g--','LineWidth',2),legend('12-Month Spread*(-1)','VAR-Based Precautionary Demand Component of Spot Price'),axis([1989 2007 -100 100])

grid on;