I would have a question: How to conduct stoch_simul after estimation
There are two steps
Step 1: estimating model
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?
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
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
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)
Is there any way to save the estimated results so in another day when launch matlab to do the simulation with the same model file, I won’t need to run estimation again?
I mean the posterior we get, I know it is saved in my disk. In my disk, it has generated serval folders after estimation. I can only understand the use of first folder named graphs.
I want to know if there is any code to save posterior in another file so I can simply load this file and run simulation without changing my model file. Or maybe this file is indeed saved in my disk, I just didn’t find it.
Because I closed the matlab after estimation last time and I can now only find some graphs and some files whose purpose is unknown to me.
In prior folder, there are a definition file and my_model file, I wonder if these are what I need.
Everything you need should be saved in the _results.mat file. You can use that to read out the posterior mean/mode for another mod-file with the same model. Using a copied version of the mod-file then also makes sure you are not overwriting any generated estimation results.
But I finished my estimation before I read your reply at another post where you said the prior is supposed to be independent of the data.
My question is :
What is the data excatly? Is this indicate the observed data or estimated parameters’ true value?
2.My first estimation’s convergence looked very bad so I changed the calibrated persistence parameters until results were fine. Is this correct?
Like the picture showed, is this indicate my calibrated parameters are wrong? I can get the estimated results but what concerns me is this hint means my results won’t work.
So I am not sure I follow the right process to do Bayesian estimation.
Thank you again. Your instruction will be much appreciated.
That data is the observed data used for estimation and entering the likelihood function.
Strictly speaking that is problematic. But most researchers do it that way.
You can most probably ignore the message. But the high posterior density value may signal a problem with the data treatment. That would also explain issues with persistence parameters.
For your third reply, did you mean the value of the log posterior? I did change my persistence parameters countless time and not once the value of the log posterior is bigger than -12000.And the results show that Log data density (Modified Harmonic Mean) is -354.297767.
Is there a normal range for log data density and the value of the log posterior that I could refer to ?
I think I need to reprocess my observed data may be this is where I get so wrong.
After I reprocessed my observation data, my estimated results seem get convergence but I am not sure. And the parameter rho_g(g stands for government consumption)seems a little too big and the parameter eta shouldn’t be that small.
What else can I do to make parameters converge to the ergodic distribution?
I added the code ‘generate_trace_plots(1,2);’ after the estimation command but the error messages popped up.
Dear professor
Thanks for your reply.
I have corrected the timing problem but the pictures still looked wierd. Could please you give me some advice?
I have already uploaded my model file if you ever need it.
Dear professor
My mistake. I used the wrong data. I read your paper ‘A Guide to Specifying Observation Equations for the Estimation of DSGE Models’. So I used the logarithm of output data, detrended using hp filter and takes out the mean. I did the same for investment and consumption data. As for rate and inflation rate, I detrended the rate and inflation before taking the logarithm and I followed your paper’s instruction that using the logarithm of quarterly rate minus the logarithm of rate detrended using hp filter.
And observation equations which I changed into Y_ob = y.
If I were doing something wrong, please correct me.
But I run estimation using this data file, the results still looked weird. Mode check plots show many red dots and few parameters are not identified.
I want to know if these problems caused by wrong setting of model or prior or parameter calibration error.