Using same sequence of shocks in two models


I have a very basic question that I am sure could be readily answered by a Dynare specialist. I went through the documentation but did not find anything enlightening on this issue.

I have two mod files to simulate similar, but different, models. I would like to simulate one model, and then apply the exact same sequence of shocks to the second one so as to compare the responses of the endogenous variables. Anyone knows a fast way to input the oo_.exo_simul sequence in the second model? Thanks a lot in advance!

I just noticed that stoch_simul seems to use a fixed seed, so my problem is fixed. Thanks.


Yes the seed of the random generators is fixed but it may be risky to rely on this and it’s not really general. For instance, you could not handle a case where in the second model you have an additional shock and/or a case where the number of periods is greater in the second model. Also if in the second mod file you call a routine/command that generates random numbers (that’s not always transparent) before the call to stoch_simul you won’t get the same numbers for the shocks. I think that the safest (and more general) approach is two write both models in the same model block. This is what we do when we simulate models with efficient and non efficient variables (to compute an output gap for instance).


Thanks for the tip, didn’t know you could do that. Much obliged!