Different posterior distribution of a parameter in same plot

Hi,

I evaluated 3 DSGE models in Dynare.

I have the parameters’ posterior distributions for each model, estimated with MCMC Metropolis Hastings (extensions .jpg and .eps).

Is there a way to plot the 3 posterior distribution of a parameter (one for each model) in the same plot?

Thanks for any help!

Hi,

I assume that you have estimated three models in three separate mod files: model1.mod, model2.mod and model3.mod. I also assume, for the sake of simplicity, that all the mod files are in the same folder. The global structures used by Dynare are saved on the disk at the end of each Dynare run in a mat file. If you want to customize a plot, or create a plot not provided by Dynare, you will need to look for the required data in the structure oo_. In your example, you need first to load these structures for the three models:

>> model1 = load('model1_results');
>> model2 = load('model2_results');
>> model3 = load('model3_results');

then you can plot the posterior densities of a parameter, say alp, for the three models as follows:

>> plot(model1.oo_.posterior_density.parameters.alp(:,1), model1.oo_.posterior_density.parameters.alp(:,2), '-k', 'linewidth', 2)
>> hold on
>> plot(model2.oo_.posterior_density.parameters.alp(:,1), model2.oo_.posterior_density.parameters.alp(:,2), '-r', 'linewidth', 2)
>> plot(model3.oo_.posterior_density.parameters.alp(:,1), model3.oo_.posterior_density.parameters.alp(:,2), '-b', 'linewidth', 2)
>> hold off

Best,
Stéphane

1 Like

Hi Stéphane,
Thanks for your precious help! I am very grateful!

The plots are perfect!

Regards,
Roberta