# Stoch_simul after estimation

Hello everyone

I would have a question: How to conduct stoch_simul after estimation

There are two steps

1. Step 1: estimating model
2. Step 2: using the estimated result to conduct the stochastic simulation

So I do step 1 by using the command:
estimation(…);
After estimating, I check that my model converge
So then I would use the estimated variance of shock to conduct the stochastic simulation
For example, my esimated result for variance of technology shock is reported by DYNARE as
SE_epsa 0.076 (post mean)
then to conduct the stochastic simulation, then I have to declare 2 following command blocks:

shocks;
var epsa; stderr 0.076; (I am not sure, assign as 0.076 or square root of 0.076?)
end;

stoch_simul(,period=40); (puting some varibles which is I would to see)

So my job is correct? if not, please correct me

By the way, after estimation, if we want to do stochastic simulation, then in dynare, we have to declare the estimated variance shock manually, like I did in the above example, right?

Thank you so much for that

That depends on what you want to do. If you want to run `stoch_simul` in a different `mod`-file, then you are right. If you want to run it after `estimation` in the same file, then you can simply put the `stoch_simul`-command after `estimation`. As documented in the manual

After running estimation, the parameters M_.params and the variance matrix M_.Sigma_e of the shocks are set to the mode for maximum likelihood estimation or posterior mode computation without Metropolis iterations.

If you want the posterior mean, you want preface the `stoch_simul` by

``````xparam1= get_posterior_parameters('mean');
M_ = set_all_parameters(xparam1,estim_params_,M_);

``````

Dear Prof @jpfeifer

Thank you so much indeed. I got it

I have 2 futher questions. Normally, to conduct impulse response of variables to shocks in the same file, then we use stoch_simul after estimation

However, in my procedure as

Step 1: I use estimation command only. I would make sure that my estimation converge before doing stoch_simul. My estimation converge with 300.000 draws (it takes 4 hours)

Geweke (1992) test indicates that allmost paramters converge at the significant level of 5% and 10%. Only 6 parameters converge at the significant level of 1%. Of course, the higher significant level, the better it is. However, in my case, conclusion of convergene is fine, right? If not, please correct me.

Step 2: if the conclusion of convergence is acceptable, then I would use the estimated results to conduct impulse response function with stoch_simul command. But I do not want to run estimation and MH algorithm again since it takes time. To do that, I simply recall previous mode-file and Metropolist-Hasting Algorithm by using command mode_file and load_mh_file in the estimation block

After that I will use the follwing command

xparam1= get_posterior_parameters(‘mean’);
M_ = set_all_parameters(xparam1,estim_params_,M_);
stoch_simul(…);

So in this case I can conduct the impulse response of variables to shocks at the posterior mean without re-estimating and running MH algorithm again
So my procedure is correct? (in this case, I am using dynare 4.4)

With best regards

Yes, that should be fine.

yes, thank you so much indeed prof. @jpfeifer