clear all;

taumax = 18;
gridfine = 0.01;
ngrid = 1/gridfine;
N = taumax/gridfine;
wH = 2307;% value from line 9 of Table 1
wL = 1032;% value from line 9 of Table 1
xH = log(-log(0.334));% value from line 9 of Table 1
xL = log(-log(0.900));% value from line 9 of Table 1
d = 0.0174;% value from line 9 of Table 1
tstart = 1/gridfine;
t = tstart:N;
t = t*gridfine;
zL = exp(xL + d*t)*gridfine;
zL = exp(-cumsum(zL));
zL = zL*wL;
zH = exp(xH + d*t)*gridfine;
zH = exp(-cumsum(zH));
zH = zH*wH;
hpred = zL + zH;

wH = 2215;% value from line 7 of Table 1
wL = 1123;% value from line 7 of Table 1
xH = log(-log(0.312));% value from line 7 of Table 1
xL = log(-log(0.884));% value from line 7 of Table 1
d = 0.0;% value from line 7 of Table 1

zL = exp(xL + d*t)*gridfine;
zL = exp(-cumsum(zL));
zL = zL*wL;
zH = exp(xH + d*t)*gridfine;
zH = exp(-cumsum(zH));
zH = zH*wH;

g1 = figure
hold on;
plot(t,zL,'-','LineWidth',5,'Color',[1 0 0])
plot(t,zL+zH,':','LineWidth',3,'Color',[0 0 1])
set(gca,'FontSize',20)
xlabel('Duration of unemployment (n)')
ylabel('Average number of unemployed (in thousands)')
title('Great Recession')
str1=sprintf('w_Lp_L^n', 176);
text(1.2,500,str1, 'fontsize', 20)
str2=sprintf('w_Lp_L^n + w_Hp_H^n', 176);
text(2.5,1500,str2, 'fontsize', 20)
plot(1,hpred(1),'k.','MarkerSize',40)
plot(3,hpred((3-1)*ngrid),'k.','MarkerSize',40)
plot(5,hpred((5-1)*ngrid),'k.','MarkerSize',40)
plot(9.5,hpred((9.5-1)*ngrid),'k.','MarkerSize',40)
plot(15,hpred((15-1)*ngrid),'k.','MarkerSize',40)
hold off;
saveas(g1,'graph_GR','epsc');



