Page 1 of 1

Bug in k_order_solver? ghx changes from order 1/2 to 3

PostPosted: Fri Aug 20, 2010 2:45 pm
by jpfeifer
Dear all,

I compared in two models the solutions using different solvers and approximation orders. Unfortunately, there are significant differences that should not occur from my point of view.
What I found is the following: The first order solution, i.e. in particular dr.ghx, is the same whether I use the k_order_solver option for order 1 or 2 or if I use the standard solver. However, independent of the solver I use, when I move from 2nd to 3rd order, the first order solution (i.e. dr.ghx) significantly changes. From my understanding this should not be the case as the first term of a Taylor approximation should be independent of higher order terms.
In contrast, the second order terms dr.ghxx and dr.ghxu are the same for 2nd and 3rd order approximations.

The above problem might also be the reason for my post about the strange error message " Caught Kord exception: NaN or Inf asserted in first order derivatives in FirstOrder::solve" (http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2720) as the problem obviously only occurs in the first order derivatives.

The problem occured with the unstable Dynare version of 08/20/2010 under Matlab 2010a 32bit with MSVC10.

Re: Bug in k_order_solver? ghx changes from order 1/2 to 3

PostPosted: Tue Aug 24, 2010 1:55 pm
by SébastienVillemot
Hi,

Actually this is not necessarily a bug.

The point is that Dynare does not deliver the Taylor approximation of the decision rule. It delivers the decision rule of an approximated version of the model. This is quite different, and explains why lower order terms can change when moving to higher order, since when moving to higher order we solve for a different problem (the model is approximated to a different order).

For example, when moving from first to second order, the constant term changes (shift effect due to the variance of the future shocks). This would not have been the case if the solution delivered by Dynare was the Taylor approximation of the decision rules, since the constant term would then be the same in a 1st and 2nd order Taylor expansion of the same function.

It is probably a similar phenomenon at work in your example.

Best,