Obtaining optimal values for policy function

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.

Obtaining optimal values for policy function

Postby dphm » Fri Sep 25, 2015 11:14 am

Hi everyone

I am really in need of help right now because I've been searching but there seems to be no clear documentation on this. Hence, I'd really appreciate it if anyone can help me on this.

It's basically the same old problem of expressing welfare as: W = U + W(+1) and for this objective function W, I wish to find the optimal parameters in my policy rule that will maximize the welfare. There are two parameters in my policy rule now and one of them has a lower bound of 0 and an upper bound of 1 while the other is not bounded. I have read that I need to solve the model to second-order to do so which does make sense mathematically.

However, I think Dynare can neither search through a range of parameters nor return me the set of parameters that achieves the maximum welfare. So I believe I have to implement this in an m file. But the big problem is I've no idea how I can link m files to mod files except through the steady; command.

Can anyone help me with this?

Thank you very much.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Obtaining optimal values for policy function

Postby jpfeifer » Sun Sep 27, 2015 8:24 am

Basically, you have to operate a minimizer over the stoch_simul-command at order=2. For looping in general, see http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4891
------------
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: Obtaining optimal values for policy function

Postby dphm » Sun Sep 27, 2015 9:35 am

Hey jpfeifer

Thank you for your reply! I really appreciate it because I could desperately use some help now.

Are you referring to this code?
rhos = 0.8:0.05:1.05;
first_time = 1;
for i=1:length(rhos)
if first_time
set_param_value('rho',rhos(i));
dynare your_mod_file_here noclearall;
first_time = 0;
else
set_param_value('rho',rhos(i));
info = stoch_simul(var_list_);
if info;
disp(['Computation fails for rho = ' num2str(rho)]);
end;
end
end


Sorry but I don't see the optimization part in this code. I mean how can Matlab find the optimal utility from this code?

Also, another question is I do have to insert the welfare function as well as the utility function into my mod file as two additional endogenous variables right?

Thank you.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Obtaining optimal values for policy function

Postby jpfeifer » Mon Sep 28, 2015 9:13 pm

For how to use an optimizer in the context of Dynare, see the replication files to Born/Pfeifer (2014): Risk matters: a comment
------------
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: Obtaining optimal values for policy function

Postby dphm » Tue Sep 29, 2015 12:57 am

Hey jpfeifer

Thank you for referring me to the resources!

Sorry I'm really new to this but do you mean the mod file in the zip file?

Thanks.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Obtaining optimal values for policy function

Postby jpfeifer » Tue Sep 29, 2015 6:07 am

Yes, the mod-file at the bottom calls an optimizer. There you can also see the objective function called.
------------
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: No registered users and 3 guests

cron