Evaluate policy function or decision rule

Hello all,

I have written some Matlab code “eval_dyn_pol_beta” (see attachment) that can evaluate the Dynare policy function or decision rules. It can be especially useful for computing simulations yourself, or evaluating the Euler residuals.

I called it a “beta” version, because I only tested it for a standard RBC model with TFP shocks. I compared the simulation results with the results of my own CSD toolbox (based on Prof. Maussners CoRRAM), and they are almost identical (differences <1e-12 after 1000 periods) for order 1 to 3.

I do not know if the function will work for more complex models, so any feedback is more than welcome.

In the attachments you find:

  • “eval_dyn_pol_beta.m” - the Matlab function used to evaluate the Dynare policy function. It uses polynomials, so computations should be fast (also for multiple series).

  • “TEST_EVAL_DYN_POL.zip” which includes several files to compute the simulation of a standard RBC model using the Dynare decision rules and the above file to evaluate these policy functions. It also compares the simulation results with the solution of my own CSD toolbox.

eval_dyn_pol_beta.m (5.1 KB)
TEST_EVAL_DYN_POL.zip (586.1 KB)

It seems you are mostly replicating the functionality of simult_.m, which can be directly used for this purpose. See e.g.

Thank you! The function simult_.m does seem very similar indeed, although the function I supplied can handle multiple values of one state variable (ie. n by cols input), whereas simult_ only handles n by 1 inputs according to the dscription.

And the values of y0 that are not state variables will be ignored, right?

  1. Yes, simult_ takes a vector of variables, not a matrix.
  2. Yes, all non-states will be ignored.

The advantage of this function is that it is compatible with the various options of Dynare (like the k_order_solver)

Got it, thanks. It’s funny I couldn’t find anything recent when I searched for “evaluate Dynare policy function”. That’s why I thought I had to make the program…