Page 1 of 2

Convergence diagnostics problem

PostPosted: Wed Jul 16, 2014 10:51 am
by Grant
Dear,

I am using Bayesian estimation to estimate some parameter and shock values and calibrate some other parameter values. I use the commands in the estimation block as following:

estimation(datafile=trial_data, mode_compute = 6, mh_nblocks = 2,moments_varendo,conditional_variance_decomposition=[1 2 4 8], mh_replic=50000, conf_sig=0.95, bayesian_irf)y n pi_c_h r c i_d;

However, I get bad convergence result with regards to the red line and blue line. To be more specific, the red line and the blue line can get convergence for the shock parameters, but do not converge for the the coefficients of the shock process and other parameters.

Q1: Is there any method to improve the convergence results? I noticed that in this forum, someone use the posterior mean as the initial value to start a new estimation round. If it helps, should I replace all the estimated parameter values or just the parameters of bad convergence results?
If it does not help, are there any other ways to do? Increase the number of replication or try other mode computation method?

Q2: I am confused about the difference between the parameters which need to be estimated in the parameters block and those in the estimated params block. I know that Dynare will take the parameterization before the model-block as the starting point and keep those parameters at their values unless they are estimated using the estimated_params-block. Does it mean that the parameter values in the parameters block is the same as the initial value in the estimated params block? If not, what's the difference between the value in the parameters block and the initial value in the estimated param block? Because I fount that in some schlar's code, the value in the parameters block is different from the corresponding initial value in the estimated params block.

Any help is highly appreciated!

Regards,

Re: Convergence diagnostics problem

PostPosted: Fri Jul 18, 2014 9:34 am
by jpfeifer
Q1. Just use the mh_mode file as the mode_file for a new estimation run. A lot of additional draws should also help. Also, have you checked identification?

Q2. Parameters initialized in the estimated_params or estim_params_init block overwrite the values initialized in the parameters declaration. It is common practice to set both to your best guess of what the correct parameter is. But there is no other reason they should be the same.
If you are interested in e.g. the IRF for rho=0.9, because you put stoch_simul before estimation, it might make sense to start estimation at a different values you consider more likely. In that case, the parameter values will differ

Re: Convergence diagnostics problem

PostPosted: Sat Jul 19, 2014 6:23 am
by Grant
Dear Jpfeifer,

Thanks for your answer.

However, I am still a bit confused about the Q1. Using the mh_mode file as the mode_file for a new estimation run just remain the posterior mode constant. If my understanding is right, do I need to replace all the initial value of estimated parameters by the posterior mean for a new estimation run? If it helps, should I replace all the estimated parameter values or just the parameters of bad convergence results?

In addition, I will check that whether all the parameters are identified using the "identification" command. If I find that some parameters are not identified, I should calibrate the corresponding parameter? Am I right?

Regards,

Re: Convergence diagnostics problem

PostPosted: Mon Jul 21, 2014 6:48 am
by Grant
Dear,

Any one can give me some tips?

Any help is highly appreciated.

Thanks

Re: Convergence diagnostics problem

PostPosted: Wed Jul 23, 2014 8:34 am
by jpfeifer
The mh_mode file is the mode after the MCMC run, not after mode-finding. Using it as the mode_file and them running mode-finding again (potentially with a different mode-finder) should increase your chances of finding a better mode and getting quicker convergence. If your posterior mode stays constant, your mode-finder most probably got stuck. Otherwise, the issue is not about convergence of the chains to the same mode, but about mixing. In that case, you might want to try using a user-defined jumping covariance matrix.

Regarding, identification: see http://www.dynare.org/phpBB3/viewtopic.php?f=2&t=5793

Re: Convergence diagnostics problem

PostPosted: Wed Jul 23, 2014 1:51 pm
by Grant
Dear Jpfeofer:

Thanks for your help.

As for using the mh_mode file as the mode_file for a new estimation run, I set in the estimation command as following:

Code: Select all
estimation(datafile=my_data,mode_file = code_mh_mode, mode_compute = 6, mh_nblocks = 2,moments_varendo,conditional_variance_decomposition=[1 2 4 8], mh_replic=50000, conf_sig=0.95, bayesian_irf)


Am I right?

Regards,

Re: Convergence diagnostics problem

PostPosted: Thu Jul 24, 2014 6:18 am
by jpfeifer
Correct

Re: Convergence diagnostics problem

PostPosted: Thu Jul 24, 2014 10:07 am
by Grant
Dear Jpfeifer:

Unfortunately, when I set the command as above, I got the error message as following:

Reference to non-existent field 'parameter_names'.

Error in dynare_estimation_init (line 202)
if isequal(mode_file.parameter_names, bayestopt_.name)

Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_, bayestopt_);

Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);

Error in code (line 1044)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;

But if I set
Code: Select all
mode_file = code_mode, mode_compute = 6,


The code can run. I am confused about which one is correct. Can you help me with this problem?

Re: Convergence diagnostics problem

PostPosted: Thu Jul 24, 2014 11:25 am
by jpfeifer
Unfortunately, this is another detected bug with a proposed but not yet implemented bugfix. For now, you could change the file that creates the mh_mode file according to:
https://github.com/JohannesPfeifer/dynare/commit/7f15295cda5093e3d29ef8178bf81acf51e1dbb4

Re: Convergence diagnostics problem

PostPosted: Fri Jul 25, 2014 9:21 am
by Grant
Dear Jpfeifer,

Thanks for your answer.

Since I am not good at program coding, I am not able to change the file that creates the mh_mode file according to your suggestion. Can you explain the method in a bit more detail? Does it need to code in Matlab command window directly?

Besides, I tried to set
Code: Select all
mode_file = code_mode, mode_compute = 6,
and run my program, I found that the convergence improved a lot. Is this result reliable?

I am looking forward to your relpy.

Regards,

Re: Convergence diagnostics problem

PostPosted: Fri Jul 25, 2014 9:46 am
by jpfeifer
Running mode_compute=6 again is similar to what I suggested. If it works, just proceed with this.

Re: Convergence diagnostics problem

PostPosted: Fri Jul 25, 2014 9:54 am
by Grant
Dear Jpfeifer,

Thanks for your help. And I notice that in the dynare manual, it is said that loan_mh_file is to tell dynare to add to previous MH simulations instead of starting from scratch. Does this command have the same meaning as your suggestion?

Regards,

Re: Convergence diagnostics problem

PostPosted: Mon Jul 28, 2014 7:29 am
by jpfeifer
No. The difference is the starting point and the Hessian used. See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5051

Re: Convergence diagnostics problem

PostPosted: Thu Aug 07, 2014 3:59 am
by Grant
Dear Pfeifer,

Thanks for your help.

Although I have fixed the convergence problem, the impulse response functions' graphs seem weird. The impulse response seems to fluctuate up and down around the some values, for example, zero, rather than to smooth back to the steady state. Is this result reliable? If not, what's the problem and how to fix it?

Here attached one of the impulse response graphs.

I am looking forward to your reply.

Regards,

Re: Convergence diagnostics problem

PostPosted: Thu Aug 07, 2014 6:47 am
by jpfeifer
Your estimate implies a complex eigenvalue, leading to oscillatory behavior. These type of oscillations are very uncommon in economics, so something is most problabyl still wrong. Unfortunately, it is impossible to tell what. Anything that affects your estimation results from wrong equations (for example wrong timing in feedback equations) to non-convergence can lead to this issue.