// Dynare Code For Bianca De Paoli (2009) //============================================================= // First introduce the endogenous variables in the equations: %@#define money_growth_rule=1 var pih x y ynat rnat r s pi de ystar pistar a gstar g u c cstar; //============================================================= // List the exogenous variables in the model: varexo cstar_ a_ r_ gstar_ g_ u_ ; //============================================================= // First list the parameters and then assign them a value parameters rho rhor tau lambda beta r_pi r_x rhoa rhoy theta alpha rho_eb cros circle tau_a tau_star kapa_eb rhog rhogstar rhou tau_u tau_g ; // Assign values - Calibration rho = 1; // Coefficient of risk aversion. eta= 0.47; // Labor supply elasticity lambda = 0.25; // Degree of openess beta = 0.99; // Discount factor rhor = 0.9; // Interest rate smoothing r_pi = 1.5; // Response to inflation in the Taylor rule r_x = 0.5; // Response to output gap in the Taylor rule rhoa = 0.66; // AR1 parameter for the technology shock rhoy = 0.66; // AR1 parameter for the world output shock rhog = 0.66; // AR1 parameter for the SOE governemnt spending rhogstar = 0.66; // AR1 parameter for the foreign governemnt spending rhou = 0.5; // AR1 parameter for the markup shock theta = 1.5; // Elasticity of substitution between home and foreign goods alpha= 0.66; //Calvo price setting firms rho_eb = rho/((1-lambda)*(theta+1-lambda)); cros = (1-lambda)*(theta*rho-1+lambda); circle = (1-lambda)*rho_eb; tau_a = (1+eta)/(rho_eb+eta); tau_star =(-rho+rho_eb)/(rho_eb+eta); kapa_eb=((1-alpha*beta)*(1-alpha)*(rho_eb+eta))/(alpha); tau_u=(-1/(eta+rho_eb)); tau_g=(-1+rho_eb)/(eta+rho_eb); //============================================================= // Declaration of the model - log linear model(linear); //1 new IS Curve of SOE, eq.(4.70) x = x(+1) - (1/rho_eb)*( r - pih(+1) - rnat) ; //2 def. of nature rate of interest rate of SOE eq(4.74) rnat = -((circle)/(1-lambda))*tau_a*(1-rhoa)*a + ((cros*rho_eb-lambda*rho-rho_eb*tau_star)/(1-lambda))*((ystar-ystar(-1)) - (gstar-gstar(-1))) - rho_eb*tau_u*(1-rhou)*u + rho_eb*(tau_g*(gstar-gstar(-1))-1); //3 etalips Curve of the SOE, section (4.7.2.3) pih = beta * pih(+1)+ kapa_eb*x; //4 def. of nature level of output of SOE, eq.(4.63) ynat = tau_a*a + tau_star*(ystar-gstar) + tau_g*g + tau_u*u; //5 def. of output gap of SOE, eq (4.64) x = y - ynat; //6 mothetanry policy rule, 2 alternatives, eq (4.75) and (4.76) r = rhor*r(-1)+r_pi*pi+r_x*x+ r_; %de=0; //7 wedge between domestic and world output, eq.(4.59) y = ystar - gstar + rho_eb^(-1)*s + g; //8 wedge (gap) between domestic and CPI inflation, eq. (4.47) pi = pih + (1-lambda)*(s-s(-1)); //9 TOT, first difference of eq.(4.49) s = s(-1) + de + pistar - pih; //10 foreign inflation is set to be zero pistar = 0; //11 exogenous process of productivity in SOE (Section 4.2 - Production sector) a = rhoa*a(-1) + a_; //12 exogenous process of world output (Section 4.1.3) cstar = rhoy*cstar(-1) + cstar_; //13 exogenous process of gov spending in SOE (Section 4.1.3) g = rhog*g(-1) + g_; //14 exogenous process of gov spending in Foreign (Section 4.1.3) gstar = rhogstar*gstar(-1) + gstar_; //15 exogenous process of markup (Section 4.2.1 - Price setting mechanism) u = rhou*u(-1) + u_; //16 Aggregate demand of domestic goods (equation below 4.29 or 4.56) y = (1-lambda)*c + lambda*cstar + theta*(1-lambda)*s + g; //17 World market equilibrium demand (equation below 4.31 or 4.58) ystar = gstar + cstar; end; //============================================================= // Ask dynare to check the steady state (here we do not give initial conditions as the model is log linearized) steady; check; //================================================ // Define the shocks and their variability shocks; var a_ = 0.0071^2; //the SD of productivity %var cstar_ = 0.0129^2; //the SD of world output %var u_ = 0.0013^2; //the SD of productivity %var gstar_ = 0.0062^2; //the SD of world output %var g_ = 0.0062^2; //the SD of productivity end; //================================================ // Solve the model with the shocks introduced %---------------------------------------------------------------- % solve for welfare-relevant second moments (technology shocks) %---------------------------------------------------------------- stoch_simul(order=1,irf=0,noprint) y x pi; %---------------------------------------------------------------- % get variable positions in variable list %---------------------------------------------------------------- y_pos=strmatch('y',var_list_ ,'exact'); x_pos=strmatch('y_gap',var_list_ ,'exact'); pi_pos=strmatch('pi',var_list_ ,'exact'); %---------------------------------------------------------------- % Replicate panel a) of Table 4.1 (Technology shock) %---------------------------------------------------------------- r_pi_vec=[1.5 1.5 5 1.5]; r_x_vec=[0.125 0 0 1]; variance.x=NaN(1,length(r_pi_vec)); variance.y=NaN(1,length(r_pi_vec)); variance.pi=NaN(1,length(r_pi_vec)); L=NaN(1,length(r_pi_vec)); for ii=1:length(r_pi_vec) set_param_value('r_pi',r_pi_vec(ii)); set_param_value('r_x',r_x_vec(ii)); [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_); %loop over stoch_simul if ~info(1) %read out current parameter values par.rho=M_.params(strmatch('rho',M_.param_names,'exact')); par.eta=M_.params(strmatch('eta',M_.param_names,'exact')); par.sigma=M_.params(strmatch('sigma',M_.param_names,'exact')); par.alpha=M_.params(strmatch('alpha',M_.param_names,'exact')); par.beta=M_.params(strmatch('beta',M_.param_names,'exact')); par.omega_y=rho+eta; par.omega_pi= sigma/(((1-alpha*beta)*(1-alpha))/alpha); variance.x(ii)=oo_.var(x_pos,x_pos); variance.y(ii)=oo_.var(y_pos,y_pos); variance.pi(ii)=oo_.var(pi_pos,pi_pos); L(ii)=0.5*(par.omega_y*variance.x(ii)+par.omega_pi*variance.pi(ii))/100; end end //Print result labels={'r_pi';'r_x';'sigma(y)';'sigma(tilde y)';'sigma(pi)';'L'}; headers={' ';' ';' ';' '}; values=[r_pi_vec;r_x_vec;sqrt(variance.y);sqrt(variance.x);sqrt(variance.pi);L]; options_.noprint=0; dyntable(options_,'Technology',headers,labels,values,size(labels,2)+2,4,3) options_.noprint=1;