Page 1 of 1

Discretionary policy

PostPosted: Mon Jun 05, 2017 9:16 pm
by marlenemaya
Hi!
I'm running a new keynesian stochastic model.I'm evaluating the welfare loss with a ramsey_policy rule. Then I switched to discretionary_policy, but I meet some errors messages. In particular
Code: Select all
Error using discretionary_policy_1 (line 71)
discretionary_policy: the objective function must have zero first order derivatives

Error in stoch_simul (line 76)
    [oo_.dr,ys,info] = discretionary_policy_1(oo_,options_.instruments);

Error in discretionary_policy (line 25)
info = stoch_simul(var_list);

Error in ed (line 231)
discretionary_policy(var_list_);

Error in dynare (line 223)
evalin('base',fname) ;
 

I attach here my code. What should I change?
Thank you in advance

Re: Discretionary policy

PostPosted: Tue Jun 06, 2017 7:00 am
by jpfeifer
You need to provide the mod-file, not the m-file. My guess is that your objective function is not written in terms of centered second moments, but rather contains a linear term as well (e.g. if there is a distorted steady state)

Re: Discretionary policy

PostPosted: Tue Jun 06, 2017 10:23 am
by marlenemaya
Sorry this is the correct file.

Re: Discretionary policy

PostPosted: Wed Jun 07, 2017 6:24 am
by jpfeifer
Your objective contains
Code: Select all
((1-n)/kappa_f)*pp_f

at the end. This is a linear term, not a quadratic one.

Re: Discretionary policy

PostPosted: Sun Jun 11, 2017 9:40 pm
by marlenemaya
Thank you!
That was a mistake!
The problem, anyway,remains. When I try to run the code I receive an error message saying that the objective function should have zero first order derivative. I don't really know how to get out of it....
Thank you

Re: Discretionary policy

PostPosted: Mon Jun 12, 2017 6:05 pm
by jpfeifer
Please provide the updated mod-file

Re: Discretionary policy

PostPosted: Mon Jun 12, 2017 6:42 pm
by marlenemaya
This is the updated file-
Thank you

Re: Discretionary policy

PostPosted: Mon Jun 12, 2017 6:50 pm
by jpfeifer
Code: Select all
(n*sigmas)/2)*(s-sb)

is still linear

Re: Discretionary policy

PostPosted: Mon Jun 12, 2017 7:52 pm
by marlenemaya
Yes ist's true. Anyway also correcting the code (every element at ^2), I receive te following error message:
Error using print_info (line 133)
Discretionary policy: NaN elements are present in the solution. Procedure failed.

Error in stoch_simul (line 94)
print_info(info, options_.noprint, options_);

Error in discretionary_policy (line 25)
info = stoch_simul(var_list);

Error in ed (line 236)
discretionary_policy(var_list_);

Error in dynare (line 223)
evalin('base',fname) ;

Re: Discretionary policy

PostPosted: Wed Jun 14, 2017 4:30 pm
by jpfeifer
There must still be a fundamental timing error in the model. model_diagnostics says:
Code: Select all
MODEL_DIAGNOSTICS: The following endogenous variables aren't present at the current period in the model:
w   

Re: Discretionary policy

PostPosted: Thu Jun 15, 2017 3:26 pm
by marlenemaya
The problem is that if I specify the expression for the losses in the model(that is linear), it cannot be solved because is not linear.
I don't really know what to do....

Re: Discretionary policy

PostPosted: Fri Jun 16, 2017 8:57 am
by jpfeifer
Those are two different things. The objective function does not belong in the model-block. But when a variable does not appear with contemporaneous timing, it indicates a timing error in the model. That variable would otherwise not be determined by your model

Re: Discretionary policy

PostPosted: Fri Jun 16, 2017 2:34 pm
by marlenemaya
thank, you...maybe I've found what's wrong.....the welfare losses w(the objective function), are the infinite summation of the welfare losses from 0 to infinitive. I should find a way to include this summation into the expression, but I've read that on dynare is not possible. I should transform the sum in a recursive expression (since I cannot linearize the objective function) but I don't know exactly how to do it...
Thank you for the big help until now!

Re: Discretionary policy

PostPosted: Fri Jun 16, 2017 2:38 pm
by marlenemaya
Nb also I cannot enter lagged or lead variables into the discretionary_policy command...

Re: Discretionary policy

PostPosted: Sat Jun 17, 2017 3:17 pm
by jpfeifer
The planner_objective takes a period utility function, not the intertemporal one. If you need leads or lags in the objective, you need to define an auxiliary variable defining the lag in the model block and then use that auxiliary variable