%FIGURE3.M function figure3 %This program produces figure 3 of the paper ``Deep Habits,'' by Morten Ravn, Stephanie Schmitt-Grohe, and Martin Uribe (Review of Economic Studies) % %Calls: gx_hx.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] = dh; %Numerical evaluation %Assign values to parameters and steady-state variables [RHO, THETA_S,THETA_D,THETA_G,GBAR,SIGMA,CHI,GAMA,BETTA,DELTA,ALFA,ETA,RHOZ,RHOG,RHOV,nu,nug,w,h,c,s,u,k,ivv,markup,a,g,v,stockg,output,xx,nup,nugp,wp,hp,cp,sp,up,kp,ivvp,markupp,ap,gp,vp,stockgp,outputp,xxp,NU,NUG,W,H,C,S,U,K,IVV,MARKUP,A,G,V,STOCKG,OUTPUT,XX,PHI,EHW]=dh_ss(-0.1,-0.1,-0.1); approx = 1; %Order of approximation desired %Compute numerical derivatives of f num_eval %Compute a first-order accurate approximation to the policy functions [gx,hx] = gx_hx(nfy,nfx,nfyp,nfxp); T=21; %Length of impulse response function %Compute impulse responses IR = ir(gx,hx,[0 0 0 (shock==1)*XX (shock==2)*1 (shock==3)*1],T); Ir(:,:,shock) = IR; t=(0:size(IR,1)-1)'; u= squeeze(Ir(:,7,:)); c = squeeze(Ir(:,5,:)); h = squeeze(Ir(:,4,:)); w = squeeze(Ir(:,3,:)); ivv = squeeze(Ir(:,6,:)); output = squeeze(Ir(:,2,:)); markup = squeeze(Ir(:,1,:)); nu = squeeze(Ir(:,8,:)); nug = squeeze(Ir(:,9,:)); s = squeeze(Ir(:,12,:)); g = squeeze(Ir(:,15,:)); a = squeeze(Ir(:,16,:)); 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 %DH.M function [fx,fxp,fy,fyp,f] = dh %This program computes a log-linear approximation to the function f for an economy with catching up with the Joneses good by good. The model is described in ``Deep Habits'' %The function f defines the DSGE model (a p denotes next-period variables) : % E_t f(yp,y,xp,x) =0. % %Output: Analytical first derivative of f % %Calls: anal_deriv.m % %(c) Stephanie Schmitt-Grohe and Martin Uribe % %Date December 23, 2003 %Define parameters syms RHO THETA_S THETA_D THETA_G SIGMA CHI GAMA BETTA DELTA ALFA ETA RHOZ RHOG RHOV GBAR PHI %Define variables syms xx xxp s sp c cp h hp w wp u up k kp ivv ivvp nu nup nug nugp markup markupp a ap g gp stockg stockgp output outputp v vp %Give functional form for production, and utility functions %Utility function util = ((xx-v)^(1-SIGMA) -1) / (1-SIGMA) + GAMA * ((1-h)^(1-CHI)-1) / (1-CHI); utilp = ((xxp-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) e1 = -xx + c/s^THETA_S; %Habit-adjusted consumption %Labor supply e2 = w/s^THETA_S + diff(util,'h') / diff(util,'xx'); %Euler equation e3 = - diff(util,'xx') / s^THETA_S + BETTA * diff(utilp,'xxp') / sp^THETA_S * (1-DELTA+up); %Resource constraint e4 = -(pf - PHI) + c + ivv + g; %Evoluiton of capital e5 = -kp + (1-DELTA) * k + ivv; %Markup e6 = -markup + diff(pf,'h') / w; %nu e7 = - (c+g+ivv) / ETA + nu * c + nug * g + ivv * (1-1/markup); %Firm's FOC w.r.t. s e8 = - (1-nu - 1/markup ) / (RHO-1) + BETTA * diff(utilp,'xxp') / sp^THETA_S / diff(util,'xx') * s^THETA_S * (THETA_D * (1-ETA) * nup * cp / sp + RHO * (1-nup-1/markupp) / (RHO-1)); %Firm's FOC w.r.t. stockg e9 = - (1-nug - 1/markup ) / (RHO-1) + BETTA * diff(utilp,'xxp') / sp^THETA_S / diff(util,'xx') * s^THETA_S * (THETA_G * (1-ETA) * nugp * gp / stockgp + RHO * (1-nugp-1/markupp) / (RHO-1)); %MRT = w/u e10 = -w / u + diff(pf,'h') / diff(pf,'k'); %Evolution of habit stock e11 = - sp + RHO * s + (1-RHO) * c; %Evolution of gov't habit stock e12 = -stockgp + RHO * stockg + (1-RHO) * g; %Technology shock e13 = log(ap) - RHOZ * log(a); %Government Purchases shock e14 = log(gp/GBAR) - RHOG * log(g/GBAR); %Evolution of preference shock e15 = - vp + RHOV * v; %Definition of output e16 = -output + pf - PHI; %Create function f f = [e1;e2;e3;e4;e5;e6;e7;e8;e9;e10;e11;e12;e13;e14;e15;e16]; % 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 = [stockg s k g a]; xp = [stockgp sp kp gp ap]; y = [markup output w h c ivv u nu nug xx]; yp = [markupp outputp wp hp cp ivvp up nup nugp xxp]; %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])); x = [stockg s k v g a]; xp = [stockgp sp kp vp gp ap]; approx = 1; %Order of approximation desired %Compute analytical derivatives of f [fx,fxp,fy,fyp]=anal_deriv(f,x,y,xp,yp,approx); %DH_SS.M function [RHO, THETA_S,THETA_D,THETA_G,GBAR,SIGMA,CHI,GAMA,BETTA,DELTA,ALFA,ETA,RHOZ,RHOG,RHOV,nu,nug,w,h,c,s,u,k,ivv,markup,a,g,v,stockg,output,xx,nup,nugp,wp,hp,cp,sp,up,kp,ivvp,markupp,ap,gp,vp,stockgp,outputp,xxp,NU,NUG,W,H,C,S,U,K,IVV,MARKUP,A,G,V,STOCKG,OUTPUT,XX,PHI,EHW,m]=dh_ss(theta_s,theta_d,theta_g); %This program produces the deep structural parameters and computes the steady state of the relative deep habit model described in ``Deep Habits.'' by Morten Ravn, Stephanie Schmitt-Grohe, and Martin Uribe %(c) Stephanie Schmitt-Grohe and Martin Uribe, December 23, 2003 %Calibrated parameters THETA_S=theta_s;%superficial habit parameter THETA_D = theta_d;%deep habit parameter THETA_G = theta_g; %govt deep habit parameter 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 RHO = 0.85; %1-RHO is the weight on current consumption in the evolution of the stock of habit. S_t = RHO s_{t-1} + (1-RHO) C_{t}. Taken from the econometric estimates presented in ``Deep Habits.'' SC = 0.7; %Consumption share (Rotemberg & Woodford, JPE, 1991) %Implied parameters BETTA = 1/R; %Subjective discount factor SI = 1-SC-SG; %INVESTMENT SHARE m = SC * (1-BETTA * RHO) / (RHO-1) * (BETTA*(1-ETA) * THETA_D + (1-BETTA*RHO) / (RHO-1))^(-1) + SG * (1-BETTA*RHO) / (RHO-1) * (BETTA*THETA_G*(1-ETA)+(1-BETTA*RHO)/(RHO-1))^(-1) + SI; MARKUP = 1/ (1-1/ETA/ m); %Markup ALFA = 1 - SH; %capital elasticity of output SK = SH * ALFA/(1-ALFA); %share of capital DELTA = SI * (1/BETTA-1)/ (SK-SI); NU = (1-1/MARKUP) * (1-BETTA*RHO) / (RHO-1) / (BETTA*THETA_D*(1-ETA) + (1-BETTA*RHO) / (RHO-1)); NUG = (1-1/MARKUP) * (1-BETTA*RHO) / (RHO-1) / (BETTA*THETA_G*(1-ETA) + (1-BETTA*RHO) / (RHO-1)); %Lagrange multiplier on aggregate demand faced by monopolist i U = 1/BETTA-1+DELTA; %rental rate of capital K = (SI/DELTA/MARKUP)^(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; %Investment PHI = K^ALFA * H^(1-ALFA) - OUTPUT; %Fixed cost C = SC * OUTPUT; %consumption S = C; %Stock of habit XX = C^(1-THETA_S); %Habit-adjusted consumption CHI = (1-H)/H / EHW; GAMA = W * (1-H)^CHI / C^(SIGMA*(1-THETA_S)+THETA_S) ; V =0; %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 STOCKG = G; %Log values nu=log(NU); nug=log(NUG); w=log(W); h=log(H); c=log(C); s=log(S); u=log(U); k=log(K); ivv=log(IVV); markup=log(MARKUP); a=log(A); g = log(G); stockg=g; output = log(OUTPUT); xx = log(XX); v=0; %Future values of logged variables nup=log(NU); nugp=log(NUG); wp=log(W); hp=log(H); cp=log(C); sp=log(S); up=log(U); kp=log(K); ivvp=log(IVV); markupp=log(MARKUP); ap=log(A); gp = log(G); stockgp=g; outputp = log(OUTPUT); xxp = log(XX); vp=v;