SIGMA = 1; % Elasticity of intertemporal substitution
KAPPA = 0.0516; % Slope of Phillips curve
BETTA = 0.9918; % Discount factor
RHON = 0.85; % Autocorrelation of natural rate
RHOC = 0; % Autocorrelation of cost push shock
CHI = 0.975; % Long-term bond coupon decay rate
DELTA = 0.3; % Steady-state ratio of long-term bonds to short-term bonds
N = 0.35; % Elasticity of long-term bond rate with respect to portfolio mix
XI = 3.2; % Elasticity of long-term bond rate with respect to change in portfolio mix
RHOQ = 0.9; % Autocorrelation of asset purchases
TP = 1.5; % taken from Falagiarda (2013)
TX = 0.1; %  taken from Falagiarda (2013)
GAMMA = N*DELTA + XI*(1 + BETTA);
DIS = 0; % used to simulate random QE shocks 

% creates a vector of random shocks 
% Importantly, sets seed as default in order to always draw the same random
% shocks

a = 0.001;
b = 0.11;
rng default;
qe = a*randn(1,5) + b;

% Loops over "DIS" and creates a simulated series for "rytm" stored in
% "yield"

for i=1:1:length(qe)
    DIS = qe(i);
    save test_parameterfile.mat SIGMA KAPPA BETTA RHON RHOC CHI DELTA N XI RHOQ TP TX GAMMA DIS
    dynare test.mod noclearall;
    yield(i) = rytm(2);
end;

rytm_qe_shock = figure;
    plot(qe, yield, 'LineWidth', 2);
    hold on;
    xlabel('qe', 'fontsize', 15);
    ylabel('yield','interpreter','latex', 'fontsize', 15);

%saveas(qe_yield, 'qe_yield.pdf')
% this is to set the parameters back to baseline in case you want to run 
% the mod files afterwards
run test_parameterfile.m
