%sgu_tot_ir.m  plotsthe cross-country median  impulse response to a 10% improvement in the terms of trade implied by the SVAR model in the paper  ``How Important Are Terms of Trade Shocks?''  by Stephanie Schmitt-Grohe and Martín Uribe. 
clear all
clf

load sgu_tot_run.mat IR
%produced by running sgu_tot_run.m
IR = IR*10;

%paper=1; 
paper =1
if paper ==1
    rows=3
    cols=2
    orient tall
else
    rows =2 
    cols =3
    orient portrait
end

T = size(IR,1);
ncou = size(IR,3);

pIR = median(IR,3);

t=(0:T-1)';

subplot(rows, cols,1)
plot(t,pIR(:,1),'linewidth',3)
hold on
plot(t,pIR(:,1)*0);
hold off
title('Terms of Trade')
ylabel('% dev. from trend')

subplot(rows, cols,2)
plot(t,pIR(:,2),'linewidth',3)
hold on
plot(t,pIR(:,2)*0);
hold off
title('Trade Balance')
%xlabel('years after the shock')
ylabel('% dev. from GDP trend')

subplot(rows, cols,3)
plot(t,pIR(:,3),'linewidth',3)
hold on
plot(t,pIR(:,3)*0);
hold off
title('Output')
%xlabel('years after the shock')
ylabel('% dev. from trend')

subplot(rows, cols,4)
plot(t,pIR(:,4),'linewidth',3)
hold on
plot(t,pIR(:,4)*0);
hold off
title('Consumption')
%xlabel('years after the shock')
ylabel('% dev. from trend')

subplot(rows, cols,5)
plot(t,pIR(:,5),'linewidth',3)
hold on

plot(t,pIR(:,5)*0);
hold off
title('Investment')
%xlabel('years after the shock')
ylabel('% dev. from trend')

subplot(rows, cols,6)
plot(t,pIR(:,6),'linewidth',3)
hold on

plot(t,pIR(:,6)*0);
hold off
title('Real Exchange Rate')
%xlabel('years after the shock')
ylabel('% dev. from trend')
shg