External steady-state.m file doesn't work for optimal policy

Dear all,

I use an external .m file (and the fsolve) to calculate the parameter values for a log-linearised by hand model. While the external file works properly when I solve for the ifrs of the model, it does not work when I try to solve for the optimal (Ramsey) policy.

The message error is the following

Improper assignment with rectangular empty matrix.
Error in csolve (line 80)
grad(:,i) = (feval(FUN,x+tvec(:,i),varargin{:})-f0)/delta;
Error in dyn_ramsey_static (line 55)
inst_val = csolve(nl_func,oo.steady_state(k_inst),’’,options_.solve_tolf,100);
Error in evaluate_steady_state (line 55)
[ys,params] = dyn_ramsey_static(ys_init,M,options,oo);
Error in resol (line 104)
[dr.ys,M.params,info] = evaluate_steady_state(oo.steady_state,M,options,oo,0);
Error in stoch_simul (line 88)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);
Error in ramsey_policy (line 25)
info = stoch_simul(var_list);
Error in NK_ff_optimal (line 737)
ramsey_policy(var_list_);
Error in dynare (line 180)
evalin(‘base’,fname) ;

while before I get a warning that my parameters have no value. I guess that means that the .mod file does not take the parameter values from the .m file ( I have done everything correctly like setting the same on each file with the extension steadystate for the .m file etc)

Thank you very much in advance

That’s because your steady state for Ramsey needs to be written conditional on the value for the instrument. For every value of the instrument given by Dynare, you need to provide the corresponding steady state values. Steady state files for the regular model in contrast compute the steady state for the instrument endogenously. For example, if the nominal interest rate is your instrument, in Ramsey you need to provide the corresponding steady state for inflation. In the regular model, you would have a parameter for steady state inflation that determined both the interest rate and steady state inflation.
An example is here: github.com/DynareTeam/dynare/blob/master/tests/optimal_policy/Ramsey/ramsey_ex.mod

1 Like

That is brilliant. Thank you once again Johannes.

Best,