Page 1 of 1

Trace plot after estimation

PostPosted: Mon Sep 01, 2014 5:21 am
by Econbee
Dear all,

I added a command in mod file after the estimation for trace plot of random draws. And I found a problem.

There is no problem when I added the command for a deep parameter "tau": trace_plot(options_,M_,estim_params_,'DeepParameter',1,'tau'). I got the plot in this case.

But, when I added a command for the standard deviation "sigma_z": trace_plot(options_,M_,estim_params_,'StructuralShock',1,'sigma_z'), there is no trace plot produced and I got an error message "The standard deviation of sigma_z is not an estimated parameter!".

I used Dynare unstable version 2014-08-26. And I referred to http://www.dynare.org/DynareWiki/TracePlots for the plot. I am wondering if there is anything wrong in my command or if there is a bug in Dynare. Anybody has any idea?

Thanks a lot in advance!

Re: Trace plot after estimation

PostPosted: Mon Sep 01, 2014 9:22 am
by jpfeifer
Please provide a file to replicate the issue.

Re: Trace plot after estimation

PostPosted: Mon Sep 01, 2014 2:27 pm
by Econbee
Dear Johannes,

Thanks for your reply. The testing codes are attached.

Re: Trace plot after estimation

PostPosted: Mon Sep 01, 2014 5:07 pm
by jpfeifer
You have
Code: Select all
shocks;
var eps_d; stderr sigma_d;
end; 

, but you don't want to plot sigma_d. You want the estimated standard deviation. You are estimating
Code: Select all
estimated_params;
stderr eps_d, inv_gamma_pdf, 0.1, inf;       
end;

Thus, you must call
Code: Select all
trace_plot(options_,M_,estim_params_,'StructuralShock',1,'eps_d');

In contrast, sigma_d is a constant you defined, which has no meaning for Dynare.

Re: Trace plot after estimation

PostPosted: Tue Sep 02, 2014 1:48 am
by Econbee
Thank you, Dear Johannes. It works now.

I am a little confused. You said that "sigma_d is a constant you defined, which has no meaning for Dynare". I looked up the manual and some examples. I also tried the code by commenting out the lines for defining sigma_d. It seems that the shocks-end block is not necessary for estimation. And sigma_d in my code is totally redundant and has no meaning at all. In my case, does Dynare assign any value to sigma_d during estimation? Also, does it mean that the shocks-end block is only required for stochastic simulation?

Please clarify if I am wrong. Thank you!

Re: Trace plot after estimation

PostPosted: Tue Sep 02, 2014 5:18 am
by jpfeifer
I meant to say " has no meaning for Dynare during estimation of this standard deviation". The reason is the following:
You cannot use parameters assigned in the shocks-block for estimation purposes. If you would try to estimate the sigma_d, it would fail. This is a safeguard in newer Dynare versions against erroneously thinking parameters within the shocks-block can be used for estimation. The reason is that the contents of the shocks block are executed exactly once and not iteratively during estimation. The shocks-block and all parameters used in it are only used for calibration and simulation purposes!

When you start estimation of the standard deviation of eps_d, Dynare will estimate it, but the respective estimate will have nothing to with sigma_d (which you did not estimate as I pointed out). This also implies that after estimation, the value of sigma_d will be unchanged compared to the value before estimation, because it was not estimated. Rather the standard deviation will be for example be directly saved into M_.Sigma_e.

If you did not estimate standard deviation of eps_d, Dynare would keep this standard deviation at the value assigned during calibration of the model, which is the constant value of sigma_d. This is the case where sigma_d has a meaning for Dynare.

The reason you can comment this line out without consequences is that during estimation, Dynare estimates the standard deviation and no calibrated model is necessary for estimation (but it is recommended).

Re: Trace plot after estimation

PostPosted: Tue Sep 02, 2014 7:23 am
by Econbee
Dear Johannes, thanks a lot for your clarification!