Setting 'seed' for replicating estimation results

Each time I run my estimation .mod file, I get slightly different results even though I do not change any of the code, and I was wondering if there’s some way of ensuring that I always get the same results. For example, is there a way of setting a “seed” as part of the estimation command? So far, I found that DYNARE has a function called “simul_seed,” but that doesn’t seem to apply to estimation (only to simulation). I also found that increasing mh_replic doesn’t solve the problem. The command I am using is:

estimation(datafile=datapullcggjpn,conf_sig=.95,filtered_vars,smoother,first_obs=1,nobs=66,mode_check,mode_compute=1,mh_replic=1000,mh_jscale=0.5,mh_nblocks=1) piestar rstar;

Thanks in advance for any help!


Hi Daniel,

You can set the seed using matlab functions, just before the estimation command. You need to set a seed for the uniform random number generator and another for the gaussian random number generator (the seeds are different, look at the matlab documentation).

Best, Stéphane.

Thanks! It worked, I put the following in front of the estimation command:

rand(‘seed’,122); randn(‘seed’,123);