-
Notifications
You must be signed in to change notification settings - Fork 12
/
fsi_abz_ds_vecsv_pref_default_lowcmin.m
230 lines (190 loc) · 10.6 KB
/
fsi_abz_ds_vecsv_pref_default_lowcmin.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
%% Test Preference *Default Low Cmin* (Save + Borr Distribution)
% *back to <https://fanwangecon.github.io Fan>'s
% <https://fanwangecon.github.io/CodeDynaAsset/ Dynamic Assets Repository>
% Table of Content.*
%
% Default allowed, but cmin very low, so people might not default at all.
%
% @seealso
%
% * test speed: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_speed/html/fsi_abz_ds_vecsv_speed.html fsi_abz_ds_vecsv_speed>
% * test joint *RANDOM*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_joint/html/fsi_abz_ds_vecsv_joint_rand.html fsi_abz_ds_vecsv_joint_rand>
%
% * test price no default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_price/html/fsi_abz_ds_vecsv_price_nbc_cross.html fsi_abz_ds_vecsv_price_nbc_cross>
% * test price default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_price/html/fsi_abz_ds_vecsv_price_default_cross.html fsi_abz_ds_vecsv_price_default_cross>
%
% * test interest rate no default: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_nbc.html fsi_abz_ds_vecsv_nbc>
% * test interest rate no default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_nbc_cross.html fsi_abz_ds_vecsv_nbc_cross>
% * test interest rate no default *GRID*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_nbc_grid.html fsi_abz_ds_vecsv_nbc_grid>
% * test interest rate default: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_default.html fsi_abz_ds_vecsv_default>
% * test interest rate default *V(a,z)* Comparison: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_default_compaz.html fsi_abz_ds_vecsv_default_compaz>
% * test interest rate default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_default_cross.html fsi_abz_ds_vecsv_default_cross>
% * test interest rate default *GRID*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_borr/html/fsi_abz_ds_vecsv_default_grid.html fsi_abz_ds_vecsv_default_grid>
%
% * test shock default (very low cmin): <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_shock/html/fsi_abz_ds_vecsv_shk_default_lowcmin.html fsi_abz_ds_vecsv_shk_default_lowcmin>
% * test shock no default: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_shock/html/fsi_abz_ds_vecsv_shk_nbc.html fsi_abz_ds_vecsv_shk_nbc>
% * test shock no default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_shock/html/fsi_abz_ds_vecsv_shk_nbc_cross.html fsi_abz_ds_vecsv_shk_nbc_cross>
% * test shock default: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_shock/html/fsi_abz_ds_vecsv_shk_default.html fsi_abz_ds_vecsv_shk_default>
% * test shock default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_shock/html/fsi_abz_ds_vecsv_shk_default_cross.html fsi_abz_ds_vecsv_shk_default_cross>
%
% * test preference no default: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_pref/html/fsi_abz_ds_vecsv_pref_nbc.html fsi_abz_ds_vecsv_pref_nbc>
% * test preference no default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_pref/html/fsi_abz_ds_vecsv_pref_nbc_cross.html fsi_abz_ds_vecsv_pref_nbc_cross>
% * test preference default: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_pref/html/fsi_abz_ds_vecsv_pref_default.html fsi_abz_ds_vecsv_pref_default>
% * test preference default *CROSS*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_pref/html/fsi_abz_ds_vecsv_pref_default_cross.html fsi_abz_ds_vecsv_pref_default_cross>
% * test preference default (very low cmin): <https://fanwangecon.github.io/CodeDynaAsset/m_abz/test/ff_az_ds_vecsv/test_pref/html/fsi_abz_ds_vecsv_pref_default_lowcmin.html fsi_abz_ds_vecsv_pref_default_lowcmin>
%
%% Set Shared Parameters
close all;
clear all;
ar_fl_beta = [0.94, 0.96, 0.98];
ar_fl_crra = [1, 1.5, 2.0];
% Accuracy
ar_it_a_n_hg = [750];
% Borrowing/Savings Parameters
bl_default = true;
fl_c_min = 10^-300; % cmin so low default exists but never chosen
fl_b_bd = -20;
%% Simulate Model with Discount Low
for fl_crra = ar_fl_crra
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp(['fl_beta = ' num2str(ar_fl_beta(1))]);
disp(['fl_crra = ' num2str(fl_crra)]);
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('');
disp('');
disp('');
disp('');
% Call Default Parameters <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_abz_set_default_param.html ffs_abz_set_default_param>
bl_input_override = true;
it_param_set = 9;
[param_map, support_map] = ffs_abz_set_default_param(it_param_set);
% Preference
param_map('fl_beta') = ar_fl_beta(1);
param_map('fl_crra') = fl_crra;
% Borrowing Parameters
param_map('bl_default') = bl_default;
param_map('fl_c_min') = fl_c_min;
param_map('fl_b_bd') = fl_b_bd;
% Display Parameters
support_map('bl_display') = false;
support_map('bl_display_final') = false;
support_map('bl_time') = true;
support_map('bl_profile') = false;
for it_accuracy = 1:length(ar_it_a_n_hg)
% Accuracy Regular
param_map('it_a_n') = ar_it_a_n_hg(it_accuracy);
it_z_n = param_map('it_z_n');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp(['it_a_n = ' num2str(ar_it_a_n_hg(it_accuracy)) ', it_z_n = ' it_z_n]);
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
% Call Grid Generator <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_abz_get_funcgrid.html ffs_abz_get_funcgrid>
[armt_map, func_map] = ffs_abz_get_funcgrid(param_map, support_map, bl_input_override);
% Call Dynamic Programming Problem <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_abz_vf_vecsv.html ff_abz_vf_vecsv>
result_map = ff_abz_vf_vecsv(param_map, support_map, armt_map, func_map);
% Call Distribution CProgram
result_map = ff_az_ds_vecsv(param_map, support_map, armt_map, func_map, result_map, bl_input_override);
end
% Snap
snapnow;
end
% close all
close all;
%% Simulate Model with Discount Medium
close all
for fl_crra = ar_fl_crra
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp(['fl_beta = ' num2str(ar_fl_beta(2))]);
disp(['fl_crra = ' num2str(fl_crra)]);
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('');
disp('');
disp('');
disp('');
% Call Default Parameters <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_abz_set_default_param.html ffs_abz_set_default_param>
bl_input_override = true;
it_param_set = 9;
[param_map, support_map] = ffs_abz_set_default_param(it_param_set);
% Preference
param_map('fl_beta') = ar_fl_beta(2);
param_map('fl_crra') = fl_crra;
% Borrowing Parameters
param_map('bl_default') = bl_default;
param_map('fl_c_min') = fl_c_min;
param_map('fl_b_bd') = fl_b_bd;
% Display Parameters
support_map('bl_display') = false;
support_map('bl_display_final') = false;
support_map('bl_time') = true;
support_map('bl_profile') = false;
for it_accuracy = 1:length(ar_it_a_n_hg)
% Accuracy Regular
param_map('it_a_n') = ar_it_a_n_hg(it_accuracy);
it_z_n = param_map('it_z_n');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp(['it_a_n = ' num2str(ar_it_a_n_hg(it_accuracy)) ', it_z_n = ' it_z_n]);
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
% Call Grid Generator <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_abz_get_funcgrid.html ffs_abz_get_funcgrid>
[armt_map, func_map] = ffs_abz_get_funcgrid(param_map, support_map, bl_input_override);
% Call Dynamic Programming Problem <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_abz_vf_vecsv.html ff_abz_vf_vecsv>
result_map = ff_abz_vf_vecsv(param_map, support_map, armt_map, func_map);
% Call Distribution CProgram
result_map = ff_az_ds_vecsv(param_map, support_map, armt_map, func_map, result_map, bl_input_override);
end
% Snap
snapnow;
end
% close all
close all;
%% Simulate Model with Discount High
close all
for fl_crra = ar_fl_crra
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp(['fl_beta = ' num2str(ar_fl_beta(3))]);
disp(['fl_crra = ' num2str(fl_crra)]);
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp('');
disp('');
disp('');
disp('');
% Call Default Parameters <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_abz_set_default_param.html ffs_abz_set_default_param>
bl_input_override = true;
it_param_set = 9;
[param_map, support_map] = ffs_abz_set_default_param(it_param_set);
% Preference
param_map('fl_beta') = ar_fl_beta(3);
param_map('fl_crra') = fl_crra;
% Borrowing Parameters
param_map('bl_default') = bl_default;
param_map('fl_c_min') = fl_c_min;
param_map('fl_b_bd') = fl_b_bd;
% Display Parameters
support_map('bl_display') = false;
support_map('bl_display_final') = false;
support_map('bl_time') = true;
support_map('bl_profile') = false;
for it_accuracy = 1:length(ar_it_a_n_hg)
% Accuracy Regular
param_map('it_a_n') = ar_it_a_n_hg(it_accuracy);
it_z_n = param_map('it_z_n');
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
disp(['it_a_n = ' num2str(ar_it_a_n_hg(it_accuracy)) ', it_z_n = ' it_z_n]);
disp('xxxxxxxxxxxxxxxxxxxxxxxxxxx');
% Call Grid Generator <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_abz_get_funcgrid.html ffs_abz_get_funcgrid>
[armt_map, func_map] = ffs_abz_get_funcgrid(param_map, support_map, bl_input_override);
% Call Dynamic Programming Problem <https://fanwangecon.github.io/CodeDynaAsset/m_az/solve/html/ff_abz_vf_vecsv.html ff_abz_vf_vecsv>
result_map = ff_abz_vf_vecsv(param_map, support_map, armt_map, func_map);
% Call Distribution CProgram
result_map = ff_az_ds_vecsv(param_map, support_map, armt_map, func_map, result_map, bl_input_override);
end
% Snap
snapnow;
end
% close all
close all;
clear all;