# Problems with Ramsey optimal policy

Hi all,

I have a somewhat adjusted model of Gerali et al. (2010) which runs using stoch_simul.
However, when trying to compute the Ramsey optimal policy in this model, I encounter some problems.

From earlier posts and examples I understand that I cannot use the steady; command before using ramsey_policy.
However, when using the initial values of Gerali and attempting to get the optimal policy, I get the following error (using Ramsey_Gerali.mod):

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
6.114642e-33.

In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In lnsrch1 at 95
In solve1 at 107
In dynare_solve at 150
In dyn_ramsey_static at 66
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali at 1308
In dynare at 180
Warning: Matrix is singular to working precision.
In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In lnsrch1 at 95
In solve1 at 107
In dynare_solve at 150
In dyn_ramsey_static at 66
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali at 1308
In dynare at 180
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
9.176551e-38.
In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In lnsrch1 at 95
In solve1 at 107
In dynare_solve at 150
In dyn_ramsey_static at 66
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali at 1308
In dynare at 180
Reference to non-existent field ‘ghx’.

Error in evaluate_planner_objective (line 46)
Gy = dr.ghx(nstatic+(1:nspred),:);

Error in ramsey_policy (line 40)
oo_.planner_objective_value = evaluate_planner_objective(M_,options_,oo_);

Error in Ramsey_Gerali (line 1308)
ramsey_policy(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;

Could anyone explain what is happenning and how I can solve this problem?

Further, when I use the steady state values that are given as output as initial values, when I run stoch_simul of this model (using Ramsey_Gerali1), I get:

Warning: Rank deficient, rank = 0, tol = NaN.

In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dynare_solve at 64
In dyn_ramsey_static at 66
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali1 at 1299
In dynare at 180
STEADY: numerical initial values or parameters incompatible with the following equations
Columns 1 through 15

`````` 1     2     4     5     6     7    10    11    12    13    16    17    18    19    20
``````

Columns 16 through 23

``````28    29    30    31    32    39    46    67
``````

i) if all parameters occurring in these equations are defined
ii) that no division by an endogenous variable initialized to 0 occurs
Warning: Rank deficient, rank = 0, tol = NaN.

In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dyn_ramsey_static at 67
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali1 at 1299
In dynare at 180
Reference to non-existent field ‘ys’.

Error in ramsey_policy (line 27)

Error in Ramsey_Gerali1 (line 1299)
ramsey_policy(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;

Lastly, I tried to compute the steady state by hand to provide initial values for the steady (using Ramsey_Gerali_SS2), I get the following error message;

Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate.
RCOND = NaN.

In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dynare_solve at 64
In dyn_ramsey_static at 66
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali_SS2 at 1328
In dynare at 180
STEADY: numerical initial values or parameters incompatible with the following equations
2 7 11 32 33 34

i) if all parameters occurring in these equations are defined
ii) that no division by an endogenous variable initialized to 0 occurs
Warning: Matrix is singular to working precision.

In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dyn_ramsey_static at 67
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In Ramsey_Gerali_SS2 at 1328
In dynare at 180
Reference to non-existent field ‘ys’.

Error in ramsey_policy (line 27)

Error in Ramsey_Gerali_SS2 (line 1328)
ramsey_policy(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;

My questions are as follow:
what approach is the best to use? providing numerical initial values or an analytical solution?
what do the errors mean and how can I solve these?

I am really looking forward to getting some help, thanks a lot in advance!!

Nick
Ramsey_Gerali1.mod (19.9 KB)
Ramsey_Gerali_SS2.mod (20.5 KB)
Ramsey_Gerali.mod (21 KB)

Dear Nick,
providing analytical values is usually the best way. Unfortunately, the diagnostic tools for Ramsey are still under development/buggy. I will try to look into this in the next days/weeks.