Posterior mode green dashed line?

Dear Johannes,
Thank you very much for your previous help and guidance, I am grateful!
I have a question about green lines that appear in dynare posterior graphs, I think posterior mode refers is associated with highest probability hence the peak of the curve, hence, I think peak of mode should overlap with green dashed line, however, in one of my posterior picture, please download my pdf attachment and have a look, the green dashed line differs from peak of the mountain curve. Could I know why?
Thank you very much and look forward to hearing from you?
Best regards,
Jesseposteriordistribution.pdf (61.7 KB)

Perhaps it is because the numerical optimiser does not go as far as it should go to find the highest point. Did you try using the mode returned after running MCMC …called filename_mh_mode… that is the xparam1 vector…as the starting values (in estimated_params_init) for the optimiser? It should help you get closer to the ‘true mode’, from my experience.
Reuben

2 Likes

Hi Jesse,

Have a look at this older answer of Stephane. It’s basically what Reuben said.

Best

Rob

1 Like

Thank you very much !

Thank you very much !

Dear all,
I would like to come to this issue. It would be great if the Dynare team could take a look at this. I have noticed that the value saved under

oo_.posterior_mode.parameters.[parameter_name];

and the value corresponding to the peak of the density in

oo_.posterior_density.parameters.[parameter_nam]

might not be necessarily the same. One can run the simple code below using the attached mat file to check. Is that a simple issue, or a more fundamental problem? Or am I doing something wrong?

Bonus question: Why the field oo_.posterior_density.parameters.[parameter_name] has only 512 points? Is that always the case, does it depend on the number of draws?

Best,
KyriacosBSur_results.mat (946.8 KB)

% Manual figures from Dynare estimations

close all;
clc;

peak = max(oo_.posterior_density.parameters.kappaa422(:,2));

position=zeros(1, length(oo_.posterior_density.parameters.kappaa422(:,2)));
for ii = 1:length(oo_.posterior_density.parameters.kappaa422(:,2))
if oo_.posterior_density.parameters.kappaa422(ii,2) == peak;
disp(‘Found one mode’)
position(ii) = ii;
pos=ii;
end
end

if oo_.posterior_density.parameters.kappaa422(pos,1) ~= oo_.posterior_mode.parameters.kappaa422;
disp(’ ‘)
disp(‘Mismatch of modes’)
disp(’ ')
end

vline1 = oo_.posterior_mode.parameters.kappaa422;
vline2 = oo_.posterior_density.parameters.kappaa422(pos,1);

figure
hax=axes;
hh=plot(oo_.prior_density.parameters.kappaa422(:,1),oo_.prior_density.parameters.kappaa422(:,2),’-k’,‘LineWidth’,2);
set(hh,‘color’,[0.7 0.7 0.7]);
hold on;
plot(oo_.posterior_density.parameters.kappaa422(:,1),oo_.posterior_density.parameters.kappaa422(:,2),’-k’,‘LineWidth’,2);
title(‘kappaa422’);
axis(‘tight’)
line([vline1 vline1], get(hax,‘YLim’),‘Color’,[0 1 0], ‘LineWidth’,2, ‘LineStyle’, ‘–’)
line([vline2 vline2], get(hax,‘YLim’),‘Color’,[1 0 1], ‘LineWidth’,2, ‘LineStyle’, ‘–’)
legend(‘prior density’,‘posterior density’, ‘reported mode’, ‘other mode’)
legend(‘boxoff’)

Dear Kyriacos,

The estimator of the posterior mode and the top of the marginal posterior density may be different for at least two reasons:

  1. The optimizers did not converge to the global optimum (or even to a local optimum) \Rightarrow the green line is not in the right place.
  2. The MCMC did not converge to the posterior distribution \Rightarrow the estimated posterior density (henceforth its top) is wrong.

So if you are certain of your posterior mode, it probably means that you have to increase the number of iterations in the MCMC.

Regarding your bonus question, the number of points is set in options_.number_of_grid_points_for_kde. The default value is 512.You can change the value, but it must be a power of two (because of the approache, based on FFT, used to compute the density estimator). So if you want to increase the value it must be 1024, or 2048, …

Best,
Stéphane.

Dear Stephan,
Thanks a lot. I will try a few more draws…

Best,
Kyriacos

Dear Stephan,
I increased the number of draws to 3m and the picture still looks the same. At the same time, it does not look like the distribution is bimodal. Would it be ok to use the mean of the distribution to derive statistics from the model?
Alternatively, should I try with tighter priors to estimate the mode?
I know that all these things are model dependent but any advice/ hint would be very much appreciated.

Best,
Kyriacos

Dear Kyriacos,

Did you check the convergence to the posterior distribution (looking at the convergence diagnostics)? If yes, your finding suggests that the optimization routine provided a wrong estimate of the posterior mode (most of the available algorithm only return local optima). So you may try other optimization algorithms (like mode_compute=2 which is supposed to converge to the global mode with probability one). But if in the end you are only interested in the posterior expectation, you do not need to improve your estimate of the mode (provided that you checked the convergence of the MCMC to the posterior distribution).

Best,
Stéphane.

@kyri82 You want to have a look at the trace plots to see where the chain moves from the initial point.

Dear both,
Thanks a lot for your responses and your help. On Stephan’s comments: I do check the convergence diagnostics and to me it looks as if the estimates have converged: the red and blue lines match and they are flat towards the end (note the scale is very tiny).

On Johanes question: the resulting trace plots look like white-noise processes. To my inexperienced eye, the trace plot for a parameter where the mode seems to be correctly estimated (se_eT1) does not differ much from the trace plots of other params.

I attach the graphs, it would be great if you could have a quick look.

Thanks a lot again.

Best,
Kyriacosestimate32TraceGraphs.pdf (641.4 KB)
estimate32graphs.pdf (130.6 KB)

Dear Kyriacos,

The convergence diagnostics are not good. The blue and red lines match but clearly they are not flat, so I would add more iterations. At best, these conditions (matching red and blue curves and flat curves) are only necessary conditions for convergence to the posterior distribution. Also there is no formal test here to decide if the slope is significant. But as long as the eye is able to identify a non zero slope, you should add iterations.

The trace plots do not look as white noises to me. But this is to be expected by nature of the MCMC algorithm.

Best,
Stéphane.

1 Like

@kyri82 I would go for a formal convergence diagnostics like the Geweke or the Raftery-Lewis. But the trace plots and the prior posterior plots do not look that bad.