-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotfigs_ssdp.m
212 lines (196 loc) · 5.32 KB
/
plotfigs_ssdp.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
% Plots figures
set(0,'DefaultFigureWindowStyle','docked') % docks all figures
figure
%midriplot
colormap([0.73 0.83 0.96])
bar(Pchangegrid,pdfdata,1,'EdgeColor','none');
%step = (hbound-lbound)/(length(prob)-1);
%bar(lbound:step:hbound,prob,1)
stairs(Pchangegrid-pstep/2,denspchanges,'k'); % stairs is displaced half a step to the right
title('Distribution of non-zero price changes')
xlabel('Size of price changes')
ylabel('Density of price changes')
%xlim([lbound hbound])
figure
plot(sgrid,optflexprice-log(wbar)-markup,':g')
hold on
plot(sgrid,pstar-log(wbar)-markup,'r')
title('Optimal price policy')
xlabel('Log (inverse) productivity')
ylabel('Log target relative price')
axis tight
figure
if nums>1
mesh(sgrid,Pgrid-log(wbar)-markup,D/MedV)
xlabel('Log (inverse) productivity')
ylabel('Log relative price')
else
plot(Pgrid-log(wbar)-markup,D/MedV)
xlabel('Log relative price')
end
title('Adjustment gain')
axis tight
figure
if nums>1
% map=colormap;
% colormap([1 1 1; map])
mesh(sgrid,Pgrid-log(wbar)-markup,Pdist)
xlabel('Log (inverse) productivity')
ylabel('Log relative price')
else
plot(Pgrid-log(wbar)-markup,Pdist)
xlabel('Log relative price')
end
title('Stationary density of firms')
axis tight
%zl=zlim;
figure
%map=colormap;
%colormap([1 1 1; map])
if nums>1
mesh(sgrid,Pgrid-log(wbar)-markup,Pdisteroded)
xlabel('Log (inverse) productivity')
ylabel('Log relative price')
else
plot(Pgrid-log(wbar)-markup,Pdisteroded)
xlabel('Log relative price')
end
title('Density of firms after mc shock and inflation')
axis tight
zl=zlim;
%zlim(zl)
figure
%map=colormap;
%colormap([1 1 1; map])
if nums>1
mesh(sgrid,Pgrid-log(wbar)-markup,(1-lambda).*Pdisteroded)
xlabel('Log (inverse) productivity')
ylabel('Log relative price')
else
plot(Pgrid-log(wbar)-markup,(1-lambda).*Pdisteroded)
xlabel('Log relative price')
end
title('Density of non-adjusting firms')
axis tight
zlim(zl)
figure
%map=colormap;
%colormap([1 1 1; map])
if nums>1
mesh(sgrid,Pgrid-log(wbar)-markup,lambda.*Pdisteroded)
xlabel('Log (inverse) productivity')
ylabel('Log relative price')
else
plot(Pgrid-log(wbar)-markup,lambda.*Pdisteroded)
xlabel('Log relative price')
end
title('Density of adjusting firms')
axis tight
% figure
% plot(Dgrid/MedV*100,Lvalues)
% title('Lambda as a function of D')
% xlabel('Loss from inaction (in % of firm''s median value)')
% ylabel('Probability of adjustment')
% ylim([0 1])
%
% figure
% plot(Dgrid2/MedV*100,Lvalues2)
% title('Lambda as a function of L (relevant range)')
% xlabel('Loss from inaction (in % of firm''s median value)')
% ylabel('Probability of adjustment')
% hold on
% axis tight
% xlim([0 1])
% ylim([0 1])
% figure
% bar(Dgrid2(1:end-1)/MedV*100,diff(Lvalues2))
% title('Lambda pdf')
% xlabel('Loss from inaction (in % of firm''s median value)')
% ylabel('Probability of adjustment')
% xlim([0 1])
%
% if CalvoMenuMetric<1-10*eps^.5
% if nums>1
% figure
% mesh(sgrid,Pgrid-log(wbar)-markup,lambdaSmooth)
% xlabel('Log (inverse) productivity')
% ylabel('Log relative price')
% else
% plot(Pgrid-log(wbar)-markup,lambda)
% xlabel('Log relative price')
% end
% title('Probability of adjustment Lambda')
% axis tight
% end
% figure
% bar(0:Dstep:1,density_D,1)
% title('Realized losses and hazard function')
% xlabel('Non-adjustment loss L as % of median V')
% ylabel('Density of firms')
% hold on
% plot(Dgrid2/MedV*100,Lvalues2,'r')
% xlim([-Dstep/2 1+Dstep/2])
% ylim([0 0.5])
%
% figure
% bar(0:Dstep:1,density_Derod,1)
% title('Potential losses and hazard function')
% xlabel('Non-adjustment loss L as % of median V')
% ylabel('Density of firms')
% hold on
% plot(Dgrid2/MedV*100,Lvalues2,'r')
% % plot(0:Dstep:1,Lvalues3.*density_Derod,'r')
% xlim([-Dstep/2 1+Dstep/2])
% ylim([0 1])
figure
if nums>1
mesh(sgrid,Pgrid-log(wbar)-markup,V)
xlabel('Log (inverse) productivity')
ylabel('Log relative price')
else
plot(Pgrid-log(wbar)-markup,V)
xlabel('Log relative price')
end
title('Value function')
axis tight
% figure
% if nums>1
% mesh(sgrid,Pgrid,PAYOFFMAT)
% xlabel('Log real marginal cost')
% ylabel('Log relative price')
% else
% plot(Pgrid,PAYOFFMAT)
% xlabel('Log relative price')
% end
% title('Profit function')
% axis tight
% if CalvoMenuMetric<1-2*eps^.5
%
% % figure
% % for cols=1:length(pstar)
% % plot(100*(Pgrid-pstar(cols)),lambda(:,cols))
% % hold on
% % xlabel('Percent distance from optimal price')
% % ylabel('Probability of adjustment')
% % title('Probability of price increase (left) or decrease (right)')
% % end
% % hold off
%
% figure
% %for cols=1:length(pstar)
% plot(100*(log(PMAT')-pstar'*ones(1,length(Pgrid))),lambda')
% % hold on
% % pause(0.2)
% xlabel('Percent distance from optimal price')
% ylabel('Probability of adjustment')
% title('Probability of price increase (left) or decrease (right)')
% %end
% %hold off
%
% end
% figure
% bar(0:npstep:1,density_lambda,1)
% title('Density of adjustment probabilities')
% xlabel('Adjustment probability lambda')
% ylabel('Density of firms (after shock)')
% xlim([-npstep/2 1+npstep/2])