I'm currently trying to back out the state space representation of a third order approximation from Dynare's storage structure and am concerned that the manual (link: http://www.dynare.org/manual/index_26.html) has an important typo in the discussion of the G2 matrix in the third-order approximation.
The concern is in the following line:
Also note that for those pairs where $i_1 \neq i_2$, since the element is stored only once but appears two times in the unfolded $G_2$ matrix, it must be multiplied by 2 when computing the decision rules.
The reason that there may be a typo is that when I run an exercise using a simple RBC model, I found that only by multiplying ALL of the unfolded version of G2 by 2 can I match the second-order matrices C, D and E as defined in the second-order approximation section of the manual (i.e. 2*oo_.dr_2 returns a folded version of the structures oo_dr.ghxx, oo_dr.ghuu and oo_dr.ghxu). If this is correct (i.e. these matrices should be equivalent) then the manual should state that all elements in the folded matrix must be multiplied by 2 (not only those columns associated with non-squared terms of the approximation).
Also, if my above intuition is right then a second issue arises in the discussion about the G3 matrix. More precisely, do we multiply cross-product terms of order 1 by 6, cross-product terms of order 2 by 3 and leave terms of order 3 as they are? If not, what would be the correct way of recovering the coefficients? A guess based on the previous case of the G2 matrix would be that we simply need to multiply all values in the G3 matrix by 3.
Thankyou for your time,
Jamie