Changing seed for impulse response calculations

Hi,

I was wondering if there is a way to change the seed for random number generator to calculate impulse response functions. I want to simulate impulse response functions numerous times, but every time I do it I get exactly the same magnitudes and I thought it might be a problem about the seed of the random number generator. I have tried `set_dynare_seed’ command to change the seed, but it did not work for impulse responses.

Thank you,

In the user guide pg 30 it says that unless you type simul_seed = INTEGER, a different sample is drawn with every run.

Hi wjgatt,

Thanks for the reply. I am using version 4 and it turns out that simul_seed is an obselete command for version 4. The relevant one is set_dynare_seed command, which only affects the data simulation but somehow not the impulse response calculations. I am not setting any seed at all in my .mod file and cannot find the seed in any of the .m files that calculates impulse responses. So always I get the same impulse responses, but I cannot find where the shocks are generated for the impulse responses to remove the seed if there is any. I would appreciate if you have an idea about where I can find the relevant shocks for impulse responses.

Thanks,

Hi, could you please post the mod-file.

Hi jpfeifer,

I am working on Smets-Wouters(2007, AER). Here is the .mod file and the other needed files.

Thank you very much for the reply.
smets_wouters_2007.rar (356 KB)

You are using a linear model. Hence, there are no higher order terms. First order IRFs are not computed via simulations as they do not differ across the state space. While the seed works, it is not used in your application, because there is nothing to simulate.

Hi jpfeifer,

Thanks a lot for the reply.

I understand that impulse responses are solutions to the model and they are not simulated. So the functions themselves should be same. But the magnitudes of the deviations from the steady state are calculated according to a, say, one standard deviation shock. The shock itself should be random, thus it must be generated with some random number generator. Thus even though I have the same impulse response functions, I should have different magnitudes of deviations from the steady state for a given random shock with the specified standard deviation. This is why I thought there must be a seed for these shocks to make sure that deviations from the steady state are always the same for the sake of replicability.

Since there is nothing to simulate, set_dynare_seed is not working for this case, but I can’t find where the shocks for IRFs are generated either.

Please let me know if there is knot in my thinking,

Thank you

The Dynare manual clearly states what is done. In the linear case a Cholesky decomposition of the covariance-matrix if performed. This gives you a defined size of the shock (if the covariance matrix is diagonal, this corresponds to a shock of exactly one standard deviation). As the IRF-function is the same irregardless of the state-space region and the size of the shock is given by the decomposed covariance matrix, there is no random number to be used. In the linear case, there is simply no reason to draw random shocks from the shock distribution and average the IRF across many trials. You can directly work with the covariance matrix.

The respective code in stoch_simul is

SS(M_.exo_names_orig_ord,M_.exo_names_orig_ord)=M_.Sigma_e+1e-14*eye(M_.exo_nbr) cs = transpose(chol(SS)) y=irf(oo_.dr,cs(M_.exo_names_orig_ord,i), options_.irf, options_.drop, ... options_.replic, options_.order);
where the second argument of irf is the shock vector with a one standard deviation size taken from the covariance matrix.