# Taking averages of multiple dynare_simul runs?

Hi,

Suppose I want to use dynare_simul() of the dynare++ package to simulate along a zero shock path in order to calculate some custom statistics such as correlation or some other non standard statistics, say the cube of correlation, of between two variables.

Everytime dynare_simul seems to give me different output, if I run dynare_simul multiple times ; sometimes the output is somewhat close to other runs , but sometimes the output are wildly different across runs.

Can I just take the average of the output of multiple runs of dynare_simul [across different simulation runs]? It seems the answer is no in a highly nonlinear system of equations with order=3

Or should I calculate the statistic first(eg. correlation), then average the correlation coefficient, instead of averaging the output path first then calculate the correlation between two averaged variables, say X and Y [whose output path has been averaged already across runs].

The second method is better, calculate a statistic for each simulation attempt. That would also give you standard errors of the statistics you are interested in (eg correlation).
It is normal that the variables differ in each attempt, that’s the essense of simulation. However, they should not be hugely different. If you get large discrepancies often, check for possible mistakes.

Kyriacos

Kyriacos’ suggestion makes sense to me. dynare_simul will give you a stochastic simulation, even when you specify zero shocks, so the results should not be the same. Some of this is explained in the help (‘help dynare_simul’). Also, be careful that you don’t get a path that is divergent. This can happen relatively easily in some models. There is a literature on ‘pruning’ that discusses this problem.

Hi all,

I know this post is somewhat old, but I have a follow up question.

dynare_simul does stochastic simulations, but why it gives different results even when same shock series is provided ?

Thanks,

I presume there is some simulated burnin phase, but this is hard to tell. In any case, if you dislike this feature, change the part

```% set seed seed = ceil(10000*rand(1,1)); ```
in dynare_simul.m

Thank you !