Estimation: mode_compute sequence

I do not understand how to use a sequence of mode_compute. I started to estimate my model using first a mode_compute=6 but my mode check plots and convergence graphs are not so good. For this case, I read that it is a good thing to estimate the model again with a new mode_compute.

  1. Do I have to load first with mode_compute=0 and then use again a estimation command with a mode_compute=7 (for example) or should I put mode_compute=7 together with mode_file?

That is something like:

estimation(order=1,datafile=‘mymodel_data.xlsx’,mode_file=mymodel_mode, mode_compute=0,mode_check);

estimation(order=1,datafile=‘mymodel_data.xlsx’, mode_compute=7,mode_check);


estimation(order=1,datafile=‘mymodel_data.xlsx’,mode_file=mymodel_mode, mode_compute=7,mode_check);

  1. I tried to use the last one and I get:

The mode_file option of the estimation st

The mode_file option of the estimation statement is incompatible with the use_calibration option

If I suppress the estimated_params_init block, it runs, although I am not sure what it is happening. Does it mean that the estimation uses the mean (or mode) of the first posterior distribution as initial point?

  1. I usually have success only with mode_compute=6. Is there any benefit in using a sequence with mode_compute=6 twice or will it be prone to be stucked in the same results?

Thank you.

  1. A mode_-file is loaded before mode_compute, so option 2 is the right way to go.
  2. The problem is that both use_calibration and the mode_file-option try to set the starting values for the specified mode_compute. So there is no way to specify which one takes precedence. The solution in this case is to comment out the use_calibration-option when loading a mode_file.

Thank you, professor Pfeifer. Your comments were very helpful.

I managed to get some good mode plot but the MCMC univariate/multivariate convergence plots are still bad.

  1. Do you have any suggestion to improve them?
  2. Are they suppose to be stabilized horizontally and close to each other only at the end of the plot or in the entire plot?

Could you provide trace plots?

Here they are. (565.7 KB)

I meant the output of


Here they are.
I did not know about these graphs and I am not sure that I understood this intuition.

generate_trace_plots(1).zip (1.0 MB)

  1. For interpretation, see Pfeifer (2014): An Introduction to Graphs in Dynare
  2. If you look at Figure 1, which displays the posterior you will see that the chain slowly drifts towards a region of higher density. Thus, you did not find the mode initially. That explains the convergence problem. I would suggest to start mode-finding based on the last draw of the chain.

Thanks, professor Pfeifer. I read Pfeifer (2014): “An Introduction to Graphs in Dynare” but I am not sure I understood everything. I would appreciate very much some comments about these questions:

1 - The Figure 1 is a trace plot for the joint posterior density?

2 - Do I have to look at each parameter figures to verify if I have to change the burn-in sample? For example, in Figure 14 below, the initial draws of psi_pi are different from the last ones. Actually, the parameter draws seem to be stabilized only in the draws180.000-200.000. I think that I have to dismiss the draws that are very dependent of initial value, but I do not have to do it too much because it would cause a very concentrated posterior.

Looking at this graph, for me it is not clear where I should define the burn-in period. And other parameters may have other pattern, so what to do in this case?

3 - About your comment to “start mode-finding based on the last draw of the chain”, do you mean to use the mode_file and/or load_mh_file? I do not understand what are the differences between these commands.

  1. Yes, it’s for the joint posterior density.
  2. Given your picture of the posterior showing a drift, your chain did not yet converge to the ergodic distribution. For that reason, there is no point in looking for an appropriate burnin. A well-mixing chain should not show such long swings (or if it did, you would need a lot more draws)
  3. The easiest way is to restart with the mode of the your MH run. That should be doable with specifying the _mh_mode-file (not to be confused with the normal _mode-file created by mode-finding before the MH) with the mode_file-option .

Dear prof. Pfeifer, thank you very much for all the information.

I ran the model again and even with much more draws, it seems it is not converging (considering trace plot for posterior). I wonder if it is slow to converge because I am using just mode_compute=6.
I read in other posts that if the others mode_compute show problems with Hessian maybe a consequence of identification problem.

  1. Do you think it is indeed a identification problem? If so, do you have any suggestions to solve it? The identification analysis seems to be ok, but identification strenght plot shows that some parameters have 0 strenght (relative to prior std). In addition, how can I reproduce this graph, since the parameters name are not readable because of this size?

  2. For me, the graphs with prior and posterior seem to be strange. Sometimes the mode are very far from posterior. Is it acceptable or a consequence of some other problem?

  3. Some mode check plot seem to be defined in a very small range (axis X). Due to previous results I assume that these parameters have good mode check plots, however I do not understand why they have the small range.|attachment (399.3 KB)

Thank you

The psi_pi and psi_pi_star with their uniform distributions run into the prior bounds. When using a normal distribution for them things looks a lot better. Also try mode_compute=5. It results in a significant improvement in the mode.

Thank you again, prof Pfeifer.
With your comments, I ran the model (changing the priors and mode_compute=5) and it seems it converged:

The other results bring me some more questions:

  1. Some parameters trace plots are not good, specially for std of eps_a. The same happens for univariate diagnostics plot. Should I be worried? For example, do I have to use specific parameter scale?

  1. In Mode check and estimation marginal density I received a message:

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate

And in mode check I received also the messages (only for these 3 values):

mode_check:: could not solve model for parameter psi_pistar at value 0.775, error code: 4
mode_check:: could not solve model for parameter psi_pistar at value 0.853, error code: 4
mode_check:: could not solve model for parameter psi_pistar at value 0.930, error code: 4

Is there a problem?

  1. The identification analysis seems to be ok, but identification strenght plot shows that some parameters have 0 strenght (relative to prior std). Why does it happen?

  1. Now it seems you found the mode, i.e. there is no more drift. However, the picture for the standard deviation eps_a suggests multi-modality, i.e. there is a lower mode where the chain jumps to. In that case, a longer chain is often helpful. You can see your chain moving back to the higher mode already.
  2. The mode_check-messages come from you enabling options_.debug. You will receive a message for each red dot in the pictures. Error code 4 is a BK violation.
  3. Identification indeed looks ok. The white dots indicate not a 0, but rather a division by 0 due the to the normalization, i.e. that that measure cannot be computed.

Thank you for your comments, professor Pfeifer. They were very clear and helpful.