We are solving Ramsey policy for a New Keynesian DSGE model with heterogeneous agents. We used to employ Schimitt-Grohe Uribe’s code for deriving and solving Ramsey equilbiurm. However, this time due to large size of model (which due to heterogeneity), we get ‘out of memory’ warning when trying to get second order solution. The problem is that SGU’s code (e.g., gxx_hxx.m, line 35) generates a matrix when solving second order terms which is too big to be stored in Matlab. Then we are now considering solving this Ramsey problem using Dynare. My questions are:

- Has anyone else encountered this kind of ‘out of memory’ problem when using SGU orginal code? We have total number of 120 equations (52 states) in Ramsey equilibrium. Or does anyone know how to resolve this issue, or if SGU has a modified more efficient version of their code?
- Would the second order solution solver in Dynare be more efficient than SGU (or Kim et al) solver? In particular, can Dynare solve second order approximation for a large model of 120 equations?
- We are also looking at multiple instruments in our Ramsey optimal policy problem. Is it possible to do Ramsey problem with multiple instruemnts in Dynare? I came across some posts saying that I may need to use ‘unstable’ version of Dynare. Any advice on this would be very helpful.

By the way, we are looking at distortedsteady state and need to solve a nonlinear Ramsey problem (thus not doing linear-quadratic problem using linearized model).

Any suggestions will be highly appreciated!