Plot Value/Policy Functions in Dynare

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”:
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.
rbclog1.mod (472 Bytes)

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:

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.
plot_policy_fun.m (3.42 KB)

Thank you very much!
I ran “rbclog1.mod” unedited, then I typed
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?

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

should be sufficient, where V is the value function and c=log(exp©) 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.