% Run and plot IRF of replication file and compare plotted results to
% Test July 2018

% US_CCF12 model

clear all;
clc;

% Adjust path to folder where replication file is stored
cd([cd '/mod_files']);

% Run replication dynare file
dynare replication_july18
eval([strcat('dy') '=' strcat('dY_plot;')]);
eval([strcat('y') '=' strcat('y_plot;')]);
eval([strcat('infl') '=' strcat('pi_plot;')]);
eval([strcat('FFR') '=' strcat('r_plot;')]);
eval([strcat('bondrate') '=' strcat('rL_plot;')]);
eval([strcat('riskprem') '=' strcat('RP_plot;')]);
eval([strcat('BLMVz') '=' strcat('BLMVz_plot;')]);


% Go back to original path
cd('..');


%%
style = ['--k  '; '-.b  '; ' :r  '; '  k  '];
lw = 2;
irf_len = 299;
close all

figure
plot(0:1:irf_len,BLMVz(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle = title('BLMVz')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)



figure
subplot(3,2,1)
plot(0:1:irf_len,dy(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle = title('Output Growth')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)
subplot(3,2,2)
plot(0:1:irf_len,y(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle = title('Output Level')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)
subplot(3,2,3)
plot(0:1:irf_len,infl(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle = title('Inflation')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)
subplot(3,2,4)
plot(0:1:irf_len,FFR(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle=title('Nominal Interest Rate')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)
yLabel=ylabel('%\Delta from ss')
set(yLabel,'FontSize',12)
subplot(3,2,5)
plot(0:1:irf_len,bondrate(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle = title('Nominal Interest Rate long')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)
subplot(3,2,6)
plot(0:1:irf_len,riskprem(1:irf_len+1)', style(1,:), 'LineWidth',lw)
hold on
plot(0:1:irf_len, 0*(0:1:irf_len)', style(4,:), 'LineWidth',0.5)
hTitle=title('Spread')
set(hTitle,'FontSize',12)
set(gca,'FontSize',12)



%hL = legend('GK13', 'ET14', 'CFP17');
% hL = legend('det', 'zlb');
% newPosition = [0.4 -0.0725 0.2 0.2];
% newUnits = 'normalized';
% set(hL,'Position', newPosition,'Units', newUnits,'Orientation', 'Horizontal', 'FontSize', 12);
% legend('boxoff')
% print('C:\Dropbox\Research Plan\Master Thesis\comp_graphs\QE_var', '-depsc')
% print('C:\Dropbox\Research Plan\Master Thesis\comp_graphs\QE_var', '-djpeg')




