# Gathering multiple IRFs

Hi,

is there a possibility to repeat one AR(1) shock multiple times in the same model and then plot the the frequency distribution of the highest deviation of a control variable from steady state (like the aggregate IRF)?

Best regards,
nbt

Note that this only makes sense at higher order. At first order, the IRFs will always be the same due to linearity.
If you want to do this at higher order, it requires you hacking the irf.m function of Dynare. Instead of averaging over different IRFs you need to store the individual draws.

thanks. I just tried doing it by hand, that is simulating the model repeatedly and storing the entry in the oo_/irfs. Why does the shock response always look the same? I thought in each simulation there would be a random shock imposed?

How would you manipulate the irf.m file to store the irfs? It would take me too long to get acquainted with the code in detail, time I havent got Would really appreciate your help!

No. The concept used is a generalized IRF. At first order, the IRFs will always be the same due to linearity. If you tried higher order, did you use a different seed for generating random shocks (see the manual)?

It should be sufficient to replace

``` for j = 1: replic ex1(:,i_exo_var) = randn(long+drop,nxs)*chol_S; ex2 = ex1; ex2(drop+1,:) = ex2(drop+1,:)+e1'; y1 = simult_(temps,dr,ex1,iorder); y2 = simult_(temps,dr,ex2,iorder); y = y+(y2(:,M_.maximum_lag+drop+1:end)-y1(:,M_.maximum_lag+drop+1:end)); end y=y/replic; ```
by

``` for j = 1: replic ex1(:,i_exo_var) = randn(long+drop,nxs)*chol_S; ex2 = ex1; ex2(drop+1,:) = ex2(drop+1,:)+e1'; y1 = simult_(temps,dr,ex1,iorder); y2 = simult_(temps,dr,ex2,iorder); y = y+(y2(:,M_.maximum_lag+drop+1:end)-y1(:,M_.maximum_lag+drop+1:end)); y_all(:,:,j)=y; end save IRFs y_all y=y/replic; ```
However, this is only a dirty hack without initialitizing y_all

Thank you Jpfeiffer. I think my problem is quite similar to this post (Are Dynare's stochastic shocks truely random?).
I know now that I have to add set_dynare_seed=(…) to the options of stoch_simul(…) instead of simul_seed (which seems to be outdated).
In the description of set_dynare_seed I see that there are two input argument a,b which correspond to the random number generator and its seed respectively.
According to the dynare manual one can also only put a single integer or double or expression in the argument set_dynare_seed(.).
But how exactly do I use this option. When I used 1 as an integer I got an error message on the mod file:
ERROR: BA_Perturbation_General.mod:40.45-59: syntax error, unexpected NAME