// Basic New Keynesian Model under fully optimal commitment policy var x, // 1.Output Gap pi, // 2.Inflation i, // 3.Nominal interest rate r, // 4.Real interest rate rn, // 5.Natural interest rate z, // 6.Technology shock u; // 7.Cost Push Shock varexo e_z e_u; parameters beta, // Subjective discount factor eta, // Labor supply coef. in utility function sigma, // Consumption index coef. in utility function omega, // Calvo parameter (Fraction of firms not adjusting prices) kappa, // Inflation elasticity w.r.t output gap rho_z, // Tech. Shock persistance sde_z, // Standard deviation for tech. shock rho_u, // Cost push shock persistance sde_u, // Stadard deviation for cost push shock lambda, // Weight on output gap in the policy objective epsilon; // Elasticity of substitution between consumption goods // Deep Parameters Calibration beta = 0.99; eta = 1.0; sigma = 1.0; omega = 0.8; rho_z = 0.9; sde_z = 1.0; rho_u = 0.0; sde_u = 1.0; epsilon = 6; // Implied Parameters kappa = (sigma + eta)*(1-omega)*(1-omega*beta)/omega; //lambda = (kappa)/((1+neta*epsilon)*epsilon); lambda = kappa/epsilon; model(linear); x = x(+1) - (1/sigma)*(r-rn); // Dinamic IS curve pi = beta*pi(+1) + kappa*x + u; // New Keynessian Phillips curve rn = sigma*((1+eta)/(eta+sigma))*(z(+1)-z); // Natural interes rate r = i - pi(+1); // Real interest rate z = rho_z*z(-1) + e_z; u = rho_u*u(-1) + e_u; end; shocks; var e_z = (sde_z)^2; var e_u = (sde_u)^2; end; ///////////////////////////////////////// // Computing theoretical moments and IRF's under optimal policy //////////////////////////////////////// planner_objective pi^2 + lambda*(x^2); ramsey_policy(planner_discount=0.99,nograph,noprint); OOPT.MODELS.ooNKM_optc = oo_; OOPT_NKM_optc = OOPT.MODELS.ooNKM_optc; save OOPT_NKM_optc; OOPT.NN=12; OOPT.plot_color={'o-b'}; OOPT.shocks_names={'e_u'}; OOPT.tit_shocks={'Cost Shock'}; OOPT.type_models={'ooNKM_optc'}; OOPT.legend_models={'Opt. Commitment'}; OOPT.list_endo={'pi' 'x' 'i' 'r' 'rn' 'u'}; OOPT.label_variables={'Inflation Rate' 'Output Gap' 'Nominal Interest Rate' 'Real Interest Rate' 'Natural Interest Rate' 'Cost Shock'}; plot_comp(OOPT); print -depsc2 'Figure 1' /* rho_u = 0.8; planner_objective pi^2 + lambda*x^2; ramsey_policy(planner_discount=0.99,nograph,noprint); OOPT.MODELS.ooNKM_optc_1 = oo_; OOPT_NKM_optc_1 = OOPT.MODELS.ooNKM_optc_1; save OOPT_NKM_optc_1; ///////////////////////////////////////// // Plotting Impulse-Response functions // This part uses the plot_comp function in order to do multiple IRFS graphs. //////////////////////////////////////// OOPT.NN=12; OOPT.tit_shocks={'Technology Shock'}; OOPT.type_models={'ooNKM_optc'}; // OOPT.legend_models={'\rho_i=0' '\rho_i=0.5' '\rho_i=0.9'}; OOPT.list_endo={'pi' 'x' 'i' 'r' 'rn' 'z'}; OOPT.label_variables={'Inflation Rate' 'Output Gap' 'Nominal Interest Rate' 'Real Interest Rate' 'Natural Interest Rate' 'Technology Shock'}; plot_comp(OOPT); print -depsc2 'Figure 1' OOPT.NN=12; OOPT.plot_color={'o-b' 'd-r'}; OOPT.shocks_names={'e_u'}; OOPT.tit_shocks={'Cost Shock'}; OOPT.type_models={'ooNKM_optc' 'ooNKM_optc_1'}; OOPT.legend_models={'\rho_u=0' '\rho_u=0.8'}; OOPT.list_endo={'pi' 'x' 'i' 'r' 'rn' 'u'}; OOPT.label_variables={'Inflation Rate' 'Output Gap' 'Nominal Interest Rate' 'Real Interest Rate' 'Natural Interest Rate' 'Cost Shock'}; plot_comp(OOPT); print -depsc2 'Figure 1' OOPT.NN=12; OOPT.plot_color={'o-b'}; OOPT.shocks_names={'e_u'}; OOPT.tit_shocks={'Persistent Cost Push Shock'}; OOPT.type_models={'ooNKM_optc_1'}; // OOPT.legend_models={'\rho_i=0' '\rho_i=0.5' '\rho_i=0.9'}; OOPT.list_endo={'pi' 'x' 'i' 'r' 'rn' 'u'}; OOPT.label_variables={'Inflation Rate' 'Output Gap' 'Nominal Interest Rate' 'Real Interest Rate' 'Natural Interest Rate' 'Cost Shock'}; plot_comp(OOPT); print -depsc2 'Figure 1' */