Plot Value/Policy Functions 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.

Plot Value/Policy Functions in Dynare

Postby azev77 » Wed Mar 13, 2013 11:36 pm

Hi, I would like to solve an extremely simple, non-stochastic neoclassical growth model in Dynare, then plot the value and policy functions.
For example, Matteo solves a basic RBC model in Dynare "rbclog1.mod": https://www2.bc.edu/~iacoviel/dynaremodels.htm
I would like to solve the same model except without the shock.
I understand that Dynare finds the policy/value functions using perturbation. I would like to plot them so I can compare them to what I get using Value function iteration and projection methods.
Attachments
rbclog1.mod
(472 Bytes) Downloaded 174 times
azev77
 
Posts: 2
Joined: Wed Mar 13, 2013 11:27 pm

Re: Plot Value/Policy Functions in Dynare

Postby jpfeifer » Sat Mar 16, 2013 11:16 pm

You could try using the attached experimental function. You only need to run the model with stoch_simul and then specify the state variable for the x-axis, its range, and the variable to be plotted on the y-axis. All other states are kept at their steady state value unless you specify it differently. You could call it for example:
Code: Select all
state_range=0.1:0.1:10;
state_name='k';
plot_var_name='c';
plot_policy_fun(state_name,state_range,plot_var_name)

If you encounter any issues, please report them. Note that the function has not been extensively tested. Thus, if you encounter stark differences to other methods, there might be a bug.
Attachments
plot_policy_fun.m
(3.42 KiB) Downloaded 322 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: Plot Value/Policy Functions in Dynare

Postby azev77 » Sun Mar 17, 2013 2:25 am

Thank you very much!
I ran "rbclog1.mod" unedited, then I typed
"state_range=0.1:0.1:10;
state_name='k';
plot_var_name='c';
plot_policy_fun(state_name,state_range,plot_var_name)"
and I got a plot of a policy function for consumption,
I repeated the same thing with "plot_var_name='c';" and I got a policy function for capital.

However I'm a little confused. The shock in "rbclog1.mod" is an AR(1) process, so shouldn't the policy function for consumption and capital be a function of both current capital and the current shock? Is the program assuming we are at the mean shock?

Is there a way to plot the value function?

Is there a way I can modify "rbclog1.mod" to make the model deterministic (i.e. take out the technology shock)? I haven't had any luck doing this in Dynare.

Finally, is there a way to solve models with discrete state shocks? "rbclog1.mod" has an AR(1) shock, but can I use a 3-state markov process instead?
azev77
 
Posts: 2
Joined: Wed Mar 13, 2013 11:27 pm

Re: Plot Value/Policy Functions in Dynare

Postby jpfeifer » Sun Mar 17, 2013 9:47 am

It assumes you are at the steady state for all other shocks/states (unless you provide a different starting point as the fourth input argument). Due to linearity of the first order aprroximation, considering technology would not change anything. Only starting at second order, this would matter (but then you also should take the gs2 uncertainty correction into account).

No, there is no easy way to plot the value function. You could try to define the policy function recursively in your model equations and then plot it. For the very easy model you consider, adding
Code: Select all
V=c+BETA*V(+1);

should be sufficient, where V is the value function and c=log(exp(c)) is the utility function. For a smooth model, this equation holds with equality in the optimum and is thus a FOC characterizing V like the other FOCs characterize the other variables.

You could make it deterministic using the simul-command, but then you won't get policy functions, but a numerical simulation. So for you problem the answer is no. However, for first order everything is certainty equivalent. Thus, the shock plays no role as agents behave as if the expectation of the future realization of the shocks is certain to be at the expected value.

Dynare only supports perturbation, thus requiring that all functions are sufficiently smooth. It would not work with discrete Markov Chains. So the answer is no.
------------
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 7 guests