Ramsey - Assertion failed

Hi,
I have a non linear model and I would like to compute the Ramsey policy in it.

In short, my code is

I’ve got the following error message:

It seems that it does like my welfare. If I put ln(c) instead, I have:

I checked for the error:
Warning: Log of zero.

In model_FA_NL_ZLB at 680
In dynare at 132

I see that one variable equals infinity at the s.s, but I do not know which one is, I couldn’t find the variables’ order since oo_.dr does not exist.

So my questions would be:

  • why doesn’t it accept my first welfare,
  • how can I find the order of variables (if I am right, the variables are re-organized classified by predetermined,…)

Thanks for your help!
Céline

Could you please post the mod-file. Otherwise it is hard to answer your questions.

Hi,
Please find enclosed the .mod file and the load_params_and_steady_state file. Thanks for the reply, please, let me know if you have any idea of what’s happening.
Best,
Céline
Ramsey_model.zip (3.86 KB)

If you comment out the Ramsey steps, Dynare tells you that there are more endogenous variables than equations.

yes, I know. But, in my file, I didn’t comment any Ramsey steps, right? (The log objective is in comment, as an additional exercise that I mentionned in my first message).
I wrote (line 272):

Do I miss one step?

I’ve got the error message:

[quote]Starting Dynare (version 4.1.2).
Starting preprocessing of the model file …
Reading ParamMatrix.
Assertion failed: lag == 0, file DataTree.cc, line 82

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.
[/quote]

I don’t understand what does it mean…

Thanks again
Céline

I am trying to tell you that you have to fix your model before doing the Ramsey stuff. As long as the model does not run, you cannot continue to evaluate optimal policies. For this purpose, comment out the two lines you mention and then try to fix the model.

Sorry, it seems that the ParamMatrix file that I send you was broken.
Enclosed, you can find the ParamMatrix that you need to run the .mod file.
The error message still persists.
Thanks,
Céline

Hi,

The error comes from the fact that, in the planner objective, you refer to a variable which is not at current period: c(-1)

This is not currently not allowed.

A workaround is to introduce a new variable like “c1 = c(-1);”, and use “c1” in the objective instead of “c(-1)”.

I will make a change so that the error message is more explicit in the future.

Best,

It works, thanks a lot Sébastien!
Best,
Céline

I passed the first step, it (almost) runs. I have one more question (problem)…

Imposing (with bc=0):

[quote]planner_objective(ln(c-bc*clag) - (1/(1+sigmal))*lh^(1+sigmal));
ramsey_policy(planner_discount=1,order=1,irf=30) y R c pip;
[/quote]

I have the following error message now:

[quote]??? Function ‘mtimes’ is not defined for values of class ‘logical’.

Error in ==> mtimes at 18
[varargout{1:nargout}] = builtin(‘mtimes’, varargin{:});

Error in ==> dr1 at 127
info(2) = check1’*check1;

Error in ==> resol at 128
[dr,info,M_,options_,oo_] = dr1(dr,check_flag,M_,options_,oo_);

Error in ==> stoch_simul at 42
[oo_.dr, info] = resol(oo_.steady_state,0);

Error in ==> ramsey_policy at 25
info = stoch_simul(var_list);

Error in ==> model_FA_NL_ZLB1 at 585
ramsey_policy(var_list_);

Error in ==> dynare at 132
evalin(‘base’,fname) ;
[/quote]

The model runs perfectly when I compute the IRFs (stoch_simul). I computed the s.s analytically and dynare is able to compute it when I use steady; (for a given taylor rule)
I seems that Dynare is not able to compute the s.s when I ask him to compute the Ramsey optimal policy (I removed the taylor rule from the model). I tried with different calibrations, discount factor and objective function, I still have this error message.

