Dear Jpfeifer,
Many thanks for your instant help. Since I am not good at Matlab programming, I am a bit confused about the code in the replication file from your homepage.
- Code: Select all
/initialize IRF generation
initial_condition_states = repmat(oo_.dr.ys,1,M_.maximum_lag);
shock_matrix = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in colums
// set shocks for pure news
shock_matrix(1,strmatch('eps_z_news',M_.exo_names,'exact')) = 1; %set news shock to 1 (use any shock size you want)
shock_matrix(1+8,strmatch('eps_z_surprise',M_.exo_names,'exact')) = -1; %8 periods later use counteracting shock of -1
y2 = simult_(initial_condition_states,oo_.dr,shock_matrix,1);
y_IRF = y2(:,M_.maximum_lag+1:end)-repmat(oo_.dr.ys,1,options_.irf); %deviation from steady state
// manually select variables for figure
figure
subplot(2,1,1)
plot(y_IRF(strmatch('y',M_.endo_names,'exact'),:)); % use strmatch to select values
title('Output');
subplot(2,1,2)
plot(y_IRF(strmatch('z',M_.endo_names,'exact'),:));
title('TFP');
// Automatically loop over variables for figure (may require different setting for subplots in larger models)
figure
for ii=1:M_.orig_endo_nbr
subplot(3,3,ii)
if max(abs(y_IRF(ii,:)))>1e-12 %get rid of numerical inaccuracies
plot(y_IRF(ii,:));
else
plot(zeros(options_.irf,1));
end
title(deblank(M_.endo_names(ii,:)));
end
I think I need to modify some code to apply my model. How can I draw the IRF of the unrealized news shock to y,n,p_dc,c in my model? Besides, as your JEDC paper, I introduce both 4 period and 8 period news components, how can I set pure news? Moreover, I just generate Bayesian estimated IRF in my code, but it seems that your code file generates simulated IRF. Is it possible to generate Bayesian estimated IRF of unrealized shocks?