Problem with solver in Ramsey Policy


I’m trying to solve a discretionary Ramsey problem, including providing Dynare with a steady state block (which seem to work fine).

However, when dynare is looking for the optimal policy, I receive the following error message:
Index exceeds the number of array elements (1).
Error in trust_region (line 123)
fvec1 = fvec1(j1);
Error in dynare_solve (line 185)
[x,info]=solver(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag, …
Error in dyn_ramsey_static (line 70)
[inst_val,info1] = dynare_solve(nl_func,ys_init(k_inst), …
Error in evaluate_steady_state (line 139)
[ys,params,info] = dyn_ramsey_static(ys_init,M,options,oo);
Error in resol (line 104)
[dr.ys,M.params,info] =
Error in stoch_simul (line 89)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
Error in ramsey_policy (line 42)
info = stoch_simul(var_list);
Error in World_Economy_Cartel_no_calib (line 539)
Error in dynare (line 235)
evalin(‘base’,fname) ;

I attach a zip folder with the dynare code. It should be run by running ‘temp_run_dynare’. (4.5 KB)

I’m not really sure what could be causing this error. Any help is appreciated!!


On the technical side there is a bug that prevents a proper error message. See
On the economic side, as soon as theta_N = 0.336, the steady state becomes complex and no steady state is found.

Thanks so much Johannes!

Could you direct me to where you saw the steady state becomes complex?
When I look at the other endogenous ss variables for the iteration with theta_N=0.336, they all seem real and positive.

For the instrument values


it seems that consumption C becomes negative.

1 Like