Changing seed for impulse response calculations

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Changing seed for impulse response calculations

Postby bruzzle » Tue Jul 05, 2011 12:18 pm

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,
bruzzle
 
Posts: 13
Joined: Fri Apr 30, 2010 11:52 am

Re: Changing seed for impulse response calculations

Postby wjgatt » Thu Jul 07, 2011 5:20 pm

In the user guide pg 30 it says that unless you type simul_seed = INTEGER, a different sample is drawn with every run.
wjgatt
 
Posts: 23
Joined: Thu Jun 16, 2011 7:23 pm

Re: Changing seed for impulse response calculations

Postby bruzzle » Thu Jul 07, 2011 8:26 pm

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,
bruzzle
 
Posts: 13
Joined: Fri Apr 30, 2010 11:52 am

Re: Changing seed for impulse response calculations

Postby jpfeifer » Fri Jul 08, 2011 9:03 am

Hi, could you please post the mod-file.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Changing seed for impulse response calculations

Postby bruzzle » Sat Jul 09, 2011 8:01 am

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.
Attachments
smets_wouters_2007.rar
(355.99 KiB) Downloaded 198 times
bruzzle
 
Posts: 13
Joined: Fri Apr 30, 2010 11:52 am

Re: Changing seed for impulse response calculations

Postby jpfeifer » Sat Jul 09, 2011 12:26 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Changing seed for impulse response calculations

Postby bruzzle » Sat Jul 09, 2011 1:52 pm

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
bruzzle
 
Posts: 13
Joined: Fri Apr 30, 2010 11:52 am

Re: Changing seed for impulse response calculations

Postby jpfeifer » Mon Jul 11, 2011 5:32 pm

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
Code: Select all
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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 11 guests