Levin's get_ramsey in Dynare version 4

Dear All,

I have been using Levin’s get_ramsey code to compute for the first-order conditions of the Ramsey problem. Once I have these, together with the constraints, I then ask Dynare to estimate the equations using second-order perturbation. Using Dynare version 3.065, my dynare code works well. However, if I use Dynare version 4.0.3, I get the following results:
onfiguring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.

Starting Dynare …
Starting preprocessing of the model file …
37 equation(s) found
Processing derivation …
Processing Order 1… done
Processing Order 2… done
Processing outputs …
Preprocessing completed.
Starting Matlab computing …

accuracy criterion, errcheck = 5.6843e-014
Exit flag = 1
annual interest rate = 1.04
annual inflation rate = 1
STEADY: numerical initial values incompatible with the following equations
Columns 1 through 16

 1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16

Columns 17 through 32

17    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32

Columns 33 through 37

33    34    35    36    37

??? Error using ==> dynare_solve at 82
exiting …

Error in ==> steady_ at 69
[oo_.steady_state,check] = dynare_solve([M_.fname ‘_static’],…

Error in ==> steady at 52

Error in ==> ramseyprob_out at 322

Error in ==> dynare at 102
evalin(‘base’,fname) ;

I learned that Levin’s get_ramsey was coded to work with Dynare version 3. How can we adapt the code to work with Dynare version 4?


Diana Rose del Rosario


We don’t know how to update the code for v4, since it is not maintained by the Dynare team.

Note however that Dynare v4 natively provides similar functionality with ramsey_policy command, see:



Dear Sébastien,

Thank you for your reply. This ramsey_policy command in Dynare v4 immediately gives out the first-order accurate solutions to the policy functions. I want to do second-order approximation. Is there a way to do it in Dynare v4?


I was wondering the same question for a while. As far as I know ramsey_policy in dynare version 4 does not do the second order approximation and get_ramsey works only with dynare version 3.

One more thing, the only way to make the code created by get_ramsey work in dynare v4 is to write the steady states of the langrange multipliers in mod file as you would do with your other variables. You cannot refer to the file yourmodfilename_lmss in the mod file created by get_ramsey. For some reason it just does not take the steady state values of lagrange multipliers from yourmodfilename_lmss. I had the same incompatibility issue, I solved by doing the following

normally in the very end of the mod file from get_ramsey, you should have for all langrange multipliers


So just replace lmutl1_SS with its numerical value. The only problem with this approach, every time you change a parameter in your model, lmult_SS values will change and you will have to change them manually.
I think it is best for now to do everything related to get_ramsey in dynare v3 otherwise it is very inefficient to change things manually.

Hello, Elif! I followed what you said. When doing something that concerns get_ramsey, I use Dynare v3. In my current endeavor, I am just after the Ramsey steady states so once I have them, I proceed to using Dynare v4 and just load the .mat file that contains the Ramsey steady states in my .mod file that will be run with Dynare v4.