Ramsey - Assertion failed

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Ramsey - Assertion failed

Postby cel » Thu Oct 07, 2010 4:15 pm

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

In short, my code is
var (...) ;
varexo eps_gamma ;
parameters (...);
load_params_and_steady_state(ParamMatrix);

model;
(...) //I removed the monetary policy: n equations, n+1 variables
end;

initval;
(...)
end;

shocks;
var eps_gamma = 1;
end;

planner_objective((sigmac/(sigmac-1))*(c-bc*c(-1))^((sigmac-1)/sigmac) - (1/(1+sigmal))*lh^(1+sigmal));
ramsey_policy(planner_discount=0.99,order=1);



I've got the following error message:


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.

??? Error using ==> dynare at 126
DYNARE: preprocessing failed


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



Starting Dynare (version 4.1.2).
Starting preprocessing of the model file ...
Reading ParamMatrix.
Found 85 equation(s).
Evaluating expressions...done
Computing static model derivatives:
- order 1
Computing dynamic model derivatives:
- order 1
- order 2
Computing static model derivatives:
- order 1
- order 2
Processing outputs ...done
Preprocessing completed.
Starting MATLAB/Octave computing.

Warning: Log of zero.
> In model_FA_NL_ZLB at 680
In dynare at 132
Warning: Rank deficient, rank = 0, tol = 1.#INFe+000.
> In dyn_ramsey_static_ at 106
In dynare_solve at 72
In dr1 at 116
In resol at 128
In stoch_simul at 42
In ramsey_policy at 25
In model_FA_NL_ZLB at 708
In dynare at 132
STEADY: numerical initial values incompatible with the following equations
20 25 35 86

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

Error in ==> dr1 at 116
[oo_.steady_state,info1] = dynare_solve('dyn_ramsey_static_', ...

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 708
ramsey_policy(var_list_);

Error in ==> dynare at 132
evalin('base',fname) ;



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
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby jpfeifer » Thu Oct 07, 2010 4:47 pm

Could you please post the mod-file. Otherwise it is hard to answer your questions.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Ramsey - Assertion failed

Postby cel » Fri Oct 08, 2010 7:41 am

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
Attachments
Ramsey_model.zip
(3.86 KiB) Downloaded 180 times
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby jpfeifer » Fri Oct 08, 2010 8:28 am

If you comment out the Ramsey steps, Dynare tells you that there are more endogenous variables than equations.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Ramsey - Assertion failed

Postby cel » Fri Oct 08, 2010 9:05 am

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):


planner_objective((sigmac/(sigmac-1))*(c-bc*c(-1))^((sigmac-1)/sigmac) - (1/(1+sigmal))*lh^(1+sigmal));
ramsey_policy(planner_discount=0.99,order=1);



Do I miss one step?

I've got the error message:

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.


I don't understand what does it mean...

Thanks again
Céline
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby jpfeifer » Fri Oct 08, 2010 11:46 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Ramsey - Assertion failed

Postby cel » Fri Oct 08, 2010 1:55 pm

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
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby SébastienVillemot » Mon Oct 11, 2010 12:33 pm

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,
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: Ramsey - Assertion failed

Postby cel » Mon Oct 11, 2010 1:15 pm

It works, thanks a lot Sébastien!
Best,
Céline
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - one more question

Postby cel » Mon Oct 11, 2010 8:34 pm

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

Imposing (with bc=0):
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;

I have the following error message now:

??? 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) ;


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,
Attachments
ParamValue.m
(19.96 KiB) Downloaded 154 times
model_FA_NL_ZLB1.mod
(6.76 KiB) Downloaded 159 times
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby jpfeifer » Mon Oct 11, 2010 9:15 pm

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Ramsey - Assertion failed

Postby cel » Tue Oct 12, 2010 7:28 am

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
Attachments
funx2.m
(1.42 KiB) Downloaded 142 times
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby cel » Tue Oct 12, 2010 5:04 pm

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 :

??? 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) ;


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
Attachments
funx2.m
(1.42 KiB) Downloaded 152 times
model_FA_NL_ZLB.mod
(6.72 KiB) Downloaded 174 times
model_FA_NL_ZLB_steadystate.m
(2.14 KiB) Downloaded 165 times
ParamValue.mod
(7.9 KiB) Downloaded 165 times
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Re: Ramsey - Assertion failed

Postby MichelJuillard » Thu Oct 14, 2010 6:41 am

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
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Re: Ramsey - Assertion failed

Postby cel » Thu Oct 14, 2010 9:13 am

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
cel
 
Posts: 17
Joined: Tue Sep 15, 2009 9:25 am

Next

Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 8 guests