A question on mode_file option in Dynare

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.

A question on mode_file option in Dynare

Postby Econbee » Thu Jul 17, 2014 2:56 am

Dear all,

I encountered a problem in Dynare yesterday and I would appreciate it very much if any one of you could give me some hints.

I started from a certain parameter vector and use mode_compute=6 to find the mode and then run MCMC. The mode finally found indicates that the minus log posterior density equal to 831.3037. This is in the log file (experiment_modefile.log). The mode file (mymode.mat) has been attached as well. Then I did an experiment. On one hand, I copy the parameter values in the mode_file and paste in the parameter block of the mod file (experiment_modefile.mod). Then I allow the estimated_params_init(use_calibration) block. Then I use the estimation command without mode_file option to do the estimation again. In principle, the initial minus log posterior density should also equal to 831.3037. It turns out to be the case. On the other hand, I shut down the calibration part in the parameter block and also shut down the estimated_params_init(use_calibration) block. This time, I use mode_file option in the estimation command. Surprisingly, the initial minus log posterior density equals to 849.8676, which is significantly different from 831.3037. I am not sure what the problem is. Did I make any mistake in using the mode_file option?

For your reference, I have zipped all the files necessary to run the code.

Thanks a lot!

Best,

Bing
Attachments
experiment_modefile.rar
(16.28 KiB) Downloaded 362 times
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: A question on mode_file option in Dynare

Postby jpfeifer » Sun Jul 20, 2014 9:56 am

Which Dynare version are you using?
------------
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: A question on mode_file option in Dynare

Postby jpfeifer » Sun Jul 20, 2014 10:52 am

This is a bug with the use_calibration option that will be fixed soon. Thanks for reporting it.

The mode-file option yields the correct result. The reason why it occurs in your case is that your steady state file returns 0 instead of NaN for the observables when the steady state cannot be solved. See https://github.com/DynareTeam/dynare/issues/691. We must check for this case in the future.
------------
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: A question on mode_file option in Dynare

Postby Econbee » Sun Jul 20, 2014 4:06 pm

Thanks so much for the reply! I was using Dynare unstable version "2014-07-11".

For my case, is there any way to get the mode-file option working correctly? Do I need to modify my steadystate file? I would appreciate it very much if you could be more specific. I am not sure if I could understand the bug you mentioned in the previous post. But right now, the use_calibration option seems to be working for my case.

By the way, the link https://github.com/DynareTeam/dynare/pull/691 you provided is about variance decompostion. Is it related to my problem?
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: A question on mode_file option in Dynare

Postby jpfeifer » Mon Jul 21, 2014 6:22 am

Sorry, I meant https://github.com/DynareTeam/dynare/pull/698.
You can replace your Dynare files with the attached ones and everything should work.
Attachments
dynare_estimation_1.m
(49.04 KiB) Downloaded 178 times
dynare_estimation_init.m
(22.72 KiB) Downloaded 192 times
------------
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: A question on mode_file option in Dynare

Postby Econbee » Mon Jul 21, 2014 2:04 pm

Thanks a lot for the instruction! I replaced the two m files and both the mode-file option and the use_calibration option provides the same log posterior (849.8676), given the same parameter values in mode_file.

To understand Dynare better, now one question remains. Please refer to the log file in the zipped file in my original post. In the log, it says "Final value of the log posterior (or likelihood): 831.3037" right after the mode computation. My question: is 831.3037 associated with the mode? If yes, why is the initialized log posterior in my subsequent exercise 849.8676? If not, what is 831.3037 and why is 849.8676 (which is supposed to the mode posterior) not showing up in the log file? Since I am not very clear about the way Dynare works, I am wondering if the bug you mentioned affects the whole estimation? If yes, is 831.3037 just an error due to the bug?

Thank you!
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: A question on mode_file option in Dynare

Postby jpfeifer » Mon Jul 21, 2014 10:28 pm

What happened is that Dynare erroneously concluded that your observation equations have no constant. Under this wrong assumption, you get the 831. Note that this mode is wrong for this reason. Now when loading the mode-file, Dynare concludes that there is a constant in the equation. The result is the displayed 849. However, the parametrization in both cases is the same. The only difference was the incorrect data treatment. For this reason, after fixing the bug using the attached files, you need to rerun the mode-finding. After that, all numbers you get should be the same.
------------
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: A question on mode_file option in Dynare

Postby Econbee » Tue Jul 22, 2014 4:37 am

Dear Johannes,

As you said, I run the mode_compute again. And all the subsequent problems disappear. Thanks a lot!

By the way, has the bug been fixed in the latest version of the unstable Dynare? Or should people manually update the two files to avoid the bug?

Also, after running Dynare, there is a file named "filename_mh_mode.mat", which is different from the mode file from mode_compute. I am wondering what this file is? Is it the mode after running the metropolis-hastings?

Thank you!

Best,

Bing
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am

Re: A question on mode_file option in Dynare

Postby jpfeifer » Tue Jul 22, 2014 5:21 am

It's not yet in the unstable. You can find the status here: http://www.dynare.org/DynareWiki/KnownBugs

Yes, the mh_mode-file is the mode after running the MCMC.
------------
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: A question on mode_file option in Dynare

Postby Econbee » Tue Jul 22, 2014 6:46 am

I see. Thank you, Johannes.

Bing
Econbee
 
Posts: 74
Joined: Fri Nov 08, 2013 8:14 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 5 guests

cron