%table_v_share_cbc.m 
%Country-by-country estimates of the Share of Variance explained by TOT shocks in the SVAR model % ``How Important Are Terms of Trade Shocks?''  by Stephanie Schmitt-Grohe and Martín Uribe. 
%(c) Stephanie Schmitt-Grohé and Martín Uribe, September 2016.

clear all
clc

%Baseline case: log quadratic detrended data

%TOT first
load sgu_tot_run_baaff.mat 
%produced with sgu_tot_run_baaff.m in directory: Z:\uribe\tot\IER\mfiles
ncou = numel(country_name); 

%disp('\hline')
for k=1:ncou
a = [country_name{k} ' ' num2str(v_share(k,:))];
%disp(a)
end
%disp('\hline')
b = ['Tot First Median ' num2str(median(v_share))];
disp(b)
c = ['Median Absolute Deviation' num2str(mad(v_share,1))];
%disp(c)
%disp('\hline')


%BAA-FF spread first (note: the first column  is the variance of the baaff spread expained by tot and the second column the variance of tot explained by tot)
load sgu_tot_run_baaff_first.mat 
%produced with sgu_tot_run_baaff_first.m in directory: Z:\uribe\tot\IER\mfiles

%HP 100 filtered data
%load sgu_tot_run_HP

ncou = numel(country_name); 

%disp('\hline')
for k=1:ncou
a = [country_name{k} ' ' num2str(v_share(k,:))];
%disp(a)
end
%disp('\hline')
b = ['BAA-FF first Median ' num2str(median(v_share))];
disp(b)
c = ['Median Absolute Deviation' num2str(mad(v_share,1))];
%disp(c)
%disp('\hline')
disp('Note. in the case of baaff first,  the first column  is the variance of the baaff spread explained by tot and the second column the variance of tot explained by tot. So, for display, switch these two columns to be comparable with the case tot first')