Set Model Parameters (ABZ FIBS)
back to Fan's Dynamic Assets Repository Table of Content.
Contents
function [param_map, support_map] = ffs_abz_fibs_set_default_param(varargin)
FFS_ABZ_FIBS_SET_DEFAULT_PARAM setting model default parameters
two groups of default parameters stored in container maps
@param it_subset integer default parameter control subsetting. it_subset = 1 is basic invoke quick test. it_subset = 2 is main invoke. it_subset = 3 is profiling invoke. it_subset = 4 is matlab publish.
@param bl_display_defparam boolean local printing
@return param_map container parameters needed for solving the model
@return support_map container programming control parameters like to graph to print etc
@example
it_param_set = 1; [param_map, support_map] = ffs_abz_fibs_set_default_param(it_param_set);
Default
it_subset = 4; if (isempty(varargin)) bl_display_defparam = true; else bl_display_defparam = false; end default_params = {it_subset bl_display_defparam}; [default_params{1:length(varargin)}] = varargin{:}; [it_subset, bl_display_defparam] = default_params{:};
Setting param_map container
param_map = containers.Map('KeyType','char', 'ValueType','any'); param_map('st_model') = 'abz_fibs'; % Preferences param_map('fl_crra') = 1.5; param_map('fl_beta') = 0.94; % Shock Parameters param_map('it_z_n') = 15; param_map('fl_z_mu') = 0; param_map('fl_z_rho') = 0.8; param_map('fl_z_sig') = 0.2; % Borrowing % fl_default_aprime is the next period asset level % households face if they default. param_map('fl_b_bd') = -20; % borrow bound, = 0 if save only param_map('fl_default_aprime') = 0; % Borrowing Setting 1: Default Allowed, Bridge True, bl_rollover does not matter % Borrowing Setting 2: Default Allowed, Bridge False, bl_rollover matter param_map('bl_default') = true; % if borrowing is default allowed param_map('bl_bridge') = true; param_map('bl_rollover') = true; % Savings param_map('fl_a_min') = 0; % if there is minimum savings requirement param_map('fl_a_max') = 50; param_map('bl_loglin') = false; % log lin threshold structure param_map('fl_loglin_threshold') = 1; % dense points before 1 param_map('it_a_n') = 750; % Prices param_map('fl_w') = 1.28; % formal informal parameters % fl_for_br_block are the formal borrowing grid block sizes. param_map('fl_r_fsv') = 0.025; param_map('fl_r_inf') = 0.095; param_map('fl_r_inf_bridge') = 0.095; param_map('fl_r_fbr') = 0.065; param_map('bl_b_is_principle') = false; % see: ffs_for_br_block.m param_map('st_forbrblk_type') = 'seg3'; param_map('fl_forbrblk_brmost') = -19; param_map('fl_forbrblk_brleast') = -1; param_map('fl_forbrblk_gap') = -1.5; % Minimum Consumption, c_min is for default, when c < 0, replace utility % with fl_nan_replace. param_map('fl_c_min') = 0.02; param_map('fl_nan_replace') = -99999; % Solution Accuracy param_map('it_maxiter_val') = 1000; param_map('it_maxiter_dist') = 1000; param_map('it_trans_power_dist') = 1000; param_map('st_analytical_stationary_type') = 'eigenvector'; % could be eigenvector, projection, power param_map('fl_tol_val') = 10^-5; param_map('fl_tol_pol') = 10^-5; param_map('fl_tol_dist') = 10^-5; param_map('it_tol_pol_nochange') = 25; % number of iterations where policy does not change
Setting support_map container
support_map = containers.Map('KeyType','char', 'ValueType','any'); % root directory [st_root_path] = preamble(false); st_matimg_path_root = [st_root_path '/m_fibs/']; support_map('st_matimg_path_root') = st_matimg_path_root; % timer support_map('bl_time') = true; % Print Controls support_map('bl_display') = true; support_map('bl_display_dist') = false; support_map('it_display_every') = 5; % how often to print results % Profile Controls support_map('bl_profile') = false; support_map('bl_profile_dist') = false; % distribution profile support_map('st_profile_path') = [st_matimg_path_root '/m_abz_solve/profile/']; support_map('st_profile_prefix') = ['']; support_map('st_profile_name_main') = ['_default']; support_map('st_profile_suffix') = ['_p' num2str(it_subset)]; support_map('bl_post') = false; % Final Print support_map('bl_display_final') = false; % print finalized results support_map('bl_display_final_dist') = false; % print finalized results support_map('bl_display_final_dist_detail') = false; % print finalized results support_map('it_display_final_rowmax') = 100; % max row to print (states/iters) support_map('it_display_final_colmax') = 12; % max col to print (shocks) % Mat File Controls support_map('bl_mat') = false; support_map('st_mat_path') = [st_matimg_path_root '/m_abz_solve/mat/']; support_map('st_mat_prefix') = ['']; support_map('st_mat_name_main') = ['_default']; support_map('st_mat_suffix') = ['_p' num2str(it_subset)]; % Graphing Controls support_map('bl_graph') = false; support_map('bl_graph_onebyones') = true; support_map('bl_graph_val') = true; support_map('bl_graph_pol_lvl') = true; support_map('bl_graph_pol_pct') = true; support_map('bl_graph_coh_t_coh') = true; support_map('bl_graph_discrete') = true; % Formal Informal Specific Graphs support_map('bl_graph_forinf_discrete') = true; support_map('bl_graph_forinf_pol_lvl') = true; support_map('bl_graph_forinf_pol_pct') = true; % Image Saving Controls (given graphing) support_map('st_title_prefix') = ''; support_map('bl_img_save') = false; support_map('st_img_path') = [st_matimg_path_root '/m_abz_solve/img/']; support_map('st_img_prefix') = ['']; support_map('st_img_name_main') = ['_default']; support_map('st_img_suffix') = ['_p' num2str(it_subset) '.png']; % Sub-function graphing controls support_map('bl_graph_funcgrids') = false; support_map('bl_display_funcgrids') = false; support_map('bl_display_minccost') = false; support_map('bl_display_infbridge') = false;
Subset Options
- it_subset = 1 is basic invoke quick test
- it_subset = 2 is main invoke
- it_subset = 3 is profiling invoke
- it_subset = 4 is matlab publish.
if (ismember(it_subset, [1,2,3,4])) if (ismember(it_subset, [1])) % TEST quick param_map('it_a_n') = 25; param_map('it_z_n') = 3; param_map('it_maxiter_val') = 50; param_map('it_tol_pol_nochange') = 1000; support_map('bl_display') = true; support_map('it_display_every') = 1; end if (ismember(it_subset, [2, 4])) % close figures close all; % Main Run support_map('bl_time') = true; support_map('bl_display') = true; support_map('it_display_every') = 5; support_map('bl_post') = true; support_map('bl_display_final') = true; support_map('bl_mat') = false; support_map('bl_graph') = true; support_map('bl_graph_onebyones') = false; support_map('bl_img_save') = true; if (ismember(it_subset, [4])) support_map('bl_time') = false; support_map('bl_display') = false; support_map('bl_graph_onebyones') = true; support_map('bl_img_save') = false; end end if (ismember(it_subset, [3])) % Profile run support_map('bl_profile') = true; support_map('bl_display') = false; % don't print support_map('bl_time') = true; end end
Subset Options for Distribution solutions
- it_subset = 5 is basic invoke quick test
- it_subset = 6 is invoke full test
- it_subset = 7 is profiling invoke
- it_subset = 8 is matlab publish
- it_subset = 9 is invoke operational (only final stats) and coh graph
if (ismember(it_subset, [5,6,7,8,9])) if (ismember(it_subset, [5])) % TEST quick (need to enough to have distribution) param_map('it_a_n') = 100; param_map('it_z_n') = 7; param_map('it_maxiter_val') = 50; param_map('it_maxiter_dist') = 50; param_map('it_tol_pol_nochange') = 1000; support_map('bl_display_dist') = true; end if (ismember(it_subset, [6, 8, 9])) % close all close all; % Main Run support_map('bl_time') = true; support_map('bl_display') = false; support_map('bl_display_dist') = true; support_map('it_display_every') = 20; support_map('bl_post') = true; support_map('bl_display_final_dist') = true; support_map('bl_mat') = false; support_map('bl_graph') = true; support_map('bl_graph_onebyones') = false; support_map('bl_img_save') = true; % do not generate all graphs when solving for distribution support_map('bl_graph_val') = false; support_map('bl_graph_pol_lvl') = false; support_map('bl_graph_pol_pct') = false; support_map('bl_graph_coh_t_coh') = true; support_map('bl_graph_forinf_discrete') = false; support_map('bl_graph_forinf_pol_lvl') = false; support_map('bl_graph_forinf_pol_pct') = true; if (ismember(it_subset, [8, 9])) support_map('bl_time') = false; support_map('bl_display') = false; support_map('bl_display_dist') = false; support_map('bl_display_final_dist_detail') = true; support_map('bl_graph_onebyones') = true; support_map('bl_img_save') = false; if (ismember(it_subset, [9])) support_map('bl_display_final_dist_detail') = false; support_map('bl_graph_coh_t_coh') = false; support_map('bl_graph_forinf_pol_pct') = false; end end end if (ismember(it_subset, [7])) % Profile run support_map('bl_profile_dist') = true; support_map('bl_display') = false; % don't print support_map('bl_display_dist') = false; % don't print support_map('bl_time') = true; end end
Display
Display
if (bl_display_defparam) fft_container_map_display(param_map); fft_container_map_display(support_map); end
---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: PARAM_MAP ---------------------------------------- Map with properties: Count: 37 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_b_is_principle ; val = false pos = 2 ; key = bl_bridge ; val = true pos = 3 ; key = bl_default ; val = true pos = 4 ; key = bl_loglin ; val = false pos = 5 ; key = bl_rollover ; val = true pos = 6 ; key = fl_a_max ; val = 50 pos = 7 ; key = fl_a_min ; val = 0 pos = 8 ; key = fl_b_bd ; val = -20 pos = 9 ; key = fl_beta ; val = 0.94 pos = 10 ; key = fl_c_min ; val = 0.02 pos = 11 ; key = fl_crra ; val = 1.5 pos = 12 ; key = fl_default_aprime ; val = 0 pos = 13 ; key = fl_forbrblk_brleast ; val = -1 pos = 14 ; key = fl_forbrblk_brmost ; val = -19 pos = 15 ; key = fl_forbrblk_gap ; val = -1.5 pos = 16 ; key = fl_loglin_threshold ; val = 1 pos = 17 ; key = fl_nan_replace ; val = -99999 pos = 18 ; key = fl_r_fbr ; val = 0.065 pos = 19 ; key = fl_r_fsv ; val = 0.025 pos = 20 ; key = fl_r_inf ; val = 0.095 pos = 21 ; key = fl_r_inf_bridge ; val = 0.095 pos = 22 ; key = fl_tol_dist ; val = 1e-05 pos = 23 ; key = fl_tol_pol ; val = 1e-05 pos = 24 ; key = fl_tol_val ; val = 1e-05 pos = 25 ; key = fl_w ; val = 1.28 pos = 26 ; key = fl_z_mu ; val = 0 pos = 27 ; key = fl_z_rho ; val = 0.8 pos = 28 ; key = fl_z_sig ; val = 0.2 pos = 29 ; key = it_a_n ; val = 750 pos = 30 ; key = it_maxiter_dist ; val = 1000 pos = 31 ; key = it_maxiter_val ; val = 1000 pos = 32 ; key = it_tol_pol_nochange ; val = 25 pos = 33 ; key = it_trans_power_dist ; val = 1000 pos = 34 ; key = it_z_n ; val = 15 pos = 35 ; key = st_analytical_stationary_type ; val = eigenvector pos = 36 ; key = st_forbrblk_type ; val = seg3 pos = 37 ; key = st_model ; val = abz_fibs ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Scalars in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx value __ ___ ______ bl_b_is_principle 1 1 0 bl_bridge 2 2 1 bl_default 3 3 1 bl_loglin 4 4 0 bl_rollover 5 5 1 fl_a_max 6 6 50 fl_a_min 7 7 0 fl_b_bd 8 8 -20 fl_beta 9 9 0.94 fl_c_min 10 10 0.02 fl_crra 11 11 1.5 fl_default_aprime 12 12 0 fl_forbrblk_brleast 13 13 -1 fl_forbrblk_brmost 14 14 -19 fl_forbrblk_gap 15 15 -1.5 fl_loglin_threshold 16 16 1 fl_nan_replace 17 17 -99999 fl_r_fbr 18 18 0.065 fl_r_fsv 19 19 0.025 fl_r_inf 20 20 0.095 fl_r_inf_bridge 21 21 0.095 fl_tol_dist 22 22 1e-05 fl_tol_pol 23 23 1e-05 fl_tol_val 24 24 1e-05 fl_w 25 25 1.28 fl_z_mu 26 26 0 fl_z_rho 27 27 0.8 fl_z_sig 28 28 0.2 it_a_n 29 29 750 it_maxiter_dist 30 30 1000 it_maxiter_val 31 31 1000 it_tol_pol_nochange 32 32 25 it_trans_power_dist 33 33 1000 it_z_n 34 34 15 ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx _ ___ st_analytical_stationary_type 1 35 st_forbrblk_type 2 36 st_model 3 37 ---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: SUPPORT_MAP ---------------------------------------- Map with properties: Count: 42 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_display ; val = false pos = 2 ; key = bl_display_dist ; val = false pos = 3 ; key = bl_display_final ; val = true pos = 4 ; key = bl_display_final_dist ; val = false pos = 5 ; key = bl_display_final_dist_detail ; val = false pos = 6 ; key = bl_display_funcgrids ; val = false pos = 7 ; key = bl_display_infbridge ; val = false pos = 8 ; key = bl_display_minccost ; val = false pos = 9 ; key = bl_graph ; val = true pos = 10 ; key = bl_graph_coh_t_coh ; val = true pos = 11 ; key = bl_graph_discrete ; val = true pos = 12 ; key = bl_graph_forinf_discrete ; val = true pos = 13 ; key = bl_graph_forinf_pol_lvl ; val = true pos = 14 ; key = bl_graph_forinf_pol_pct ; val = true pos = 15 ; key = bl_graph_funcgrids ; val = false pos = 16 ; key = bl_graph_onebyones ; val = true pos = 17 ; key = bl_graph_pol_lvl ; val = true pos = 18 ; key = bl_graph_pol_pct ; val = true pos = 19 ; key = bl_graph_val ; val = true pos = 20 ; key = bl_img_save ; val = false pos = 21 ; key = bl_mat ; val = false pos = 22 ; key = bl_post ; val = true pos = 23 ; key = bl_profile ; val = false pos = 24 ; key = bl_profile_dist ; val = false pos = 25 ; key = bl_time ; val = false pos = 26 ; key = it_display_every ; val = 5 pos = 27 ; key = it_display_final_colmax ; val = 12 pos = 28 ; key = it_display_final_rowmax ; val = 100 pos = 29 ; key = st_img_name_main ; val = _default pos = 30 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_fibs//m_abz_solve/img/ pos = 31 ; key = st_img_prefix ; val = pos = 32 ; key = st_img_suffix ; val = _p4.png pos = 33 ; key = st_mat_name_main ; val = _default pos = 34 ; key = st_mat_path ; val = C:/Users/fan/CodeDynaAsset//m_fibs//m_abz_solve/mat/ pos = 35 ; key = st_mat_prefix ; val = pos = 36 ; key = st_mat_suffix ; val = _p4 pos = 37 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_fibs/ pos = 38 ; key = st_profile_name_main ; val = _default pos = 39 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_fibs//m_abz_solve/profile/ pos = 40 ; key = st_profile_prefix ; val = pos = 41 ; key = st_profile_suffix ; val = _p4 pos = 42 ; key = st_title_prefix ; val = ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Scalars in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx value __ ___ _____ bl_display 1 1 0 bl_display_dist 2 2 0 bl_display_final 3 3 1 bl_display_final_dist 4 4 0 bl_display_final_dist_detail 5 5 0 bl_display_funcgrids 6 6 0 bl_display_infbridge 7 7 0 bl_display_minccost 8 8 0 bl_graph 9 9 1 bl_graph_coh_t_coh 10 10 1 bl_graph_discrete 11 11 1 bl_graph_forinf_discrete 12 12 1 bl_graph_forinf_pol_lvl 13 13 1 bl_graph_forinf_pol_pct 14 14 1 bl_graph_funcgrids 15 15 0 bl_graph_onebyones 16 16 1 bl_graph_pol_lvl 17 17 1 bl_graph_pol_pct 18 18 1 bl_graph_val 19 19 1 bl_img_save 20 20 0 bl_mat 21 21 0 bl_post 22 22 1 bl_profile 23 23 0 bl_profile_dist 24 24 0 bl_time 25 25 0 it_display_every 26 26 5 it_display_final_colmax 27 27 12 it_display_final_rowmax 28 28 100 ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx __ ___ st_img_name_main 1 29 st_img_path 2 30 st_img_prefix 3 31 st_img_suffix 4 32 st_mat_name_main 5 33 st_mat_path 6 34 st_mat_prefix 7 35 st_mat_suffix 8 36 st_matimg_path_root 9 37 st_profile_name_main 10 38 st_profile_path 11 39 st_profile_prefix 12 40 st_profile_suffix 13 41 st_title_prefix 14 42
end
ans = Map with properties: Count: 37 KeyType: char ValueType: any