time | Calls | line |
---|
| | 7 | function [param_map, support_map] = ffs_abz_set_default_param(varargin)
|
| | 8 | %% FFS_ABZ_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_abz_set_default_param(it_param_set);
|
| | 25 | %
|
| | 26 |
|
| | 27 | %% Default
|
| | 28 |
|
| 1 | 29 | it_subset = 0;
|
< 0.001 | 1 | 30 | bl_display_defparam = false;
|
< 0.001 | 1 | 31 | default_params = {it_subset bl_display_defparam};
|
< 0.001 | 1 | 32 | [default_params{1:length(varargin)}] = varargin{:};
|
< 0.001 | 1 | 33 | [it_subset, bl_display_defparam] = default_params{:};
|
| | 34 |
|
| | 35 | %% Setting param_map container
|
| | 36 |
|
< 0.001 | 1 | 37 | param_map = containers.Map('KeyType','char', 'ValueType','any');
|
| | 38 | % model name
|
< 0.001 | 1 | 39 | param_map('st_model') = 'abz';
|
| | 40 | % Preferences
|
< 0.001 | 1 | 41 | param_map('fl_crra') = 1.5;
|
< 0.001 | 1 | 42 | param_map('fl_beta') = 0.94;
|
| | 43 | % Borrowing
|
| | 44 | % fl_default_aprime is the next period asset level
|
| | 45 | % households face if they default.
|
< 0.001 | 1 | 46 | param_map('fl_b_bd') = -20; % borrow bound, = 0 if save only
|
< 0.001 | 1 | 47 | param_map('fl_default_aprime') = 0; % if default, next period aprime
|
< 0.001 | 1 | 48 | param_map('bl_default') = true; % if borrowing is default allowed
|
| | 49 | % Savings
|
< 0.001 | 1 | 50 | param_map('fl_a_min') = 0; % if there is minimum savings requirement
|
< 0.001 | 1 | 51 | param_map('fl_a_max') = 50;
|
< 0.001 | 1 | 52 | param_map('bl_loglin') = false; % log lin threshold structure
|
< 0.001 | 1 | 53 | param_map('fl_loglin_threshold') = 1; % dense points before 1
|
< 0.001 | 1 | 54 | param_map('it_a_n') = 750;
|
| | 55 | % Prices
|
< 0.001 | 1 | 56 | param_map('fl_w') = 1.28;
|
< 0.001 | 1 | 57 | param_map('fl_r_save') = 0.025;
|
| | 58 |
|
| | 59 | % Shock 1: Borrowing Interest Rate is a Shock Parameters, see fft_gen_discrete_var.m
|
< 0.001 | 1 | 60 | param_map('st_z_r_borr_drv_ele_type') = 'unif';
|
< 0.001 | 1 | 61 | param_map('st_z_r_borr_drv_prb_type') = 'poiss';
|
< 0.001 | 1 | 62 | param_map('fl_z_r_borr_poiss_mean') = 1.75;
|
< 0.001 | 1 | 63 | param_map('fl_z_r_borr_max') = 0.095;
|
< 0.001 | 1 | 64 | param_map('fl_z_r_borr_min') = 0.025;
|
< 0.001 | 1 | 65 | param_map('fl_z_r_borr_n') = 5;
|
| | 66 | % param_map('fl_z_r_borr_max') = 0.095;
|
| | 67 | % param_map('fl_z_r_borr_min') = 0.095;
|
| | 68 | % param_map('fl_z_r_borr_n') = 1;
|
| | 69 |
|
| | 70 | % Shock 2: Parameters
|
< 0.001 | 1 | 71 | param_map('it_z_wage_n') = 15;
|
< 0.001 | 1 | 72 | param_map('fl_z_wage_mu') = 0;
|
< 0.001 | 1 | 73 | param_map('fl_z_wage_rho') = 0.8;
|
< 0.001 | 1 | 74 | param_map('fl_z_wage_sig') = 0.2;
|
| | 75 |
|
| | 76 | % Shock 3
|
< 0.001 | 1 | 77 | param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n');
|
| | 78 |
|
| | 79 | % is save/borr choice principle or principle + interest, matters for
|
| | 80 | % borrowing grid generation program. the *abz* problem is written with
|
| | 81 | % asset choice as principle only, the _abz_fibs_ problems are written as
|
| | 82 | % priniple + interest as the state, so there this should be false.
|
< 0.001 | 1 | 83 | param_map('bl_b_is_principle') = true;
|
| | 84 | % Minimum Consumption, c_min is for default, when c < 0, replace utility
|
| | 85 | % with fl_nan_replace.
|
< 0.001 | 1 | 86 | param_map('fl_c_min') = 0.001;
|
< 0.001 | 1 | 87 | param_map('fl_nan_replace') = -99999;
|
| | 88 |
|
| | 89 | % Solution Accuracy
|
< 0.001 | 1 | 90 | param_map('it_maxiter_val') = 1000;
|
< 0.001 | 1 | 91 | param_map('it_maxiter_dist') = 1000;
|
< 0.001 | 1 | 92 | param_map('st_analytical_stationary_type') = 'eigenvector'; % could be eigenvector, projection, power
|
< 0.001 | 1 | 93 | param_map('it_trans_power_dist') = 1000;
|
< 0.001 | 1 | 94 | param_map('fl_tol_val') = 10^-5;
|
< 0.001 | 1 | 95 | param_map('fl_tol_pol') = 10^-5;
|
< 0.001 | 1 | 96 | param_map('fl_tol_dist') = 10^-5;
|
< 0.001 | 1 | 97 | param_map('it_tol_pol_nochange') = 25; % number of iterations where policy does not change
|
| | 98 |
|
| | 99 | %% Setting support_map container
|
| | 100 |
|
< 0.001 | 1 | 101 | support_map = containers.Map('KeyType','char', 'ValueType','any');
|
| | 102 | % root directory
|
0.001 | 1 | 103 | [st_root_path] = preamble(false);
|
< 0.001 | 1 | 104 | st_matimg_path_root = [st_root_path '/m_abz/'];
|
< 0.001 | 1 | 105 | support_map('st_matimg_path_root') = st_matimg_path_root;
|
| | 106 | % timer
|
< 0.001 | 1 | 107 | support_map('bl_time') = true;
|
| | 108 | % Print Controls
|
< 0.001 | 1 | 109 | support_map('bl_display') = true;
|
< 0.001 | 1 | 110 | support_map('bl_display_dist') = false;
|
< 0.001 | 1 | 111 | support_map('it_display_every') = 5; % how often to print results
|
| | 112 | % Profile Controls
|
< 0.001 | 1 | 113 | support_map('bl_profile') = false;
|
< 0.001 | 1 | 114 | support_map('bl_profile_dist') = false; % distribution profile
|
< 0.001 | 1 | 115 | support_map('st_profile_path') = [st_matimg_path_root '/solve/profile/'];
|
< 0.001 | 1 | 116 | support_map('st_profile_prefix') = [''];
|
< 0.001 | 1 | 117 | support_map('st_profile_name_main') = ['_default'];
|
0.004 | 1 | 118 | support_map('st_profile_suffix') = ['_p' num2str(it_subset)];
|
| | 119 |
|
< 0.001 | 1 | 120 | support_map('bl_post') = false;
|
| | 121 | % Final Print
|
< 0.001 | 1 | 122 | support_map('bl_display_final') = false; % print finalized results
|
< 0.001 | 1 | 123 | support_map('bl_display_final_dist') = false; % print finalized results
|
< 0.001 | 1 | 124 | support_map('bl_display_final_dist_detail') = false; % print finalized results
|
< 0.001 | 1 | 125 | support_map('it_display_final_rowmax') = 100; % max row to print (states/iters)
|
< 0.001 | 1 | 126 | support_map('it_display_final_colmax') = 15; % max col to print (shocks)
|
| | 127 | % Mat File Controls
|
< 0.001 | 1 | 128 | support_map('bl_mat') = false;
|
< 0.001 | 1 | 129 | support_map('st_mat_path') = [st_matimg_path_root '/solve/mat/'];
|
< 0.001 | 1 | 130 | support_map('st_mat_prefix') = [''];
|
< 0.001 | 1 | 131 | support_map('st_mat_name_main') = ['_default'];
|
< 0.001 | 1 | 132 | support_map('st_mat_suffix') = ['_p' num2str(it_subset)];
|
| | 133 | % Graphing Controls
|
< 0.001 | 1 | 134 | support_map('bl_graph') = false;
|
< 0.001 | 1 | 135 | support_map('bl_graph_onebyones') = true;
|
< 0.001 | 1 | 136 | support_map('bl_graph_val') = true;
|
< 0.001 | 1 | 137 | support_map('bl_graph_pol_lvl') = true;
|
< 0.001 | 1 | 138 | support_map('bl_graph_pol_pct') = true;
|
< 0.001 | 1 | 139 | support_map('bl_graph_coh_t_coh') = true;
|
| | 140 | % Image Saving Controls (given graphing)
|
< 0.001 | 1 | 141 | support_map('st_title_prefix') = '';
|
< 0.001 | 1 | 142 | support_map('bl_img_save') = false;
|
< 0.001 | 1 | 143 | support_map('st_img_path') = [st_matimg_path_root '/solve/img/'];
|
< 0.001 | 1 | 144 | support_map('st_img_prefix') = [''];
|
< 0.001 | 1 | 145 | support_map('st_img_name_main') = ['_default'];
|
< 0.001 | 1 | 146 | support_map('st_img_suffix') = ['_p' num2str(it_subset) '.png'];
|
| | 147 |
|
| | 148 | % Sub-function graphing controls
|
< 0.001 | 1 | 149 | support_map('bl_graph_funcgrids') = false;
|
< 0.001 | 1 | 150 | support_map('bl_display_funcgrids') = false;
|
| | 151 |
|
| | 152 | %% Subset Options
|
| | 153 | %
|
| | 154 | % # it_subset = 1 is basic invoke quick test
|
| | 155 | % # it_subset = 2 is main invoke
|
| | 156 | % # it_subset = 3 is profiling invoke
|
| | 157 | % # it_subset = 4 is matlab publish.
|
| | 158 | %
|
| | 159 |
|
0.005 | 1 | 160 | if (ismember(it_subset, [1,2,3,4]))
|
0.003 | 1 | 161 | if (ismember(it_subset, [1]))
|
| | 162 | % TEST quick
|
| | 163 | param_map('it_a_n') = 25;
|
| | 164 | param_map('it_z_wage_n') = 3;
|
| | 165 | param_map('fl_z_r_borr_n') = 2;
|
| | 166 | param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n');
|
| | 167 | param_map('it_maxiter_val') = 50;
|
| | 168 | param_map('it_tol_pol_nochange') = 1000;
|
| | 169 | support_map('bl_display') = true;
|
| | 170 | support_map('it_display_every') = 1;
|
| | 171 | end
|
< 0.001 | 1 | 172 | if (ismember(it_subset, [2, 4]))
|
| | 173 | % close figures
|
0.010 | 1 | 174 | close all;
|
| | 175 | % Main Run
|
< 0.001 | 1 | 176 | support_map('bl_time') = true;
|
< 0.001 | 1 | 177 | support_map('bl_display') = true;
|
< 0.001 | 1 | 178 | support_map('it_display_every') = 5;
|
| | 179 |
|
< 0.001 | 1 | 180 | support_map('bl_post') = true;
|
< 0.001 | 1 | 181 | support_map('bl_display_final') = true;
|
< 0.001 | 1 | 182 | support_map('bl_mat') = false;
|
< 0.001 | 1 | 183 | support_map('bl_graph') = true;
|
< 0.001 | 1 | 184 | support_map('bl_graph_onebyones') = false;
|
< 0.001 | 1 | 185 | support_map('bl_img_save') = true;
|
< 0.001 | 1 | 186 | if (ismember(it_subset, [4]))
|
< 0.001 | 1 | 187 | support_map('bl_display') = false;
|
< 0.001 | 1 | 188 | support_map('bl_graph_onebyones') = true;
|
< 0.001 | 1 | 189 | support_map('bl_img_save') = false;
|
| 1 | 190 | end
|
| 1 | 191 | end
|
< 0.001 | 1 | 192 | if (ismember(it_subset, [3]))
|
| | 193 | % Profile run
|
| | 194 | support_map('bl_profile') = true;
|
| | 195 | support_map('bl_display') = false; % don't print
|
| | 196 | support_map('bl_display_dist') = false; % don't print
|
| | 197 | support_map('bl_time') = true;
|
| | 198 | end
|
| 1 | 199 | end
|
| | 200 |
|
| | 201 |
|
| | 202 | %% Subset Options for Distribution solutions
|
| | 203 | %
|
| | 204 | % # it_subset = 5 is basic invoke quick test
|
| | 205 | % # it_subset = 6 is invoke full test
|
| | 206 | % # it_subset = 7 is profiling invoke
|
| | 207 | % # it_subset = 8 is matlab publish
|
| | 208 | % # it_subset = 9 is invoke operational (only final stats) and coh graph
|
| | 209 | %
|
| | 210 |
|
< 0.001 | 1 | 211 | if (ismember(it_subset, [5,6,7,8,9]))
|
| | 212 | if (ismember(it_subset, [5]))
|
| | 213 | % TEST quick (need to enough to have distribution)
|
| | 214 | param_map('it_a_n') = 100;
|
| | 215 | param_map('it_z_wage_n') = 5;
|
| | 216 | param_map('fl_z_r_borr_n') = 2;
|
| | 217 | param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n');
|
| | 218 | param_map('it_maxiter_val') = 50;
|
| | 219 | param_map('it_maxiter_dist') = 50;
|
| | 220 | param_map('it_tol_pol_nochange') = 1000;
|
| | 221 | support_map('bl_display_dist') = true;
|
| | 222 | end
|
| | 223 | if (ismember(it_subset, [6, 8, 9]))
|
| | 224 | % close all
|
| | 225 | close all;
|
| | 226 | % Main Run
|
| | 227 | support_map('bl_time') = true;
|
| | 228 | support_map('bl_display') = false;
|
| | 229 | support_map('bl_display_dist') = false;
|
| | 230 | support_map('it_display_every') = 20;
|
| | 231 |
|
| | 232 | support_map('bl_post') = true;
|
| | 233 | support_map('bl_display_final_dist') = true;
|
| | 234 | support_map('bl_mat') = false;
|
| | 235 | support_map('bl_graph') = true;
|
| | 236 | support_map('bl_graph_onebyones') = false;
|
| | 237 | support_map('bl_img_save') = true;
|
| | 238 |
|
| | 239 | % do not generate all graphs when solving for distribution
|
| | 240 | support_map('bl_graph_val') = false;
|
| | 241 | support_map('bl_graph_pol_lvl') = false;
|
| | 242 | support_map('bl_graph_pol_pct') = false;
|
| | 243 | support_map('bl_graph_coh_t_coh') = true;
|
| | 244 |
|
| | 245 | if (ismember(it_subset, [8, 9]))
|
| | 246 | support_map('bl_display') = false;
|
| | 247 | support_map('bl_display_dist') = false;
|
| | 248 | support_map('bl_display_final_dist_detail') = true;
|
| | 249 | support_map('bl_graph_onebyones') = true;
|
| | 250 | support_map('bl_img_save') = false;
|
| | 251 | if (ismember(it_subset, [9]))
|
| | 252 | % quietly turn off all graphs, only tables
|
| | 253 | support_map('bl_display_final_dist_detail') = false;
|
| | 254 | support_map('bl_graph_coh_t_coh') = false;
|
| | 255 | end
|
| | 256 | end
|
| | 257 |
|
| | 258 | end
|
| | 259 | if (ismember(it_subset, [7]))
|
| | 260 | % Profile run
|
| | 261 | support_map('bl_profile_dist') = true;
|
| | 262 | support_map('bl_display') = false; % don't print
|
| | 263 | support_map('bl_display_dist') = false; % don't print
|
| | 264 | support_map('bl_time') = true;
|
| | 265 | end
|
| | 266 | end
|
| | 267 |
|
| | 268 | %% Display
|
| | 269 |
|
< 0.001 | 1 | 270 | if (bl_display_defparam)
|
| | 271 | disp('param_map');
|
| | 272 | disp(param_map);
|
| | 273 | param_map_keys = keys(param_map);
|
| | 274 | param_map_vals = values(param_map);
|
| | 275 | for i = 1:length(param_map)
|
| | 276 | st_display = strjoin(['pos =' num2str(i) '; key =' string(param_map_keys{i}) '; val =' string(param_map_vals{i})]);
|
| | 277 | disp(st_display);
|
| | 278 | end
|
| | 279 |
|
| | 280 | disp('support_map')
|
| | 281 | disp(support_map);
|
| | 282 | param_map_keys = keys(support_map);
|
| | 283 | param_map_vals = values(support_map);
|
| | 284 | for i = 1:length(support_map)
|
| | 285 | st_display = strjoin(['pos =' num2str(i) '; key =' string(param_map_keys{i}) '; val =' string(param_map_vals{i})]);
|
| | 286 | disp(st_display);
|
| | 287 | end
|
| | 288 | end
|
| | 289 |
|
< 0.001 | 1 | 290 | end
|
Other subfunctions in this file are not included in this listing.