I am trying to replicate Figure 6.4 (Impulse response functions to a Technology Shock under the Optimal Policy) of Gali 2008 chapter 6 using the ‘ramsey_policy’ command.
When I use the ramsey_policy command it seems to work fine for the case of sticky wages and sticky prices (theta_p=0.66, theta_w=0.75) and sticky wages only (theta_p=0.0001, theta_w=0.75) but gets results that look very wrong for sticky prices only (theta_p=0.66, theta_w=0.0001). Specifically, with sticky prices only the optimal policy does not involve zero output gap and zero price inflation (which was proved in chapter 3 to be optimal).
I am fairly sure the model is coded fine as I use exactly the same code, only with a taylor rule for the nominal interest rate, i, included in the model, to get the IRFs to a monetary policy shock in Figure 6.3 for all three cases (both sticky, just sticky prices, just sticky wages).
Also, if I follow section 6.4 of the book and derive the system of equations characterizing the equilibrium (Gali pg 134) and use this to get the IRFs via stoch_simul then I get the same graphs as Figure 6.4.
Can anyone see why the ramsey_policy command is having problems with the sticky price only case?
The following is the code for the ramsey_policy. Attached are, in reverse order, three .mod files for getting Figure 6.3, getting Figure 6.4 by calculating the Ramsey fn, and getting Figure 6.4 by solving the system of eqns.
[code]/*
- Finds the ramsey optimal policy for the model of Gali chapter 6 (note that Galis figures are all annualized).
*/
var y_tilde pi_p pi_w omega_tilde omega_n omega y y_n r_n n a i v annualized_pi_p annualized_pi_w;
varexo epsilon_as epsilon_vs;
parameters beta sigma varphi alpha epsilon_p epsilon_w mu_p mu_w theta_p theta_w lambda_p lambda_w kappa_p kappa_w captheta psi_n_ya psi_n_omegaa rho_a sigma_epsilon_as rho_v sigma_epsilon_vs vartheta_y_n rho phi_p phi_w phi_y;
/*
*For explanation of what is going on, see the GaliChpt6.mod code which
*goes through this model.
*/
beta = 0.99;
sigma = 1;
varphi = 1;
alpha = 0.33;
epsilon_p = 6/5;
epsilon_w = 6/5;
theta_p = 0.66;
theta_w = 0.0001;
rho_a=0.9;
rho_v=0.5;
sigma_epsilon_as=1;
sigma_epsilon_vs=0.25;
phi_p=1.5;
phi_w=0;
phi_y=0;
rho=-log(beta);
mu_p=log(epsilon_p/(epsilon_p-1));
mu_w=log(epsilon_w/(epsilon_w-1));
captheta = (1-alpha)/(1-alpha+alphaepsilon_p);
lambda_p = (1-theta_p)(1-betatheta_p)captheta/theta_p;
lambda_w = (1-theta_w)(1-betatheta_w)/(theta_w*(1+epsilon_wvarphi));
kappa_p = alphalambda_p/(1-alpha);
kappa_w = lambda_w*(sigma+varphi/(1-alpha));
psi_n_ya = (1+varphi)/(sigma*(1-alpha)+varphi+alpha);
psi_n_omegaa = (1-alphapsi_n_ya)/(1-alpha);
vartheta_y_n = (1-alpha)(mu_p-log(1-alpha))/(sigma*(1-alpha)+varphi+alpha);
model;
pi_p=betapi_p(+1)+kappa_py_tilde+lambda_pomega_tilde;
pi_w=betapi_w(+1)+kappa_wy_tilde-lambda_womega_tilde;
omega_tilde=omega_tilde(-1)+pi_w-pi_p-(omega_n-omega_n(-1));
y_tilde=-(1/sigma)(i-pi_p(+1)-r_n)+y_tilde(+1);
y_tilde=y-y_n;
y = a + (1-alpha)n;
y_n=psi_n_yaa+vartheta_y_n;
omega_tilde=omega-omega_n;
omega_n=log(1-alpha)+psi_n_omegaaa-mu_p;
r_n=rho+sigmapsi_n_ya(a(+1)-a);
a=rho_aa(-1)+epsilon_as;
v=rho_vv(-1)+epsilon_vs;
annualized_pi_p=4pi_p;
annualized_pi_w=4pi_w;
end;
/*
- To compute the Ramsey optimal monetary policy we have to remove the
- Taylor rule from the baseline model
- i=rho+phi_ppi_p+phi_wpi_w+phi_y*y_tilde+v;
*/
shocks;
var epsilon_as; stderr sigma_epsilon_as;
var epsilon_vs; stderr sigma_epsilon_vs;
end;
/*
*Note, we cannot calculate the steady state as the model is incomplete due
*to missing the interest rate rule
*/
planner_objective 1/2*((sigma+(varphi+alpha)/(1-alpha))y_tilde^2 + epsilon_p/lambda_ppi_p^2 + epsilon_w*(1-alpha)/epsilon_w*pi_w^2);
ramsey_policy(irf=12, planner_discount=0.99) y_tilde annualized_pi_p annualized_pi_w omega;[/code]
PS. Am using Dynare 4.2.0 running in Octave.
PPS. In implementing ramsey_policy I followed dynare.org/DynareWiki/OptimalPolicy
OptimalMonPol_GaliChpt6.mod (2.62 KB)
GaliChpt6_RamseyOptimalPolicy.mod (2.38 KB)
GaliChpt6.mod (3.61 KB)