2nd order decision rule


I am solving a relatively big DSGE model using Dynare version 4.0.3:

Number of variables: 260
Number of stochastic shocks: 1
Number of state variables: 86
Number of jumpers: 26
Number of static variables: 154

I did not have problems with the 1st order approximation, when all the irf`s were plotted correctly.
Only changing to “order=2”, to run the 2nd approximation, the log file did not report errors, but all the irf 's values are NaN.

Since Dynare computed all the decision rule matrixes, I was trying to reconstruct the 2nd order decision rule using Matlab, only to understand better what is happening.

However, reading the manual about the order of the variables, and checking the matrixes, I found that the values in oo_.dr.ys are in the declaration order and not in alphabetical order as reported in the manual (pag. 25: “– ys: oo_.dr.ys. The vector rows correspond to variables in alphabetical order of the variable names.”).

I have the following questions:
1 - Why did Dynare not report errors, if it did not compute the irf 's? Could I assume that the matrixes are correct?
2 - Is there any tip about how to check if the 2nd order approximation matrixes of the decision rule were correctly computed?
3 - What is the correct order of the values in the matrixes of the 2nd order approximation of decision rule? Alphabetical or declaration order?
4 – Did Dynare use exactly the same Matlab codes of Schmitt-Grobe&Uribe? Did it use Symbolic Math Toolbox or other numerical routines for computing the derivatives?

Best regards,
Marcos Valli.

Dear Marcos,

This is a known problem with 2nd order aproximation: the IRFs may explode as in your case. Using Chris Sims “pruning” all terms above 2nd order would work in that case

We have recently updated the manual to match version 4.0. Please look for the new version on the web site.

This isn’t a computing error, so I’m not sure that an error message would help. You can assume that the matrices are correct

You can check that the second order approximation of the model is satisfied by the decision rule, but this is messy.

In version 4, the basic order is order of declaration, but the coefficient matrices are re-orderd as described in the manual

We use our own code, probably more efficient than SGU for large models. The results should be exactly the same. We checked on the small examples in their original paper (but the matrices reported are not the same. The state space isn’t the same: in SGU exogenous variables can be autocorrelated, when in Dynare, they must be endogenous and it is the innovation that is exogenous).