%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linear Multiplier
% 2024年5月30日
% Author: Lapulacat
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear;

load("taxmul.mat") 

irf_periods = 40;
taxname = 'tr';
taxshock = ['e_', taxname];

impulse_vec=zeros(1,M_.exo_nbr);
impulse_vec(strmatch(taxshock, M_.exo_names, 'exact'))=0.001;

shocks_baseline = zeros(irf_periods,M_.exo_nbr);
shocks_impulse = shocks_baseline;
shocks_impulse(1,:) = shocks_baseline(1,:) + impulse_vec;

starting_point=oo_.dr.ys; 
%%
y_baseline = simult_(M_,options_,starting_point,oo_.dr,shocks_baseline,options_.order); 
y_shock = simult_(M_,options_,starting_point,oo_.dr,shocks_impulse,options_.order); 

%%
IRF_mat=NaN(M_.endo_nbr,irf_periods);
IRF_mat = (y_shock(:,M_.maximum_lag+1:end)-y_baseline(:,M_.maximum_lag+1:end)); 

%%
figure('Name', 'Mul')
plot(1:irf_periods, ...
        cumsum(IRF_mat(strmatch('y',M_.endo_names,'exact'),:))...
        ./cumsum(IRF_mat(strmatch(taxname,M_.endo_names,'exact'),:)), ...
        'r-')





