testsuite: update ramsey_model to new command sequence using ramsey_model

Related to https://git.dynare.org/Dynare/dynare/issues/1678
time-shift
Johannes Pfeifer 2019-12-13 14:17:34 +01:00
parent 6b308ccbd8
commit a4030c3676
12 changed files with 32 additions and 36 deletions

View File

@ -3,7 +3,7 @@
* in Jordi Galí (2008): Monetary Policy, Inflation, and the Business Cycle,
* 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:
* - 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
* 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 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;
%% Check correctness

View File

@ -49,4 +49,6 @@ var u; stderr 0.008;
end;
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;

View File

@ -38,4 +38,6 @@ var u; stderr 0.008;
end;
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;

View File

@ -41,4 +41,5 @@ values 1;
end;
options_.dr_display_tol=0;
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);

View File

@ -41,4 +41,6 @@ values 1;
end;
options_.dr_display_tol=0;
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;

View File

@ -45,7 +45,8 @@ end;
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_);

View File

@ -84,7 +84,8 @@ planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
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;

View File

@ -13,8 +13,6 @@ var pai, c, n, r, a;
varexo u;
//------------------------------------------------------------------------------------------------------------------------
// 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
//-----------------------------------------------------------------------------------------------------------------------
// 3. The model
//-----------------------------------------------------------------------------------------------------------------------
model;
a=rho*(a(-1))+u;
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
//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);
end;
//--------------------------------------------------------------------------------------------------------------------------
@ -55,18 +44,14 @@ end;
//---------------------------------------------------------------------------------------------------------------------------
initval;
pai=1;
r=1/beta;
c=0.9671684882;
n=0.9671684882;
a=0;
end;
//---------------------------------------------------------------------------------------------------------------------------
// 5. shocks
//---------------------------------------------------------------------------------------------------------------------------
@ -86,11 +71,9 @@ planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
write_latex_static_model;
ramsey_model(planner_discount=0.99);
options_.ramsey_policy=1;
steady;
options_.simul.maxit = 20;
simul(periods=100);
perfect_foresight_setup(periods=200);
perfect_foresight_solver(maxit=20);
rplot r;

View File

@ -90,7 +90,7 @@ write_latex_static_model;
write_latex_dynamic_model;
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;

View File

@ -89,7 +89,9 @@ end;
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
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');
if (norm(o1.oo_.dr.ghx-oo_.dr.ghx,inf) > 1e-12)

View File

@ -85,6 +85,5 @@ planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
write_latex_static_model;
ramsey_model(planner_discount=0.99);
options_.ramsey_policy=1;
stoch_simul(irf=0);
evaluate_planner_objective;

View File

@ -28,4 +28,6 @@ planner_objective inflation^2 + lambda1*y^2 + lambda2*r^2;
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;