-
Notifications
You must be signed in to change notification settings - Fork 0
/
figure4.m
238 lines (196 loc) · 7 KB
/
figure4.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
%=================================================================
% produces figure 4
%=================================================================
close all;clear;
%------- calibration of the matching model with land to US data <> see sections 2.2 and 2.4, and online appendix A -----------
epsilon=1;
Mbar=0.5;
eta=0.6;
s=0.028;
ubar=0.061;
xbar=0.43;
lbar=(1-ubar);
Ybar=lbar;
GCbar=0.197;
omega=s.*(lbar./ubar).*xbar.^(eta-1);
gamma=1./(1+1./GCbar);
GY=@(gc)gc./(1+gc);
CY=@(gc)1-GY(gc);
GYbar=GY(GCbar);
CYbar=CY(GCbar);
GC=@(GY)GY./(1-GY);
Gbar=GYbar.*Ybar;
Cbar=CYbar.*Ybar;
r=(Mbar.*epsilon.*CYbar)./(1-Mbar.*GYbar);
mbar=Mbar.*(1-ubar)./(1-GYbar.*Mbar);
q=@(x)omega.*x.^(-eta);
f=@(x)omega.*x.^(1-eta);
u=@(x)s./(s+f(x));
Y=@(x)1-u(x);
taubar=(1-eta).*ubar./eta;
rho=q(xbar)./s.*taubar./(1+taubar);
tau=@(x)s.*rho./(q(x)-s.*rho);
dlnydlnx=@(x)(1-eta).*u(x)-eta.*tau(x);
% general CES utility function <> the derivatives of U are computed in online appendix A
scalar=(1-gamma).^(1-gamma).*gamma.^gamma;
if epsilon==1
U=@(c,g)c.^(1-gamma).*g.^(gamma)./scalar;
else
U=@(c,g)((1-gamma).^(1./epsilon).*c.^((epsilon-1)./epsilon)+gamma.^(1./epsilon).*g.^((epsilon-1)./epsilon)).^(epsilon./(epsilon-1));
end
dUdc=@(gc)((1-gamma).*U(1,gc)).^(1./epsilon);
dUdcbar=dUdc(GCbar);
dUdg=@(gc)(gamma.*U(1./gc,1)).^(1./epsilon);
MRS=@(gc)gamma.^(1./epsilon)./(1-gamma).^(1./epsilon).*gc.^(-1./epsilon);
dlnUdlnc=@(gc)(1-gamma).^(1./epsilon).*(U(1,gc)).^((1-epsilon)./epsilon);
dlnUdlng=@(gc)gamma.^(1./epsilon).*(U(1./gc,1)).^((1-epsilon)./epsilon);
dlnUcdlnc=@(gc)(dlnUdlnc(gc)-1)./epsilon;
dlnUcdlng=@(gc)dlnUdlng(gc)./epsilon;
p0=dUdcbar.^r./(1+taubar);
p=@(G)p0.*dUdc(G./(Ybar-G)).^(1-r);
dlnpdlng=@(G)(1-r).*(dlnUcdlng(G./(Ybar-G))-dlnUcdlnc(G./(Ybar-G)).*(G./(Ybar-G)));% equation (A4)
dlncdlnx=@(G,x)eta.*tau(x)./dlnUcdlnc(G./(Y(x)-G));% equation (A6)
dlncdlng=@(G,x)(dlnpdlng(G)-dlnUcdlng(G./(Y(x)-G)))./dlnUcdlnc(G./(Y(x)-G));% equation (A7)
dlnxdlng=@(G,x)(G./Y(x)+(1-G./Y(x)).*dlncdlng(G,x))./(dlnydlnx(x)-(1-G./Y(x)).*dlncdlnx(G,x));% equation (A9)
m=@(G,x)(1-eta).*u(x).*(1-u(x)).*dlnxdlng(G,x).*Y(x)./G;% equation (A11)
M=@(G,x)m(G,x)./(1-u(x)+G./Y(x).*eta.*tau(x)./(1-eta)./u(x).*m(G,x));% equation (A11)
findx=@(G,x,alpha)abs(dUdc(G./(Y(x)-G))-((1+tau(x)).*p(G)./alpha)); % gap between aggregate supply & aggregate demand
optimal=@(G,x)abs(1-MRS(G./(Y(x)-G))-dlnydlnx(x).*dlnxdlng(G,x).*Y(x)./G); % first-order condition (18)
z1=GYbar.*CYbar./ubar;
z0=1./((1-eta).*(1-ubar)^2);
suffstat=@(G,x)epsilon.*z0.*m(G,x)./(1+z1.*z0.*epsilon.*m(G,x).^2);% sufficient-statistic formula (23)
%-------------- business-cycle simulations under aggregate-demand shocks <> see section 5 -----------------------
% first step: computing equilibrium public expenditure G and equilibrium tightness x for a range of aggregate demands
% the computation is repeated for three public-expenditure policies:
% (1) G/Y=16.5%
% (2) G/Y from sufficient-statistic formula (23)
% (3) optimal G/Y
j=0;
ALPHA=[0.97:0.0025:1.03]; %range of aggregate demand
x0=[0.001:0.0002:2]; %grid to search for equilibrium tightness x
GY0=[0.07:0.00005:0.27]; %grid to search for equilibrium public expenditure G/Y
[GY1,x1]=ndgrid(GY0,x0);
for alpha=ALPHA
j=j+1;
% first policy: G/Y=16.5%
G0=GYbar.*Y(x0); % G such that G/Y=16.5%
eva=findx(G0,x0,alpha);
[val,ind]=min(eva); % finds x such aggregate supply = aggregate demand
xconstant(j)=x0(ind); % equilibrium x
Gconstant(j)=G0(ind); % equilibrium G
% second policy: G/Y from formula (23)
du=(u(xconstant(j))-ubar)./ubar;
suffstat0=suffstat(Gconstant(j),xconstant(j)).*du; % computes G/Y with formula (23) from initial steady state
G0=GY((1+suffstat0).*GCbar).*Y(x0); % corresponding G
eva=findx(G0,x0,alpha);
[val,ind]=min(eva); % finds x such aggregate supply = aggregate demand
xsuffstat(j)=x0(ind); % equilibrium x
Gsuffstat(j)=G0(ind); % equilibrium G
% third policy: optimal G/Y
G1=GY1.*Y(x1);
eva=findx(G1,x1,alpha);
[val,ind]=min(eva,[],2); % finds x such aggregate supply = aggregate demand, for all G/Y in GY0
x2=x0(ind);
G2=GY0.*Y(x2);
eva=optimal(G2,x2);
[val,ind]=min(eva); % among all G/Y in GY0, finds G/Y satisfying condition (18)
xoptimal(j)=x2(ind); % equilibrium x
Goptimal(j)=G2(ind); % equilibrium G
end
clear GY1 x1 G1 G0 x2 G2 Y2 c2 g2
% second step: computing all other equilibrium variables
% equilibrium with G/Y=16.5%
Yconstant=Y(xconstant);
GYconstant=Gconstant./Yconstant;
uconstant=u(xconstant);
Mconstant=M(Gconstant,xconstant);
% equilibrium with G/Y from formula (23)
Ysuffstat=Y(xsuffstat);
GYsuffstat=Gsuffstat./Ysuffstat;
usuffstat=u(xsuffstat);
Msuffstat=M(Gsuffstat,xsuffstat);
% equilibrium with optimal G/Y
Yoptimal=Y(xoptimal);
GYoptimal=Goptimal./Yoptimal;
uoptimal=u(xoptimal);
Moptimal=M(Goptimal,xoptimal);
%-------------- plots figure 4 -----------
% formatting
set(groot,'DefaultFigureUnits', 'inches')
set(groot,'DefaultFigurePosition', [0,0,7.7778,5.8333]);
set(groot,'DefaultFigurePaperPosition', [0, 0, 7.7779,5.8334]);
set(groot,'DefaultFigurePaperSize', [7.7779,5.8334]);
set(groot,'DefaultAxesFontName', 'Times New Roman')
set(groot,'DefaultAxesFontSize', 25)
set(groot,'DefaultLineLineWidth', 4)
set(groot,'DefaultAxesLineWidth', 1)
set(groot,'DefaultAxesYGrid','on')
set(groot,'DefaultAxesXGrid','off')
set(groot,'DefaultAxesTickLength',[0 0])
co = [217,95,2
8,81,156
107,174,214];
co = co./255;
set(groot,'DefaultAxesColorOrder',co)
xmi=min(ALPHA);xma=max(ALPHA);
fign=0;
% figure 4A: unemployment rate
x1=ALPHA;
y1=uoptimal.*100;
y2=uconstant.*100;
fign=fign+1;
figure(fign)
clf
hold on
plot(x1,y2,'-.','Color',co(1,:))
plot(x1,y1,'-','Color',co(2,:))
xlabel('Aggregate demand')
set(gca,'XLim',[xmi,xma],'XTick',[0.97,1,1.03])
set(gca,'YLim',[4,12],'YTick',[4:2:12],'YTickLabel',[' 4%';' 6%';' 8%';'10%';'12%'])
ylabel('Unemployment rate')
print('-dpdf','figure4A.pdf')
% figure 4B: unemployment multiplier
x1=ALPHA;
y1=Moptimal;
y2=Mconstant;
fign=fign+1;
figure(fign)
clf
hold on
plot(x1,y2,'-.','Color',co(1,:))
plot(x1,y1,'-','Color',co(2,:))
xlabel('Aggregate demand')
set(gca,'XLim',[xmi,xma],'XTick',[0.97,1,1.03])
set(gca,'YLim',[0,1.5],'YTick',[0:0.5:1.5])
ylabel('Unemployment multiplier')
print('-dpdf','figure4B.pdf')
% figure 4C: optimal stimulus spending
x1=ALPHA;
y1=GYoptimal.*100;
y2=GYconstant.*100;
fign=fign+1;
figure(fign)
clf
hold on
plot(x1,y2,'-.','Color',co(1,:))
plot(x1,y1,'-','Color',co(2,:))
xlabel('Aggregate demand')
set(gca,'XLim',[xmi,xma],'XTick',[0.97,1,1.03])
set(gca,'YLim',[13,21],'YTick',[13:2:21],'YTickLabel',['13%';'15%';'17%';'19%';'21%'])
ylabel('Public expenditure (% of GDP)')
print('-dpdf','figure4C.pdf')
% figure 4D: accuracy of sufficient-statistic formula
x1=ALPHA;
y2=GYsuffstat.*100;
y1=GYoptimal.*100;
fign=fign+1;
figure(fign)
clf
hold on
plot(x1,y2,'-.','Color',co(3,:))
plot(x1,y1,'-','Color',co(2,:))
xlabel('Aggregate demand')
set(gca,'XLim',[xmi,xma],'XTick',[0.97,1,1.03])
set(gca,'YLim',[13,21],'YTick',[13:2:21],'YTickLabel',['13%';'15%';'17%';'19%';'21%'])
ylabel('Public expenditure (% of GDP)')
print('-dpdf','figure4D.pdf')