%FIGURE2.M function figure2 %This program produces part of figure 2 of the paper ``Deep Habits,'' by Morten Ravn, Stephanie Schmitt-Grohe, and Martin Uribe (Review of Econmic Studies) %Note: In the paper figure 2 has 2 lines, one for the case of good-specific %subsitence points and one for the case of deep habits. The latter is %reproduced from figure 1. The program figure2.m produces only the impulse response corresponding to the case of good-specific subsistence points. % %Calls: gx_hx.m, anal_deriv.m, num_eval.m, and ir.m % %(c) Stephanie Schmitt-Grohe and Martin Uribe % %Date December 23, 2003 %SHOCKS %shock=1 preference %shock=2 government %shock=3 technology for shock=1:3 %Compute analytical derivatives of equilibrium conditions [fx,fxp,fy,fyp,f] = sp; %Numerical evaluation %Assign values to parameters and steady-state variables [THETA,GBAR,SIGMA,CHI,GAMA,BETTA,DELTA,ALFA,ETA,CSTAR,IVVSTAR,GSTAR,RHOZ,RHOG,RHOV,w,h,c,u,k,ivv,markup,a,g,v,output,wp,hp,cp,up,kp,ivvp,markupp,ap,gp,vp,outputp,W,H,C,U,K,IVV,MARKUP,A,G,V,OUTPUT,PHI,EHW,SC,SG,SI,THETA_C,THETA_G,THETA_I]=sp_ss(0.275,0.275,0); approx = 1; %Order of approximation desired %Compute numerical derivatives of f num_eval %Obtain first-order accurate approximation to the policy functions [gx,hx] = gx_hx(nfy,nfx,nfyp,nfxp); %Set time horizon for the impulse responses T=21; %Compute impulse responses IR = ir(gx,hx,[0 (shock==1)*(C-CSTAR) (shock==2)*1 (shock==3)*1],T); Ir(:,:,shock) = IR; t=(0:size(IR,1)-1)'; c = squeeze(Ir(:,5,:)); h = squeeze(Ir(:,4,:)); w = squeeze(Ir(:,3,:)); ivv = squeeze(Ir(:,6,:)); u= squeeze(Ir(:,7,:)); output = squeeze(Ir(:,2,:)); markup = squeeze(Ir(:,1,:)); g = squeeze(Ir(:,10,:)); a = squeeze(Ir(:,11,:)); subplot(3,4,1+(shock-1)*4) plot(t,markup(:,shock),'-') title('Markup') subplot(3,4,2+(shock-1)*4) plot(t,output(:,shock)) title('Output') subplot(3,4,3+(shock-1)*4) plot(t,w(:,shock)) title('Wage') subplot(3,4,4+(shock-1)*4) plot(t,c(:,shock)) title('Consumption') end shg %SP.M function [fx,fxp,fy,fyp,f] = sp %This program computes a log-linear approximation to the function f for an %economy with good-specific subsistence points. The model is described in %section 4.1 of ``Deep Habits'' by M. Ravn, S. Schmitt-Grohe, and M. %Uribe, Review of Economic Studies, 2005. % %Calls: anal_deriv.m % %(c) Stephanie Schmitt-Grohe and Martin Uribe % %Date December 23, 2003 %Define parameters syms SIGMA CHI GAMA BETTA DELTA ALFA ETA RHOZ RHOG RHOV GBAR PHI CSTAR IVVSTAR GSTAR %Define variables syms c cp h hp w wp u up k kp ivv ivvp markup markupp a ap g gp output outputp v vp %Give functional form for production, and utility functions %Utility function util = ((c-CSTAR-log(v))^(1-SIGMA) -1) / (1-SIGMA) + GAMA * ((1-h)^(1-CHI)-1) / (1-CHI); utilp = ((cp-CSTAR-log(vp))^(1-SIGMA) -1) / (1-SIGMA) + GAMA * ((1-hp)^(1-CHI)-1) / (1-CHI); pf = a*k^(ALFA)*h^(1-ALFA); pfp = ap * kp^(ALFA)*hp^(1-ALFA); %Write equations (ei, i=1:n) %Labor supply e1 = w + diff(util,'h') / diff(util,'c'); %Euler equation e2 = -diff(util,'c') + BETTA * diff(utilp,'cp') * (1-DELTA+up); %Resource constraint e3 = -(pf - PHI) + c + ivv + g; %Evoluiton of capital e4 = -kp + (1-DELTA) * k + ivv - IVVSTAR; %Markup e5 = -markup + diff(pf,'h') / w; %nu e6 = (1-ETA) * output + ETA * (CSTAR+GSTAR+IVVSTAR) + ETA / markup * (output-CSTAR-GSTAR-IVVSTAR); %MRT = w/u e7 = -w / u + diff(pf,'h') / diff(pf,'k'); %Technology shock e8 = log(ap) - RHOZ * log(a); %Government Purchases shock e9 = log(gp/GBAR) - RHOG * log(g/GBAR); %Evolution of preference shock e10 = - log(vp) + RHOV * log(v); %Definition of output e11 = -output + pf - PHI; %Create function f f = [e1;e2;e3;e4;e5;e6;e7;e8;e9;e10;e11]; % Define the vector of controls in period t, y, and t+1, yp, and the vector of states in period t, x, and t+1, xp x = [k v g a]; xp = [kp vp gp ap]; y = [markup output w h c ivv u ]; yp = [markupp outputp wp hp cp ivvp up]; %Make f a function of the logarithm of the state and control vector f = subs(f, [x,y,xp,yp], exp([x,y,xp,yp])); approx = 1; %Order of approximation desired %Compute analytical derivatives of f [fx,fxp,fy,fyp]=anal_deriv(f,x,y,xp,yp,approx); %SP_SS.M function [THETA,GBAR,SIGMA,CHI,GAMA,BETTA,DELTA,ALFA,ETA,CSTAR,IVVSTAR,GSTAR,RHOZ,RHOG,RHOV,w,h,c,u,k,ivv,markup,a,g,v,output,wp,hp,cp,up,kp,ivvp,markupp,ap,gp,vp,outputp,W,H,C,U,K,IVV,MARKUP,A,G,V,OUTPUT,PHI,EHW,SC,SG,SI,THETA_C,THETA_G,THETA_I]=sp_ss(theta_c,theta_g,theta_i); %This program produces the deep structural parameters and computes the steady state of the good-specific subsistence point model described in section 4.1 of ``Deep Habits.'' by Morten Ravn, Stephanie Schmitt-Grohe, and Martin Uribe %(c) Stephanie Schmitt-Grohe and Martin Uribe, December 23, 2003 %Calibrated parameters THETA_C=theta_c;%ratio of subsistence-consumption-to-consumption THETA_G=theta_g;%ratio of subsistence-gov'tconsumption-to-gov'tconsumption THETA_I=theta_i;%ratio of subsistence-investment-to-investment SIGMA = 2; %intertemporal elasticity of substitution EHW = 1.3; %Frisch elasticity of labor suppy H = 0.2; %hours (Prescott, 1986) ETA = 5.3;%Long-run Price elasticity of demand for a particular variety. Taken from the econometric estimates shown in the paper ``Deep Habits'' R = 1.04^(1/4); %Gross quarterly real interest rate (Rotemberg & Woodford, JPE, 1991) SH = 0.75;%Labor share (Rotemberg & Woodford, JPE, 1991) SG = 0.12; % Steady State Share of Government Purchases (Rotemberg & Woodford, JPE, 1991) RHOZ = 0.9; %Persistence of technology shock z_t RHOG = 0.9; %Persistence of Government purchases shock RHOV = 0.9; %Persistence of preference shock SC = 0.7; %Consumption share (Rotemberg & Woodford, JPE, 1991) %Implied parameters BETTA = 1/R; %Subjective discount factor SI = 1-SC-SG; %INVESTMENT SHARE THETA = SC * THETA_C + SG * THETA_G + SI * THETA_I; %Average ratio of subsistence absorption to absorption MARKUP = 1 / (1-1/ETA/ (1-THETA)); %Markup ALFA = 1 - SH; %capital elasticity of output SK = SH * ALFA/(1-ALFA); %share of capital ans = SI / SH * (1-ALFA) / ALFA * (1-THETA_I); DELTA = ans*(1/BETTA-1)/(1-ans); %Depreciation rate U = 1/BETTA-1+DELTA; %rental rate of capital K = (SI/DELTA/MARKUP*(1-THETA_I))^(1/(1-ALFA))*H; %Steady state capital stock OUTPUT = K^ALFA * H^(1-ALFA) / MARKUP; %output W = U * (1-ALFA)/ALFA *K/H; %Wage rate IVV = DELTA * K / (1-THETA_I); %Investment PHI = K^ALFA * H^(1-ALFA) - OUTPUT; %Fixed cost C = SC * OUTPUT; %consumption CHI = (1-H)/H / EHW; GAMA = W * (1-H)^CHI / (C*(1-THETA_C))^SIGMA; V = 1; %Steady-State value of preference shock A = 1; %steady-state value of technology shock G = SG * OUTPUT; %Government consumption GBAR=G; %Unconditional mean of gov't consumption %Subsistence levels of consumption, gov't spending, and investment CSTAR = THETA_C*C; IVVSTAR = THETA_I*IVV; GSTAR = THETA_G*G; %Log values w=log(W); h=log(H); c=log(C); u=log(U); k=log(K); ivv=log(IVV); markup=log(MARKUP); a=log(A); g = log(G); output = log(OUTPUT); v=log(V); %Future values of logged variables wp=log(W); hp=log(H); cp=log(C); up=log(U); kp=log(K); ivvp=log(IVV); markupp=log(MARKUP); ap=log(A); gp = log(G); outputp = log(OUTPUT); vp=log(V);