Bayesian Inference


I would like to do Bayesian Inference on some statistics based on DSGE model estimated using dynare.

In particular I would like to be able to draw and save multiple parameter estimates from the posterior distribution and estimate the policy and transition function for each one of those parameter estimates drawn from the posterior distribution.

the posterior draws for parameters are saved in mat file called mod_file_mh_blck.mat . I want to write a .m file that asks dynare to use these posterior parameter estimates and calculate the policy and transition function. Is it possible to incorporate an external file (.mat? or a .m?) containing the parameters into the mod file.

How can one do this? Any help on this topic would be much appreciated.


this is possible within the mod file.
you can do it in a loop
save a mat file containing the parameter draws.
then use the estimation command to load a fake mode file to load the set of parameter values to get your pol and trans functions for.
you can use an arbritary hh (hessian) matrix. it does not matter as your sole focus is the ‘mode’ : your chosen set of parameter draws.

dont forget to set the mh_replics to zero in the estimation command, as you just want to load the parameter values in the ‘fake’ mode file.

in short
estimation ( datafile=blahblah, mode_file=blahblah_mode, mh_replics=0…)
will do the trick.
then do stoch simul after the estimation command.
save the the pol and trans functions each time into an array you want to.


Dear Reuben,

Thanks for the prompt reply. However, I have a few more questions regarding the approach you just specified.

why do i need to do the estimation at all? if all i need is the policy transition functions can’t I just load the parameter.mat file and do stoch_simul and save the policy and transition function? if i intend to do it for 1000 times estimation is going to take a lot of time on each run.

Also, I have never worked with a loop inside of a .mod file. Could you provide me an example for that.