Mode compute = 6 Monte Carlo routine

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Mode compute = 6 Monte Carlo routine

Postby qazi.haque » Mon May 04, 2015 10:44 am

Hi Johannes,

I have been trying to estimate a small scale NK model with deep habits using my own MATLAB codes. However, it seems to be that csminwel fails to find the correct mode. That's why I am now trying to use Monte Carlo routine as in mode_compute = 6 to get the mean and covariance matrix for the jumping distribution in the MH algorithm. Toward that purpose I have tried to write up a MATLAB code for that in spirit of what mode_compute = 6 is doing. But for some reason it's not working. Could you please provide me with the mode_compute = 6 code that DYNARE is using so that I can have a look at it for better understanding?

Moreover, could you briefly explain what's the reasoning behind the updating scheme for mean and covariance matrix which DYNARE is using in mode_compute = 6 as stated here:

http://www.dynare.org/DynareWiki/MonteCarloOptimization

Please find attached the MATLAB code I have written in spirit to mode_compute = 6 as described in the above link.

Looking forward to your response.

Cheers,
Qazi
Attachments
modefindingMC.m
(4.03 KiB) Downloaded 85 times
qazi.haque
 
Posts: 18
Joined: Thu Nov 06, 2014 11:37 am

Re: Mode compute = 6 Monte Carlo routine

Postby jpfeifer » Sun May 10, 2015 1:34 pm

mode_compute=6 is basically a simulated annealing type routine. Instead of programming something like this yourself, I would recommend using any global optimizer freely available. Note also that any jumping covariance matrix works. You could just pick a scaled identity matrix to start your MCMC and once it has converged to a region of higher likelihood, start again with mode-finding. This is essentially what mode_compute=6 does.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Mode compute = 6 Monte Carlo routine

Postby qazi.haque » Wed May 13, 2015 10:00 am

If I understand this correctly, for the MH algorithm, we don't need to start exactly at the mode but from a point with a high posterior density value and to use a good covariance matrix for the jumping distribution. Now what if I initially run a MH algorithm with the mean of the jumping distribution set to the prior mean and the variance-covariance matrix to scaled identity matrix. I then run this MH algorithm, say for 1000000 draws and compute the mean values of the last 500,000 draws (conditional on convergence). Next, I run my 'proper' MH algorithm, now with the starting value set to the mean I have just calculated from the previous step and the variance-covariance of the jumping distribution set to the inverse of the hessian computed at the calculated mean.

What's your view about such a procedure? I am trying to do it this way because often times, as you know, Newton type algorithm like Chris Sim's 'csminwel' gets stuck due to cliffs in the log posterior.

Thanks again.
qazi.haque
 
Posts: 18
Joined: Thu Nov 06, 2014 11:37 am

Re: Mode compute = 6 Monte Carlo routine

Postby jpfeifer » Sun May 17, 2015 6:23 pm

This is perfectly fine. You just have to treat the initial draws as a burnin. Theory tells you that, as long as the regularity conditions are met, any jumping covariance should work (but potentially only in close to infinite time/infinitely many draws). I would recommend using e.g. CMAES for mode finding first. It is freely available.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Mode compute = 6 Monte Carlo routine

Postby qazi.haque » Tue May 19, 2015 12:19 am

Thanks for your suggestion. Just to clarify one more thing - is it the case that 'repeated' application of CMAES is essentially similar to mode_compute 6 in dynare?
qazi.haque
 
Posts: 18
Joined: Thu Nov 06, 2014 11:37 am

Re: Mode compute = 6 Monte Carlo routine

Postby jpfeifer » Tue May 19, 2015 6:53 am

No, repeated application of a MCMC would correspond to mode_compute=6. CMAES is simply a global optimizer like simulated annealing. It tends to work pretty well.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests