time | Calls | line |
---|
| | 7 | function [param_map, support_map] = ffs_abzr_fibs_set_default_param(varargin)
|
| | 8 | %% FFS_ABZ_FIBS_SET_DEFAULT_PARAM setting model default parameters
|
| | 9 | % two groups of default parameters stored in container maps
|
| | 10 | %
|
| | 11 | % @param it_subset integer default parameter control subsetting. it_subset = 1 is
|
| | 12 | % basic invoke quick test. it_subset = 2 is main invoke. it_subset = 3 is
|
| | 13 | % profiling invoke. it_subset = 4 is matlab publish.
|
| | 14 | %
|
| | 15 | % @param bl_display_defparam boolean local printing
|
| | 16 | %
|
| | 17 | % @return param_map container parameters needed for solving the model
|
| | 18 | %
|
| | 19 | % @return support_map container programming control parameters like to graph to print etc
|
| | 20 | %
|
| | 21 | % @example
|
| | 22 | %
|
| | 23 | % it_param_set = 1;
|
| | 24 | % [param_map, support_map] = ffs_abzr_fibs_set_default_param(it_param_set);
|
| | 25 | %
|
| | 26 | % @seealso
|
| | 27 | %
|
| | 28 | % * initialize paramters *az*: <https://fanwangecon.github.io/CodeDynaAsset/m_az/paramfunc/html/ffs_az_set_default_param.html ffs_az_set_default_param>
|
| | 29 | % * initialize paramters *abz*: <https://fanwangecon.github.io/CodeDynaAsset/m_abz/paramfunc/html/ffs_abz_set_default_param.html ffs_abz_set_default_param>
|
| | 30 | %
|
| | 31 |
|
| | 32 | %% Default
|
| | 33 |
|
< 0.001 | 1 | 34 | if (isempty(varargin))
|
| | 35 | bl_display_defparam = true;
|
< 0.001 | 1 | 36 | else
|
| 1 | 37 | bl_display_defparam = false;
|
| 1 | 38 | end
|
| | 39 |
|
< 0.001 | 1 | 40 | it_subset = 0;
|
< 0.001 | 1 | 41 | default_params = {it_subset bl_display_defparam};
|
< 0.001 | 1 | 42 | [default_params{1:length(varargin)}] = varargin{:};
|
< 0.001 | 1 | 43 | [it_subset, bl_display_defparam] = default_params{:};
|
| | 44 |
|
| | 45 | %% 1. Initiate Param_map
|
| | 46 |
|
< 0.001 | 1 | 47 | param_map = containers.Map('KeyType','char', 'ValueType','any');
|
| | 48 |
|
| | 49 | % model name
|
< 0.001 | 1 | 50 | param_map('st_model') = 'abzr_fibs';
|
| | 51 |
|
| | 52 | % Preferences
|
< 0.001 | 1 | 53 | param_map('fl_crra') = 1.5;
|
< 0.001 | 1 | 54 | param_map('fl_beta') = 0.94;
|
< 0.001 | 1 | 55 | param_map('fl_nan_replace') = -99999;
|
| | 56 |
|
| | 57 | %% 2a. Set Borrowing Control Parameters
|
| | 58 |
|
| | 59 | % Borrowing
|
| | 60 | % fl_default_aprime is the next period asset level
|
| | 61 | % households face if they default.
|
< 0.001 | 1 | 62 | param_map('fl_b_bd') = -20; % borrow bound, = 0 if save only
|
< 0.001 | 1 | 63 | param_map('fl_default_aprime') = 0;
|
| | 64 |
|
| | 65 | % Borrowing Setting 1: Default Allowed, Bridge True, bl_rollover does not matter
|
| | 66 | % Borrowing Setting 2: Default Allowed, Bridge False, bl_rollover matter
|
< 0.001 | 1 | 67 | param_map('bl_default') = true; % if borrowing is default allowed
|
< 0.001 | 1 | 68 | param_map('bl_bridge') = true;
|
< 0.001 | 1 | 69 | param_map('bl_rollover') = true;
|
| | 70 |
|
| | 71 | % is save/borr choice principle or principle + interest, matters for
|
| | 72 | % borrowing grid generation program. the *abzr* problem is written with
|
| | 73 | % asset choice as principle only, the _abzr_fibs_ problems are written as
|
| | 74 | % priniple + interest as the state, so there this should be false.
|
< 0.001 | 1 | 75 | param_map('bl_b_is_principle') = false;
|
| | 76 |
|
| | 77 | % Minimum Consumption, c_min is for default, when c < 0, replace utility
|
| | 78 | % with fl_nan_replace.
|
< 0.001 | 1 | 79 | param_map('fl_c_min') = 0.02;
|
| | 80 |
|
| | 81 | %% 2b. Set Asset Grid Parameters
|
| | 82 | % see
|
| | 83 | % <https://fanwangecon.github.io/CodeDynaAsset/m_abzr/paramfunc/html/ffs_abzr_gen_borrsave_grid.html
|
| | 84 | % ffs_abzr_gen_borrsave_grid> for how these borrowing/saving grid parameters
|
| | 85 | % will be used.
|
| | 86 |
|
| | 87 | % Savings
|
< 0.001 | 1 | 88 | param_map('fl_a_min') = 0; % if there is minimum savings requirement
|
< 0.001 | 1 | 89 | param_map('fl_a_max') = 50;
|
< 0.001 | 1 | 90 | param_map('bl_loglin') = false; % log lin threshold structure
|
< 0.001 | 1 | 91 | param_map('fl_loglin_threshold') = 1; % dense points before 1
|
< 0.001 | 1 | 92 | param_map('it_a_n') = 750;
|
| | 93 |
|
| | 94 | % Prices
|
< 0.001 | 1 | 95 | param_map('fl_w') = 1.28;
|
| | 96 |
|
| | 97 | %% 3. Set Interest Rates non-Shock Parameters
|
| | 98 |
|
| | 99 | % formal informal parameters
|
| | 100 | % fl_for_br_block are the formal borrowing grid block sizes.
|
< 0.001 | 1 | 101 | param_map('fl_r_fsv') = 0.025;
|
< 0.001 | 1 | 102 | param_map('fl_r_fbr') = 0.065;
|
| | 103 | % see: ffs_for_br_block.m
|
< 0.001 | 1 | 104 | param_map('st_forbrblk_type') = 'seg3';
|
< 0.001 | 1 | 105 | param_map('fl_forbrblk_brmost') = -19;
|
< 0.001 | 1 | 106 | param_map('fl_forbrblk_brleast') = -1;
|
< 0.001 | 1 | 107 | param_map('fl_forbrblk_gap') = -1.5;
|
| | 108 |
|
| | 109 | %% 4a. Set Shock 1 Borrowing Interest Rate Parameters
|
| | 110 | % See
|
| | 111 | % <https://fanwangecon.github.io/CodeDynaAsset/tools/html/fft_gen_discrete_var.html
|
| | 112 | % fft_gen_discrete_var> for how these parameters will be used to generate a
|
| | 113 | % discrete random variable for the interest rate. And also various formal
|
| | 114 | % and informal files.
|
| | 115 |
|
| | 116 | % Borrowing Interest rate
|
< 0.001 | 1 | 117 | param_map('st_z_r_infbr_drv_ele_type') = 'unif';
|
< 0.001 | 1 | 118 | param_map('st_z_r_infbr_drv_prb_type') = 'poiss';
|
< 0.001 | 1 | 119 | param_map('fl_z_r_infbr_poiss_mean') = 20;
|
< 0.001 | 1 | 120 | param_map('fl_z_r_infbr_max') = 0.095;
|
< 0.001 | 1 | 121 | param_map('fl_z_r_infbr_min') = 0.025;
|
< 0.001 | 1 | 122 | param_map('fl_z_r_infbr_n') = 5;
|
| | 123 | % param_map('fl_z_r_infbr_max') = 0.095;
|
| | 124 | % param_map('fl_z_r_infbr_min') = 0.095;
|
| | 125 | % param_map('fl_z_r_infbr_n') = 1;
|
| | 126 |
|
| | 127 | %% 4b. Set Shock 2 Wage Shock Parameters
|
| | 128 | % See
|
| | 129 | % <https://github.com/FanWangEcon/CodeDynaAsset/blob/master/tools/ffto_gen_tauchen_jhl.m
|
| | 130 | % ffto_gen_tauchen_jhl> for standard implementation of ar1 shock process
|
| | 131 | % using these parameters.
|
| | 132 |
|
| | 133 | % Shock Parameters
|
< 0.001 | 1 | 134 | param_map('it_z_wage_n') = 15;
|
< 0.001 | 1 | 135 | param_map('fl_z_wage_mu') = 0;
|
< 0.001 | 1 | 136 | param_map('fl_z_wage_rho') = 0.8;
|
< 0.001 | 1 | 137 | param_map('fl_z_wage_sig') = 0.2;
|
| | 138 |
|
| | 139 | %% 4c. Set Overall Shock Grid Count
|
| | 140 |
|
< 0.001 | 1 | 141 | param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_infbr_n');
|
| | 142 |
|
| | 143 | %% 5. Set Solution Control Parameters
|
| | 144 |
|
| | 145 | % Solution Accuracy
|
< 0.001 | 1 | 146 | param_map('it_maxiter_val') = 1000;
|
< 0.001 | 1 | 147 | param_map('it_maxiter_dist') = 1000;
|
< 0.001 | 1 | 148 | param_map('it_trans_power_dist') = 1000;
|
< 0.001 | 1 | 149 | param_map('st_analytical_stationary_type') = 'eigenvector'; % could be eigenvector, projection, power
|
< 0.001 | 1 | 150 | param_map('fl_tol_val') = 10^-5;
|
< 0.001 | 1 | 151 | param_map('fl_tol_pol') = 10^-5;
|
< 0.001 | 1 | 152 | param_map('fl_tol_dist') = 10^-5;
|
< 0.001 | 1 | 153 | param_map('it_tol_pol_nochange') = 25; % number of iterations where policy does not change
|
| | 154 |
|
| | 155 | %% 6. Setting support_map container
|
| | 156 |
|
< 0.001 | 1 | 157 | support_map = containers.Map('KeyType','char', 'ValueType','any');
|
| | 158 | % root directory
|
0.001 | 1 | 159 | [st_root_path] = preamble(false);
|
< 0.001 | 1 | 160 | st_matimg_path_root = [st_root_path '/m_fibs/'];
|
< 0.001 | 1 | 161 | support_map('st_matimg_path_root') = st_matimg_path_root;
|
| | 162 | % timer
|
< 0.001 | 1 | 163 | support_map('bl_time') = true;
|
| | 164 | % Print Controls
|
< 0.001 | 1 | 165 | support_map('bl_display_defparam') = false;
|
< 0.001 | 1 | 166 | support_map('bl_display') = true;
|
< 0.001 | 1 | 167 | support_map('bl_display_dist') = false;
|
< 0.001 | 1 | 168 | support_map('it_display_every') = 5; % how often to print results
|
| | 169 | % Profile Controls
|
< 0.001 | 1 | 170 | support_map('bl_profile') = false;
|
< 0.001 | 1 | 171 | support_map('bl_profile_dist') = false; % distribution profile
|
< 0.001 | 1 | 172 | support_map('st_profile_path') = [st_matimg_path_root '/m_abzr_solve/profile/'];
|
< 0.001 | 1 | 173 | support_map('st_profile_prefix') = [''];
|
< 0.001 | 1 | 174 | support_map('st_profile_name_main') = ['_default'];
|
0.006 | 1 | 175 | support_map('st_profile_suffix') = ['_p' num2str(it_subset)];
|
| | 176 |
|
< 0.001 | 1 | 177 | support_map('bl_post') = false;
|
| | 178 | % Final Print
|
< 0.001 | 1 | 179 | support_map('bl_display_final') = false; % print finalized results
|
< 0.001 | 1 | 180 | support_map('bl_display_final_dist') = false; % print finalized results
|
< 0.001 | 1 | 181 | support_map('bl_display_final_dist_detail') = false; % print finalized results
|
< 0.001 | 1 | 182 | support_map('it_display_final_rowmax') = 100; % max row to print (states/iters)
|
< 0.001 | 1 | 183 | support_map('it_display_final_colmax') = 15; % max col to print (shocks)
|
| | 184 | % Mat File Controls
|
< 0.001 | 1 | 185 | support_map('bl_mat') = false;
|
< 0.001 | 1 | 186 | support_map('st_mat_path') = [st_matimg_path_root '/m_abzr_solve/mat/'];
|
< 0.001 | 1 | 187 | support_map('st_mat_prefix') = [''];
|
< 0.001 | 1 | 188 | support_map('st_mat_name_main') = ['_default'];
|
< 0.001 | 1 | 189 | support_map('st_mat_suffix') = ['_p' num2str(it_subset)];
|
| | 190 | % Graphing Controls
|
< 0.001 | 1 | 191 | support_map('bl_graph') = false;
|
< 0.001 | 1 | 192 | support_map('bl_graph_onebyones') = true;
|
< 0.001 | 1 | 193 | support_map('bl_graph_val') = true;
|
< 0.001 | 1 | 194 | support_map('bl_graph_pol_lvl') = true;
|
< 0.001 | 1 | 195 | support_map('bl_graph_pol_pct') = true;
|
< 0.001 | 1 | 196 | support_map('bl_graph_coh_t_coh') = true;
|
< 0.001 | 1 | 197 | support_map('bl_graph_discrete') = true;
|
| | 198 | % Formal Informal Specific Graphs
|
< 0.001 | 1 | 199 | support_map('bl_graph_forinf_discrete') = true;
|
< 0.001 | 1 | 200 | support_map('bl_graph_forinf_pol_lvl') = true;
|
< 0.001 | 1 | 201 | support_map('bl_graph_forinf_pol_pct') = true;
|
| | 202 |
|
| | 203 |
|
| | 204 | % Image Saving Controls (given graphing)
|
< 0.001 | 1 | 205 | support_map('st_title_prefix') = '';
|
< 0.001 | 1 | 206 | support_map('bl_img_save') = false;
|
< 0.001 | 1 | 207 | support_map('st_img_path') = [st_matimg_path_root '/m_abzr_solve/img/'];
|
< 0.001 | 1 | 208 | support_map('st_img_prefix') = [''];
|
< 0.001 | 1 | 209 | support_map('st_img_name_main') = ['_default'];
|
< 0.001 | 1 | 210 | support_map('st_img_suffix') = ['_p' num2str(it_subset) '.png'];
|
| | 211 |
|
| | 212 | % Sub-function graphing controls
|
< 0.001 | 1 | 213 | support_map('bl_graph_funcgrids') = false;
|
< 0.001 | 1 | 214 | support_map('bl_display_funcgrids') = false;
|
< 0.001 | 1 | 215 | support_map('bl_display_minccost') = false;
|
< 0.001 | 1 | 216 | support_map('bl_display_infbridge') = false;
|
| | 217 |
|
| | 218 | %% Subset Options
|
| | 219 | %
|
| | 220 | % # it_subset = 1 is basic invoke quick test
|
| | 221 | % # it_subset = 2 is main invoke
|
| | 222 | % # it_subset = 3 is profiling invoke
|
| | 223 | % # it_subset = 4 is matlab publish.
|
| | 224 | %
|
| | 225 |
|
| | 226 | % close figures
|
0.011 | 1 | 227 | close all;
|
| | 228 |
|
0.005 | 1 | 229 | if (ismember(it_subset, [3]))
|
| | 230 |
|
| | 231 | % Profile run
|
| | 232 | support_map('bl_profile') = true;
|
| | 233 | support_map('bl_display') = false; % don't print
|
| | 234 | support_map('bl_time') = true;
|
| | 235 |
|
0.004 | 1 | 236 | elseif (ismember(it_subset, [1,2,4]))
|
| | 237 |
|
| | 238 | % Main Run
|
< 0.001 | 1 | 239 | support_map('bl_time') = true;
|
< 0.001 | 1 | 240 | support_map('bl_display_defparam') = true;
|
< 0.001 | 1 | 241 | support_map('bl_display') = true;
|
< 0.001 | 1 | 242 | support_map('it_display_every') = 5;
|
| | 243 |
|
< 0.001 | 1 | 244 | support_map('bl_post') = true;
|
< 0.001 | 1 | 245 | support_map('bl_display_final') = true;
|
< 0.001 | 1 | 246 | support_map('bl_mat') = false;
|
< 0.001 | 1 | 247 | support_map('bl_graph') = true;
|
< 0.001 | 1 | 248 | support_map('bl_graph_onebyones') = false;
|
< 0.001 | 1 | 249 | support_map('bl_img_save') = true;
|
| | 250 |
|
< 0.001 | 1 | 251 | if (ismember(it_subset, [1]))
|
| | 252 |
|
| | 253 | % TEST quick
|
| | 254 | param_map('it_a_n') = 25;
|
| | 255 |
|
| | 256 | param_map('it_z_wage_n') = 3;
|
| | 257 | param_map('fl_z_r_infbr_n') = 2;
|
| | 258 | param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_infbr_n');
|
| | 259 |
|
| | 260 | param_map('it_maxiter_val') = 50;
|
| | 261 | support_map('it_display_every') = 1;
|
| | 262 |
|
| | 263 | support_map('bl_graph') = false;
|
| | 264 |
|
| | 265 | end
|
| | 266 |
|
< 0.001 | 1 | 267 | if (ismember(it_subset, [4]))
|
< 0.001 | 1 | 268 | support_map('bl_time') = false;
|
< 0.001 | 1 | 269 | support_map('bl_display') = false;
|
< 0.001 | 1 | 270 | support_map('bl_graph_onebyones') = true;
|
< 0.001 | 1 | 271 | support_map('bl_img_save') = false;
|
| 1 | 272 | end
|
| | 273 |
|
| 1 | 274 | end
|
| | 275 |
|
| | 276 | %% Subset Options for Distribution solutions
|
| | 277 | %
|
| | 278 | % # it_subset = 5 is basic invoke quick test
|
| | 279 | % # it_subset = 6 is invoke full test
|
| | 280 | % # it_subset = 7 is profiling invoke
|
| | 281 | % # it_subset = 8 is matlab publish
|
| | 282 | % # it_subset = 9 is invoke operational (only final stats) and coh graph
|
| | 283 | %
|
| | 284 |
|
< 0.001 | 1 | 285 | if (ismember(it_subset, [7]))
|
| | 286 | % Profile run
|
| | 287 | support_map('bl_profile_dist') = true;
|
| | 288 | support_map('bl_display') = false; % don't print
|
| | 289 | support_map('bl_display_dist') = false; % don't print
|
| | 290 | support_map('bl_time') = true;
|
| | 291 |
|
< 0.001 | 1 | 292 | elseif (ismember(it_subset, [5,6,8,9]))
|
| | 293 |
|
| | 294 | % Main Run
|
| | 295 | support_map('bl_time') = true;
|
| | 296 | support_map('bl_display_defparam') = true;
|
| | 297 | support_map('bl_display') = false;
|
| | 298 | support_map('bl_display_dist') = true;
|
| | 299 | support_map('it_display_every') = 20;
|
| | 300 |
|
| | 301 | support_map('bl_post') = true;
|
| | 302 | support_map('bl_display_final_dist') = true;
|
| | 303 | support_map('bl_mat') = false;
|
| | 304 | support_map('bl_graph') = true;
|
| | 305 | support_map('bl_graph_onebyones') = false;
|
| | 306 | support_map('bl_img_save') = true;
|
| | 307 |
|
| | 308 | % do not generate all graphs when solving for distribution
|
| | 309 | support_map('bl_graph_val') = false;
|
| | 310 | support_map('bl_graph_pol_lvl') = false;
|
| | 311 | support_map('bl_graph_pol_pct') = false;
|
| | 312 | support_map('bl_graph_coh_t_coh') = true;
|
| | 313 | support_map('bl_graph_forinf_discrete') = false;
|
| | 314 | support_map('bl_graph_forinf_pol_lvl') = false;
|
| | 315 | support_map('bl_graph_forinf_pol_pct') = true;
|
| | 316 |
|
| | 317 | if (ismember(it_subset, [5]))
|
| | 318 |
|
| | 319 | % TEST quick (need to enough to have distribution)
|
| | 320 | param_map('it_a_n') = 100;
|
| | 321 |
|
| | 322 | param_map('it_z_wage_n') = 5;
|
| | 323 | param_map('fl_z_r_infbr_n') = 2;
|
| | 324 | param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_infbr_n');
|
| | 325 |
|
| | 326 | param_map('it_maxiter_val') = 50;
|
| | 327 | param_map('it_maxiter_dist') = 50;
|
| | 328 |
|
| | 329 | support_map('bl_display_dist') = true;
|
| | 330 | support_map('bl_graph') = false;
|
| | 331 |
|
| | 332 | end
|
| | 333 |
|
| | 334 | if (ismember(it_subset, [8, 9]))
|
| | 335 |
|
| | 336 | support_map('bl_time') = false;
|
| | 337 | support_map('bl_display') = false;
|
| | 338 | support_map('bl_display_dist') = false;
|
| | 339 | support_map('bl_display_final_dist_detail') = true;
|
| | 340 | support_map('bl_graph_onebyones') = true;
|
| | 341 | support_map('bl_img_save') = false;
|
| | 342 |
|
| | 343 | if (ismember(it_subset, [9]))
|
| | 344 | support_map('bl_display_final_dist_detail') = false;
|
| | 345 | support_map('bl_display_defparam') = false;
|
| | 346 | support_map('bl_graph_coh_t_coh') = false;
|
| | 347 | support_map('bl_graph_forinf_pol_pct') = false;
|
| | 348 | end
|
| | 349 |
|
| | 350 | end
|
| | 351 | end
|
| | 352 |
|
| | 353 | %% Display
|
| | 354 |
|
| 1 | 355 | if (bl_display_defparam)
|
| | 356 | fft_container_map_display(param_map);
|
| | 357 | fft_container_map_display(support_map);
|
| | 358 | end
|
| | 359 |
|
< 0.001 | 1 | 360 | end
|
Other subfunctions in this file are not included in this listing.