Merge branch 'ramsey' into 'master'
New Ramsey syntax See merge request Dynare/dynare!1685time-shift
commit
7170ac0423
|
@ -28,14 +28,17 @@ function planner_objective_value = evaluate_planner_objective(M,options,oo)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
if options.order>1
|
||||||
|
fprintf('\nevaluate_planner_objective: order>1 not yet supported\n')
|
||||||
|
planner_objective_value = NaN;
|
||||||
|
return
|
||||||
|
end
|
||||||
dr = oo.dr;
|
dr = oo.dr;
|
||||||
exo_nbr = M.exo_nbr;
|
exo_nbr = M.exo_nbr;
|
||||||
nstatic = M.nstatic;
|
nstatic = M.nstatic;
|
||||||
nspred = M.nspred;
|
nspred = M.nspred;
|
||||||
if nspred > 180
|
if nspred > 180
|
||||||
disp(' ')
|
fprintf('\nevaluate_planner_objective: model too large, can''t evaluate planner objective\n')
|
||||||
disp(['WARNING in evaluate_planner_objective: model too large, can''t evaluate planner ' ...
|
|
||||||
'objective'])
|
|
||||||
planner_objective_value = NaN;
|
planner_objective_value = NaN;
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -109,15 +112,13 @@ if options.ramsey_policy
|
||||||
end
|
end
|
||||||
|
|
||||||
if ~options.noprint
|
if ~options.noprint
|
||||||
skipline()
|
fprintf('\nApproximated value of planner objective function\n')
|
||||||
disp('Approximated value of planner objective function')
|
|
||||||
if options.ramsey_policy
|
if options.ramsey_policy
|
||||||
disp([' - with initial Lagrange multipliers set to 0: ' ...
|
fprintf(' - with initial Lagrange multipliers set to 0: %10.8f\n', ...
|
||||||
num2str(planner_objective_value(2)) ])
|
planner_objective_value(2))
|
||||||
disp([' - with initial Lagrange multipliers set to steady state: ' ...
|
fprintf(' - with initial Lagrange multipliers set to steady state: %10.8f\n\n', ...
|
||||||
num2str(planner_objective_value(1)) ])
|
planner_objective_value(1))
|
||||||
elseif options.discretionary_policy
|
elseif options.discretionary_policy
|
||||||
fprintf('with discretionary policy: %10.8f',planner_objective_value(1))
|
fprintf('with discretionary policy: %10.8f\n\n',planner_objective_value(1))
|
||||||
end
|
end
|
||||||
skipline()
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* in Jordi Galí (2008): Monetary Policy, Inflation, and the Business Cycle,
|
* in Jordi Galí (2008): Monetary Policy, Inflation, and the Business Cycle,
|
||||||
* Princeton University Press, Chapter 5.1.2
|
* Princeton University Press, Chapter 5.1.2
|
||||||
*
|
*
|
||||||
* It demonstrates how to use the ramsey_policy command of Dynare.
|
* It demonstrates how to use the ramsey_model command of Dynare.
|
||||||
*
|
*
|
||||||
* Notes:
|
* Notes:
|
||||||
* - all model variables are expressed in deviations from steady state, i.e.
|
* - all model variables are expressed in deviations from steady state, i.e.
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015 Johannes Pfeifer
|
* Copyright (C) 2015-19 Johannes Pfeifer
|
||||||
*
|
*
|
||||||
* This is free software: you can redistribute it and/or modify
|
* This is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -168,7 +168,8 @@ end;
|
||||||
//planner objective using alpha_x expressed as function of deep parameters
|
//planner objective using alpha_x expressed as function of deep parameters
|
||||||
planner_objective pi^2 +(((1-theta)*(1-betta*theta)/theta*((1-alppha)/(1-alppha+alppha*epsilon)))*(siggma+(phi+alppha)/(1-alppha)))/epsilon*y_gap^2;
|
planner_objective pi^2 +(((1-theta)*(1-betta*theta)/theta*((1-alppha)/(1-alppha+alppha*epsilon)))*(siggma+(phi+alppha)/(1-alppha)))/epsilon*y_gap^2;
|
||||||
|
|
||||||
ramsey_policy(instruments=(i),irf=13,planner_discount=betta) x pi p u;
|
ramsey_model(instruments=(i),planner_discount=betta);
|
||||||
|
stoch_simul(order=1,irf=13) x pi p u;
|
||||||
|
|
||||||
verbatim;
|
verbatim;
|
||||||
%% Check correctness
|
%% Check correctness
|
||||||
|
|
|
@ -49,4 +49,6 @@ var u; stderr 0.008;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
ramsey_policy(planner_discount=0.99,order=1,instruments=(r));
|
ramsey_model(planner_discount=0.99,instruments=(r));
|
||||||
|
stoch_simul(order=1,periods=500);
|
||||||
|
evaluate_planner_objective;
|
|
@ -38,4 +38,6 @@ var u; stderr 0.008;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
ramsey_policy(planner_discount=0.99,order=1,instruments=(r));
|
ramsey_model(planner_discount=0.99,order=1,instruments=(r));
|
||||||
|
stoch_simul(order=1,periods=500);
|
||||||
|
evaluate_planner_objective;
|
|
@ -41,4 +41,5 @@ values 1;
|
||||||
end;
|
end;
|
||||||
options_.dr_display_tol=0;
|
options_.dr_display_tol=0;
|
||||||
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
ramsey_policy(planner_discount=0.99,order=1,instruments=(r),periods=500);
|
ramsey_model(planner_discount=0.99,instruments=(r));
|
||||||
|
stoch_simul(order=1,periods=500);
|
|
@ -41,4 +41,6 @@ values 1;
|
||||||
end;
|
end;
|
||||||
options_.dr_display_tol=0;
|
options_.dr_display_tol=0;
|
||||||
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
ramsey_policy(planner_discount=0.99,order=1,instruments=(r),periods=500);
|
ramsey_model(planner_discount=0.99,instruments=(r));
|
||||||
|
stoch_simul(order=1,periods=500);
|
||||||
|
evaluate_planner_objective;
|
|
@ -45,7 +45,8 @@ end;
|
||||||
|
|
||||||
planner_objective 0.25*pie_obs^2+y^2+0.1*dR^2;
|
planner_objective 0.25*pie_obs^2+y^2+0.1*dR^2;
|
||||||
|
|
||||||
ramsey_policy(order=1,irf=0,planner_discount=0.95);
|
ramsey_model(planner_discount=0.95);
|
||||||
|
stoch_simul(order=1,irf=0);
|
||||||
|
|
||||||
dr2 = mult_elimination({'R'},M_,options_,oo_);
|
dr2 = mult_elimination({'R'},M_,options_,oo_);
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,8 @@ planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
|
|
||||||
write_latex_static_model;
|
write_latex_static_model;
|
||||||
|
|
||||||
ramsey_policy(planner_discount=0.99);
|
ramsey_model(planner_discount=0.99);
|
||||||
|
stoch_simul(order=1,irf=20);
|
||||||
|
evaluate_planner_objective;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@ var pai, c, n, r, a;
|
||||||
varexo u;
|
varexo u;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------
|
||||||
// 2. Parameter declaration and calibration
|
// 2. Parameter declaration and calibration
|
||||||
//-------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -29,25 +27,16 @@ phi=1; //coefficient associated to labor effort disutility
|
||||||
|
|
||||||
rho=0.95; //coefficient associated to productivity shock
|
rho=0.95; //coefficient associated to productivity shock
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
// 3. The model
|
// 3. The model
|
||||||
//-----------------------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
model;
|
model;
|
||||||
|
|
||||||
|
|
||||||
a=rho*(a(-1))+u;
|
a=rho*(a(-1))+u;
|
||||||
|
|
||||||
1/c=beta*(1/(c(+1)))*(r/(pai(+1))); //euler
|
1/c=beta*(1/(c(+1)))*(r/(pai(+1))); //euler
|
||||||
|
|
||||||
|
|
||||||
omega*pai*(pai-1)=beta*omega*(c/(c(+1)))*(pai(+1))*(pai(+1)-1)+epsilon*exp(a)*n*(c/exp(a)*phi*n^gamma-(epsilon-1)/epsilon); //NK pc
|
omega*pai*(pai-1)=beta*omega*(c/(c(+1)))*(pai(+1))*(pai(+1)-1)+epsilon*exp(a)*n*(c/exp(a)*phi*n^gamma-(epsilon-1)/epsilon); //NK pc
|
||||||
//pai*(pai-1)/c = beta*pai(+1)*(pai(+1)-1)/c(+1)+epsilon*phi*n^(gamma+1)/omega-exp(a)*n*(epsilon-1)/(omega*c); //NK pc
|
//pai*(pai-1)/c = beta*pai(+1)*(pai(+1)-1)/c(+1)+epsilon*phi*n^(gamma+1)/omega-exp(a)*n*(epsilon-1)/(omega*c); //NK pc
|
||||||
|
|
||||||
(exp(a))*n=c+(omega/2)*((pai-1)^2);
|
(exp(a))*n=c+(omega/2)*((pai-1)^2);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -55,18 +44,14 @@ end;
|
||||||
//---------------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
initval;
|
initval;
|
||||||
|
|
||||||
pai=1;
|
pai=1;
|
||||||
r=1/beta;
|
r=1/beta;
|
||||||
c=0.9671684882;
|
c=0.9671684882;
|
||||||
n=0.9671684882;
|
n=0.9671684882;
|
||||||
a=0;
|
a=0;
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------------
|
||||||
// 5. shocks
|
// 5. shocks
|
||||||
//---------------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -86,11 +71,9 @@ planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
write_latex_static_model;
|
write_latex_static_model;
|
||||||
|
|
||||||
ramsey_model(planner_discount=0.99);
|
ramsey_model(planner_discount=0.99);
|
||||||
|
|
||||||
options_.ramsey_policy=1;
|
|
||||||
steady;
|
steady;
|
||||||
|
|
||||||
options_.simul.maxit = 20;
|
perfect_foresight_setup(periods=200);
|
||||||
simul(periods=100);
|
perfect_foresight_solver(maxit=20);
|
||||||
|
|
||||||
rplot r;
|
rplot r;
|
||||||
|
|
|
@ -90,7 +90,7 @@ write_latex_static_model;
|
||||||
write_latex_dynamic_model;
|
write_latex_dynamic_model;
|
||||||
|
|
||||||
options_.solve_tolf=1e-12;
|
options_.solve_tolf=1e-12;
|
||||||
ramsey_policy(planner_discount=0.99);
|
ramsey_model(planner_discount=0.99);
|
||||||
|
stoch_simul(order=1,irf=0);
|
||||||
|
evaluate_planner_objective;
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,9 @@ end;
|
||||||
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
|
|
||||||
options_.solve_tolf=1e-12;
|
options_.solve_tolf=1e-12;
|
||||||
ramsey_policy(planner_discount=0.99);
|
ramsey_model(planner_discount=0.99);
|
||||||
|
stoch_simul(order=1,irf=0);
|
||||||
|
evaluate_planner_objective;
|
||||||
|
|
||||||
o1=load('nk_ramsey_expectation_results');
|
o1=load('nk_ramsey_expectation_results');
|
||||||
if (norm(o1.oo_.dr.ghx-oo_.dr.ghx,inf) > 1e-12)
|
if (norm(o1.oo_.dr.ghx-oo_.dr.ghx,inf) > 1e-12)
|
||||||
|
|
|
@ -85,6 +85,5 @@ planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
|
||||||
write_latex_static_model;
|
write_latex_static_model;
|
||||||
|
|
||||||
ramsey_model(planner_discount=0.99);
|
ramsey_model(planner_discount=0.99);
|
||||||
options_.ramsey_policy=1;
|
|
||||||
stoch_simul(irf=0);
|
stoch_simul(irf=0);
|
||||||
|
evaluate_planner_objective;
|
||||||
|
|
|
@ -28,4 +28,6 @@ planner_objective inflation^2 + lambda1*y^2 + lambda2*r^2;
|
||||||
|
|
||||||
write_latex_dynamic_model;
|
write_latex_dynamic_model;
|
||||||
|
|
||||||
ramsey_policy(planner_discount=0.95, order = 1);
|
ramsey_model(planner_discount=0.95);
|
||||||
|
stoch_simul(order=1);
|
||||||
|
evaluate_planner_objective;
|
Loading…
Reference in New Issue