I enclose again the codes if you want to run it (first, ‘dynare ParamValue’ and second 'dynare model_FA_NL_ZLB1). Do you have any clue about what’s going on? Sorry about pointing out all these problems…

Thanks!
best,
ParamValue.m (20 KB)
model_FA_NL_ZLB1.mod (6.76 KB)

I can’t run ParamValue as funx2 is missing. However, if your conjecture is correct, Dynare has trouble computing the steady state when varying the parameters during the search for optimal parameters. If you have analytical results for your steady state and it depends on these parameters, write a separate steady state file and feed it to Dynare. Dynare then is able to compute the steady state for each parameter combination. See the manual and search the forum on how to create such a steady state file.
With the new unstable Dynare version, there is even a way to let Dynare create such a steady state file. Hope this helps.

Thanks you very much, I will try that! Hope it will work.
Please, find enclosed funx2.m if you are interested in. Sorry for the omission…
Best,
Céline
funx2.m (1.42 KB)

Dear,
I still have one more question.

I add the _steady_state.m file and now, Dynare is able to find the steady state.

However, when I run the Ramsey policy, I obtained the following error message :

[quote]??? Reference to non-existent field ‘instruments’.

Error in ==> dr1 at 89
instruments = options_.instruments;

Error in ==> resol at 128
[dr,info,M_,options_,oo_] = dr1(dr,check_flag,M_,options_,oo_);

Error in ==> stoch_simul at 42
[oo_.dr, info] = resol(oo_.steady_state,0);

Error in ==> ramsey_policy at 25
info = stoch_simul(var_list);

Error in ==> model_FA_NL_ZLB at 582
ramsey_policy(var_list_);

Error in ==> dynare at 132
evalin(‘base’,fname) ;
[/quote]

It seems that it comes from the fact that options_.steadystate_flag = 1.
If I work with the small example on Ramsey available on the websiite, I have that options_.steadystate_flag = 0.

I don’t know what is this option options_.steadystate_flag… Is it due to the s.s file that I added? What are the instruments?

The codes are enclosed (first ‘dynare Paramvalue’, second ‘dynare model_FA_NL_ZLB’)
Thanks for your help, sorry for disturbing you with all these problems…
Best,
Céline
funx2.m (1.42 KB)
model_FA_NL_ZLB.mod (6.72 KB)
model_FA_NL_ZLB_steadystate.m (2.14 KB)
ParamValue.mod (7.9 KB)

Dear Celine,

Dynare computes the solution of the Ramsey problem with a local approximation around the steady state UNDER Ramsey policy. For complicated models such as yours, this steady state can’t be computed in advance and one needs to solve the static version of all the equations of the first order conditions of the Ramsey problem.

In some cases, it is possible to provide an analytical solution for the steadystate, conditional on the value of the instrument. It is these equations that must be listed in _steadystate.m, the value of the instrument is then passed in argument ys.

Unfortunately, this is still under development and documentation is lacking. If you send us the equations for the steady state conditional on the value of r or pip, we will help you with it. Email may be easier than the forum for that purpose.

Best,

Michel

Dear Michel,
thanks a lot for the quick reply. I will work on it and let you know if I get the FOC.
best,
Celine

Hi,

I also have the similar question. I have a DSGE model with the banking sector. When I run the Ramsey policy in my nonlinear dynare code, I obtain the following message:

==========

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

??? Error using ==> feval
Undefined function or method
’non_2_Calvo_H_Simple_Policy_normalized_test_3_Ramsey_objective_'
for input arguments of type ‘double’.

==============

The problem seems to come from the failure to generate the steady state values for each iteration. I found the ‘non_2_Calvo_H_Simple_Policy_normalized_test_3_Ramsey_objective_static.m’ stopped after calculating part of the Hessian matrix.

If this is a problem in solving the steady state, may I know whether using the analytical solution for the steady state would be the answer? (I do have the analytical solution for the steady state)

If not, can anybody tell me what the problem and possible solution would be?

[quote][/quote]

Thank for any help in advance.

Best,
Nymph

Is this the full error message? Because it says it cannot find “non_2_Calvo_H_Simple_Policy_normalized_test_3_Ramsey_objective_”, which is a file that does not exist. Have you tried using a shorter filename for your mod-file? It seems that the name got truncated, which might be the reason for the problem.

Hi jpfeifer,

Thank you so much for the prompt reply. After shortening the file name, now it passed the error message as I posted, but tells me the Blanchard and Kahn condition does not hold. However, the initial value that I use for the original file can run and generate the IRFs. I removed the policy equation for running Ramsey policy, leaving 40 equations and 41 endogenous variables, could it lead to the problem?

Moreover, I have not yet used the analytical solution of steady state for running the Ramsey problem since the previous discussions seemed not to have the certain answer. If this is the only right way to do it, I would modify accordingly.

Thank you!

Best,
Nymph