// Basic New Keynesian Model under optimal discretion policy // Used for problem 19 in ch 8. 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 phi, // Weight on lagged inflation rho_z, // Tech. Shock persistance sde_z, // Standard deviation for tech. shock rho_u, // Cost push shock persistance sde_u, // Standard 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; phi = 0.5; rho_z = 0.9; sde_z = 1.0; rho_u = 0.001; sde_u = 1.0; epsilon = 6; // Implied Parameters kappa = (sigma + eta)*(1-omega)*(1-omega*beta)/omega; //lambda = (kappa)/((1+eta*epsilon)*epsilon); lambda = kappa/epsilon; model(linear); x = x(+1) - (1/sigma)*(r-rn); // Dynamic IS curve pi = (1-phi)*beta*pi(+1) + phi*pi(-1) + kappa*x + u; // New Keynessian Phillips curve rn = sigma*((1+eta)/(eta+sigma))*(z(+1)-z); // Natural interest 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) ); discretionary_policy(irf=40,planner_discount=0.99,order=1,instruments=(i),nograph); OOPT.MODELS.ooNKM_optd_phi = oo_; OOPT_NKM_optd_phi = OOPT.MODELS.ooNKM_optd_phi; save OOPT_NKM_optd_phi; */ planner_objective pi^2 + lambda*(x^2); discretionary_policy(planner_discount=0.99,order=1,instruments=(i),nograph); //,solve_maxit=10000); vv = diag(oo_.var); Objective = (1/(1-beta))*(vv(2) + lambda*vv(1)); /* rho_u = 0.8; discretionary_policy(planner_discount=0.99,nograph,noprint); //stoch_simul(order=1,ar=1,irf=20,nograph,noprint); OOPT.MODELS.ooNKM_optd_1 = oo_; OOPT_NKM_optd_1 = OOPT.MODELS.ooNKM_optd_1; save OOPT_NKM_optd_1; ///////////////////////////////////////// // Plotting Impulse-Response functions // This part uses the plot_comp function in order to do multiple IRFS graphs. //////////////////////////////////////// OOPT.NN=12; OOPT.plot_color={'o-b'}; OOPT.shocks_names={'e_z'}; OOPT.tit_shocks={'Technology Shock'}; OOPT.type_models={'ooNKM_optd'}; OOPT.legend_models={'Discretion'}; 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); if savefig == 1 print -depsc2 'Figure 1' end OOPT.NN=12; OOPT.plot_color={'o-b' 'd-r'}; OOPT.shocks_names={'e_u'}; OOPT.tit_shocks={'Cost Push Shock'}; OOPT.type_models={'ooNKM_4' 'ooNKM_optd_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); if savefig == 1 print -depsc2 'Figure 1' end OOPT.NN=12; OOPT.plot_color={'o-b'}; OOPT.shocks_names={'e_u'}; OOPT.tit_shocks={'Persistent Cost Push Shock'}; OOPT.type_models={'ooNKM_optd_1'}; OOPT.legend_models={'Discretion'}; 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); if savefig == 1 print -depsc2 'Figure 1' end */