Optimal policy parameters in a non-linear model

Thank you very much. I am really grateful. Is there an example mod file that computes lambda? I understand what is lambda but I couldn’t figure out how I can write the code for W_p and W_ap in dynare?

\lambda depends on the utility function.
If I had log utility and if welfare corresponding to the economy with \tau=0 is my benchmark, and any other value of \tau would correspond to an alternative economy, then would insert something like

lambda(ii)=exp((1-BETA)*(mean.W(ii)-mean.W(1)))-1;
% and therefore
mat_loop_MP(:,n)=[TAU_grid(ii);mean.W(ii);lambda(ii)*100];

in the code.
On the contrary, if your utility function is the one in the paper, you have to write equation (32).

1 Like

Actually, I have GHH preferences with 3 arguments consumption, hours for tradable sector, hours for non tradable sector. I couldn’t derive lambda in terms of welfares with this utility specification. Would it be alright if I define lambda as follows:

lambda =( (EVa/beta^t +h(benchmark))/c(benchmark)) -1

I suggest you have a look at https://www.sciencedirect.com/science/article/pii/S0165188913001887:
Appendix B.4, equation B.18 and see how you can adapt it to your case.:slightly_smiling_face:

@lanfear I have been following this discussion. I would suggest you try first to replicate the original paper without changes to see whether your approach is correct. Currently, you are trying to get the method right and understand the modification you introduced. That is usually not a good idea.

You are right prof. Pfeifer. First I will try the understand the original model. Also thank you very much @cmarch I really appreciate your help.

Greetings,
I get an error term (Not enough input arguments) when I try to get optimal policy parameters. I would appreciate some guidance on this.
Since it is a related topic I did not want to start a new thread. Thanks in advance.inflabrig.mod (4.9 KB) inflabrig_steadystate.m (1.9 KB) steadystate.m (521 Bytes) welfare_objective.m (1.1 KB) (upload://f6m24vSf8TXyFaVuuoSlZLx5Oei.m) (1.1 KB)

In Dynare 4.6.2, the global variables have been removed from simult_. The call needs to be

y_sim = simult_(M_,options_,initial_condition_states,oo_.dr,shock_matrix,options_.order); %simulate one period to get value

in welfare_objective.m

The code works now. Thank you for the guidance. Much appreciated.

Dear Prof Pfeifer,

I have tried to run the code above (Fed_paper_26Apr_mp_opt.mod, adding the maximising part the end of the code and save the objective function in .m file but got the following errors:

Not enough input arguments.

Error in stoch_simul (line 21)
if isequal(options_.order,0)

Error in welfare_objective (line 17)
info = stoch_simul(var_list_); %get decision rules and moments

Error in csminwel (line 62)
f0 = fcn(x0,varargin{:});

Error in mp_opt.driver (line 1084)
[fhat,x_opt_hat] = csminwel(@welfare_objective,x_start,H0,[],crit,nit,x_opt_name);

Error in dynare (line 293)
evalin(‘base’,[fname ‘.driver’]) ;

Can you please help me where I made a mistake?
Thank you for you help.

The files:
mp_opt.mod (12.3 KB)
welfare_objective.m (702 Bytes)

There is a version conflict. The syntax of stoch_simul relying on global variables only works in 4.5. See e.g. DSGE_mod/get_consumption_equivalent_unconditional_welfare.m at master · JohannesPfeifer/DSGE_mod · GitHub

Thanks for your reply. It is clear now.

Dear Johannes Pfeifer,

I have tried the code above by Tom80 (mp_opt.mod and welfare_objective.m) from November 2021, and I’ve fixed the issue with the stoch_simul relying on global variables. I’m using Dynare 5.4 and the code gives me a new error:

Brace indexing is not supported for variables of this type.

Error in disp_moments (line 44)
i_tmp = strmatch(var_list{i}, M_.endo_names, ‘exact’);

Error in stoch_simul (line 216)
oo_=disp_moments(oo_.endo_simul,var_list,M_,options_,oo_);

Error in welfare_objective (line 17)
info = stoch_simul(M_, options_, oo_, var_list_); %get decision rules and moments

Error in csminwel (line 62)
f0 = fcn(x0,varargin{:});

Error in mp_opt.driver (line 1089)
[fhat,x_opt_hat] = csminwel(@welfare_objective,x_start,H0,,crit,nit,x_opt_name);

Error in dynare (line 278)
evalin(‘base’,[fname ‘.driver’]);

Could you please help me out? The new codes are attached.
mp_opt2.mod (12.3 KB)
welfare_objective2.m (721 Bytes)

The file welfare_objective2.m (717 Bytes) should work with Dynare 5.

2 Likes

Thank you, the code works now! However, I think I’m still doing something wrong: When I the optimal values (x_opt_hat) I get out are always the same as the initial values (x_start). I have tried many initial guesses, and there is usually only one iteration, after it says Improvement on iteration 1 = 0.000000000. When I check the optimal values, they are the same as the initial values I put it. It would be great if you could tell me why this is happening. Thanks!

The function should be along the lines of
welfare_objective2.m (769 Bytes)
Note that I encounter a steady state computation problem with your file.

Hello, everyone

I am having the exact same problem as @mphilstudent . I want to find parameter values of a modified Taylor rule that maximizes conditional welfare. However, the optimal values are always equal to the initial values I choose for the parameters. I’ve tried various initial guesses, but haven’t succeeded. Could someone give me a way to solve this problem?

test21.mod (11.1 KB)
test21_steadystate.m (7.8 KB)
conditional_welfare.m (1.4 KB)

You need to try to better understand your model. If I vary the parameters in the Taylor rule, I always get

APPROXIMATED THEORETICAL MOMENTS
VARIABLE         MEAN  STD. DEV.   VARIANCE
WS_t          -2.7365     0.0225     0.0005

Thus, monetary policy seems to play no role. I also updated your code to get rid of the global variables:
test21.mod (11.2 KB)
conditional_welfare.m (1.7 KB)
test21_steadystate.m (7.8 KB)