%% gmsoe.dyn % Model of a small open economy based on Gali and Monacelli, RES 2005 % paramater names correpsond to version in Chapter 9 of Monetary Theory % and Policy, 4th edition. var x, // Output Gap yflex, // Flex-price output y, // Actual output yf, // Rest of world output pih, // Domestic inflation picpi, // CPI inflation s, // Terms of trade ph, // Domestic price level //De, // Change in the Nominal exchange rate e, // Nominal exchange rate q, // Real exchange rate i, // Nominal interest rate rn, // Natural interest rate a, // Domestic productivity shock f, // Foreign income shock v; // Monetary policy shock //u; // Cost Push Shock //pif, // Rest of world inflation varexo e_a, // Productivity e_f, // Foreign output shock e_v; // Policy //e_u, // Inflation shock //e_uip, // UIP shock parameters savefig, // = 1 to save figure lambda, // Weight on output gap in loss function beta, // Subjective discount factor sigma, // Consumption index coef. in utility function varphi, // Inverse labor supply elasticity eta, // Elasticity of sub. domestic and foreign bundles xi, // Price elasticity, individual goods alpha, // Price elasticity country goods gamma, // Degree of openness w, // Composite parameter s_gamma, // sigma_gamma omega, // Calvo parameter (Fraction of firms not adjusting prices) kappa, // Inflation elasticity w.r.t output gap phi_pih, // Taylor Rule Coef. on domestic inflation phi_cpi, // Taylor coefficient on cpi inflation phi_x, // Taylor Rule Coef. on output-gap phi_e, // Taylor Rule Coef. on exchange rate rho_a // Tech. Shock persistance rho_f, // Foreign output shock persistence rho_v, // Monetary Policy Shock persistance //rho_u, // Cost push shock persistance //rho_uip, // UIP shock persistence sde_a, // Standard deviation for tech. shock sde_f, // Stadard deviation for foreign output shock sde_v; // Standard deviation for mon. policy shock //sde_u; // Stadard deviation for cost push shock //sde_uip; // Stadard deviation for UIP shock // parameter values from Gali-Monacelli (REStud 2005) savefig = 0; // set to = 1 to save figure beta = 0.99; sigma = 1; varphi = 3; eta = 1; xi = 6; alpha = 1; gamma = 0.4; omega = 0.75; w = sigma*alpha + (1-gamma)*(sigma*eta - 1); s_gamma = sigma/(1-gamma + gamma*w); kappa = (1-omega)*(1-omega*beta)/omega; lambda = (1+varphi)*kappa/xi; phi_pih = 1.5; phi_cpi = 0; phi_x = 0; phi_e = 0; rho_a = 0.66; rho_f = 0.86; sde_a = 0.71; sde_f = 0.78; rho_v = 0.75; sde_v = 0.25; // Standard deviation for mon. policy shock rho_u = 0.8; sde_u = 0.3; // Standard deviation for cost push shock model(linear); y = yflex + x; yflex = ((1+varphi)/(s_gamma + varphi))*a - ((sigma - s_gamma)/(s_gamma + varphi))*yf; x = x(+1) - (1/s_gamma)*(i - pih(+1) - rn); rn = s_gamma*(yflex(+1) - yflex) + s_gamma*gamma*(w-1)*(yf(+1) - yf); picpi = pih + gamma*(s - s(-1)); pih = beta*pih(+1) + (s_gamma + varphi)*kappa*x; s = s_gamma*(y - yf); //i = e(+1) - e; i = phi_pih*pih + phi_cpi*picpi + phi_x*x + phi_e*e + v; yf = f; a = rho_a*a(-1) + e_a; f = rho_f*f(-1) + e_f; v = rho_v*v(-1) + e_v; e = s + ph; q = (1 - gamma)*s; ph = ph(-1) + pih; end; steady; check; shocks; var e_a = (sde_a)^2; var e_f = (sde_f)^2; var e_v = (sde_v)^2; end; ///////////////////////////////////////// /* planner_objective pih^2 + lambda*x^2; ramsey_policy(planner_discount=0.99, order = 1,irf=15) ; //discretionary_policy(irf=40,planner_discount=0.99,order=1,instruments=(i),nograph,solve_maxit=10000); OOPT.MODELS.ooSOE_ramsey = oo_; save OOPT_SOE_ramsey; */ ///////////////////////////////////////// ///////////////////////////////////////// // Computing Theoretical Moments and IRF's //////////////////////////////////////// stoch_simul(order=1,ar=1,irf=20,nograph,noprint); OOPT.MODELS.ooSOE = oo_; save OOPT_SOE; phi_cpi = phi_pih; phi_pih = 0; check; stoch_simul(order=1,ar=1,irf=20,nograph,noprint); OOPT.MODELS.ooSOE_1 = oo_; save OOPT_SOE_1; phi_cpi = 0; phi_pih = 0; phi_e = 50; check; stoch_simul(order=1,ar=1,irf=20,nograph,noprint); OOPT.MODELS.ooSOE_2 = oo_; save OOPT_SOE_2; phi_cpi = 0; phi_pih = 50.0; phi_e = 0; check; stoch_simul(order=1,ar=1,irf=20,nograph,noprint); OOPT.MODELS.ooSOE_3 = oo_; save OOPT_SOE_3; //////////////////////////////////////////////// // 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-k'}; OOPT.shocks_names={'e_v'}; OOPT.tit_shocks={'Monetary Policy Shock'}; OOPT.type_models={'ooSOE'}; OOPT.legend_models={'Basic SOE model'} OOPT.list_endo={'x' 'pih' 's' 'picpi' 'e' 'ph'}; OOPT.label_variables={ 'x' 'dom. inflation' 's' 'cpi inflation' 'e' 'dom. price level'}; plot_comp(OOPT); if savefig == 1 print -depsc2 'C:\Users\CEW\Dropbox\4thedition\Chpt9\graphics_ch9\ch9_figure_3'; end /* OOPT.NN=12; OOPT.plot_color={'-b' ':r'} OOPT.shocks_names={'e_a'}; OOPT.tit_shocks={'Productivity Shock'}; OOPT.type_models={'ooSOE' 'ooSOE_1'}; OOPT.legend_models={'Dom. Infl. Target' 'CPI Infl Target'} OOPT.list_endo={'y' 'x' 'i' 'pih' 'picpi' 'ph' 's' 'e' 'q'}; OOPT.label_variables={'Output' 'Output Gap' 'Nominal interest rate' 'Dom. Inflation' 'CPI Inflation' 'Domestic price level' 'Terms of Trade' 'Nominal exchange rate' 'Real exchange rate'}; plot_comp(OOPT); */ /* OOPT.NN=12; OOPT.plot_color={'-b' ':r' '-.g'} OOPT.shocks_names={'e_a'}; OOPT.tit_shocks={'Productivity Shock'}; OOPT.type_models={'ooSOE' 'ooSOE_1' 'ooSOE_2'}; OOPT.legend_models={'Dom. Inflation' 'CPI Inflation' 'Nominal Exch. Rate'} OOPT.list_endo={'y' 'x' 'i' 'pih' 'picpi' 'ph' 's' 'e' 'q'}; OOPT.label_variables={'Output' 'Output Gap' 'Nominal interest rate' 'Dom. Inflation' 'CPI Inflation' 'Domestic price level' 'Terms of Trade' 'Nominal exchange rate' 'Real exchange rate'}; plot_comp(OOPT); if savefig == 1 print -depsc2 'gmsoe_ch9_baseline'; end */ OOPT.NN=12; OOPT.plot_color={'--k' ':k' '-.k' 'o-k'} OOPT.shocks_names={'e_a'}; OOPT.tit_shocks={'Productivity Shock'}; OOPT.type_models={'ooSOE' 'ooSOE_1' 'ooSOE_2' 'ooSOE_3'}; OOPT.legend_models={'Dom. Inflation' 'CPI Inflation' 'Nominal Exch. Rate' 'Optimal'} OOPT.list_endo={'y' 'x' 'i' 'pih' 'picpi' 'ph' 's' 'e' 'q'}; OOPT.label_variables={'y' 'x' 'i' 'domestic inflation' 'cpi inflation' 'dom. price level' 's' 'e' 'q'}; plot_comp(OOPT); if savefig == 1 print -depsc2 'C:\Users\CEW\Dropbox\4thedition\Chpt9\graphics_ch9\ch9_figure_4'; end /* OOPT.NN=12; OOPT.plot_color={'o-b' 'd-r'}; OOPT.shocks_names={'e_f'}; OOPT.tit_shocks={'Foreign Income Shock'}; OOPT.type_models={'ooSOE' 'ooSOE_1'}; OOPT.legend_models={'Dom. Infl. Target' 'CPI Infl Target'} OOPT.list_endo={'y' 'x' 'i' 'pih' 'picpi' 'ph' 's' 'e' 'q'}; OOPT.label_variables={'Output' 'Output Gap' 'Nominal interest rate' 'Domestic Inflation' 'CPI Inflation' 'Domestic price level' 'Terms of Trade' 'Nominal exchange rate' 'Real exchange rate'}; plot_comp(OOPT); */