% Note: The chain provided with the code in mhall_RBC.mat has 25000 draws for file size considerations. 
% To produce the full posterior distribution the chain length should be set to S_.Options.EST.N = 750000 
% in line 20 of run_mcmc.m

addpath functions

load mhall_RBC.mat
load mhall_singleequation.mat

S_.param = param_func(params_xx_mode);

figure('Name','Posterior of z Comparison', 'Position', [1 1 1000 800]);
edgevec = -1 : 0.03 : 2.5;
set(0,'defaulttextinterpreter','latex')

[n,bin] = histc((100*4*0.0055082 + params_xx_out(:,S_.param.order.Delta_z).*4),edgevec);
p1= bar(edgevec,n./(size(bin,1)));
set(p1,'FaceColor',[0.6836    0.1250    0.2617], 'EdgeColor', [1 1 1], 'FaceAlpha',0.7);
hold on
[n_se, bin_se] = histc((100*4*xx_out(:,end)),edgevec);
p1_se= bar(edgevec,n_se./(size(bin_se,1)));
set(p1_se,'FaceColor',[ 0.1529    0.3490    0.1765], 'EdgeColor', [1 1 1], 'FaceAlpha',0.7);
xlim([-1 2.5]);
xticks([-1 -0.5 0 0.5 1 1.5 2 2.5])
box on; grid off;
xline(100*4*0.0055082, 'LineWidth', 2.5, 'Color', [0.0, 0.18, 0.39])
set(gca, 'Box', 'off', 'TickLabelInterpreter','latex', 'ytick', [], 'YColor', 'none')
ax = gca;
ax.XAxis.FontSize = 18;
ax.YAxis.FontSize = 18;
xlabel('\% per year', 'FontSize',16)
set(gcf,'Color','w')
lgnd = legend('Posterior Distribution of Final Trend Growth Rate $z^\prime$ in Structural Model', 'Posterior Distribution of Final Trend Growth Rate $z^\prime$ in Unobserved Components Model', 'Initial Trend Growth Rate $z$' );
set(lgnd,'Box','off', 'Interpreter','latex', 'NumColumns',1, 'Fontsize',18, 'Location','southoutside')
%lgnd.Position(1) = 0.15;
%lgnd.Position(2) = -0.01;
%lgnd.Position(3) = 0.8;
print -depsc '-r600' Figure_12.eps

