Set Model Parameters (Interpolated + Percentage + Risky + Safe Asset + Save + Borrow + R Shock)
back to Fan's Dynamic Assets Repository Table of Content.
Contents
- FFS_IPKBZR_SET_DEFAULT_PARAM setting model default parameters
- Default
- 1. Initiate Param_map
- 2a. Borrowing Default Parameters
- 2b. Set Shock 1 Borrowing Interest Rate Parameters
- 2c. Set Shock 2 Productivity Shock Parameters
- 2d. Set Overall Shock Grid Count
- Setting support_map container
- Subset Options
- Subset Options for Distribution solutions
- Display New Parameters
- 3. Merge Parameters Import
- Display All Parameters
function [param_map, support_map] = ffs_ipwkbzr_set_default_param(varargin)
FFS_IPKBZR_SET_DEFAULT_PARAM setting model default parameters
Define model parameters, similar to ffs_akz_set_default_param see that file for descriptions.
Several changes here: 1, inclusion of percentage based choice grids
@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_ipwkbzr_set_default_param(it_param_set);
@include
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{:};
1. Initiate Param_map
param_map = containers.Map('KeyType','char', 'ValueType','any'); % model name param_map('st_model') = 'ipwkbzr'; % v(coh, z) interpolation method param_map('st_v_coh_z_interp_method') = 'method_cell';
2a. Borrowing Default Parameters
param_map('fl_b_bd') = -20; param_map('fl_w_min') = param_map('fl_b_bd'); param_map('fl_w_max') = 50; param_map('fl_k_max') = (param_map('fl_w_max') - param_map('fl_b_bd')); param_map('fl_c_min') = 0.02; param_map('fl_default_wprime') = 0; % wprime not a prime param_map('bl_default') = true; % if borrowing is default allowed
2b. Set Shock 1 Borrowing Interest Rate Parameters
See fft_gen_discrete_var for how these parameters will be used to generate a discrete random variable for the interest rate.
param_map('st_z_r_borr_drv_ele_type') = 'unif'; param_map('st_z_r_borr_drv_prb_type') = 'poiss'; param_map('fl_z_r_borr_poiss_mean') = 20; param_map('fl_z_r_borr_max') = 0.095; param_map('fl_z_r_borr_min') = 0.025; param_map('fl_z_r_borr_n') = 5; % param_map('fl_z_r_borr_max') = 0.095; % param_map('fl_z_r_borr_min') = 0.095; % param_map('fl_z_r_borr_n') = 1;
2c. Set Shock 2 Productivity Shock Parameters
% Production Function % Productivity Shock Parameters param_map('it_z_wage_n') = 11; param_map('fl_z_wage_mu') = 0; param_map('fl_z_wage_rho') = 0.8; param_map('fl_z_wage_sig') = 0.2;
2d. Set Overall Shock Grid Count
param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n');
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_ipwkbzr/']; support_map('st_matimg_path_root') = st_matimg_path_root; support_map('st_profile_path') = [st_matimg_path_root '/solve/profile/']; support_map('st_mat_path') = [st_matimg_path_root '/solve/mat/']; support_map('st_img_path') = [st_matimg_path_root '/solve/img/']; support_map('st_mat_test_path') = [st_matimg_path_root '/test/ff_ipwkbzr_ds_vecsv/mat/'];
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.
% close figures close all; if (ismember(it_subset, [3])) % Profile run elseif (ismember(it_subset, [1,2,4])) % Main Run if (ismember(it_subset, [1])) % TEST quick param_map('it_z_wage_n') = 5; param_map('fl_z_r_borr_n') = 3; param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n'); end if (ismember(it_subset, [4])) 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, [7])) % Profile run elseif (ismember(it_subset, [5,6,8,9])) % Main Run if (ismember(it_subset, [5])) % TEST quick (need to enough to have distribution) param_map('it_z_wage_n') = 5; param_map('fl_z_r_borr_n') = 3; param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n'); end if (ismember(it_subset, [8, 9])) if (ismember(it_subset, [9])) % quietly turn off all graphs, only tables end end end
Display New Parameters
if (bl_display_defparam) disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('Display Parameters Specific to IPWKBZR') disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); fft_container_map_display(param_map); fft_container_map_display(support_map); end
---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Display Parameters Specific to IPWKBZR xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: PARAM_MAP ---------------------------------------- Map with properties: Count: 20 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_default ; val = true pos = 2 ; key = fl_b_bd ; val = -20 pos = 3 ; key = fl_c_min ; val = 0.02 pos = 4 ; key = fl_default_wprime ; val = 0 pos = 5 ; key = fl_k_max ; val = 70 pos = 6 ; key = fl_w_max ; val = 50 pos = 7 ; key = fl_w_min ; val = -20 pos = 8 ; key = fl_z_r_borr_max ; val = 0.095 pos = 9 ; key = fl_z_r_borr_min ; val = 0.025 pos = 10 ; key = fl_z_r_borr_n ; val = 5 pos = 11 ; key = fl_z_r_borr_poiss_mean ; val = 20 pos = 12 ; key = fl_z_wage_mu ; val = 0 pos = 13 ; key = fl_z_wage_rho ; val = 0.8 pos = 14 ; key = fl_z_wage_sig ; val = 0.2 pos = 15 ; key = it_z_n ; val = 55 pos = 16 ; key = it_z_wage_n ; val = 11 pos = 17 ; key = st_model ; val = ipwkbzr pos = 18 ; key = st_v_coh_z_interp_method ; val = method_cell pos = 19 ; key = st_z_r_borr_drv_ele_type ; val = unif pos = 20 ; key = st_z_r_borr_drv_prb_type ; val = poiss ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Scalars in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx value __ ___ _____ bl_default 1 1 1 fl_b_bd 2 2 -20 fl_c_min 3 3 0.02 fl_default_wprime 4 4 0 fl_k_max 5 5 70 fl_w_max 6 6 50 fl_w_min 7 7 -20 fl_z_r_borr_max 8 8 0.095 fl_z_r_borr_min 9 9 0.025 fl_z_r_borr_n 10 10 5 fl_z_r_borr_poiss_mean 11 11 20 fl_z_wage_mu 12 12 0 fl_z_wage_rho 13 13 0.8 fl_z_wage_sig 14 14 0.2 it_z_n 15 15 55 it_z_wage_n 16 16 11 ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx _ ___ st_model 1 17 st_v_coh_z_interp_method 2 18 st_z_r_borr_drv_ele_type 3 19 st_z_r_borr_drv_prb_type 4 20 ---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: SUPPORT_MAP ---------------------------------------- Map with properties: Count: 5 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/img/ pos = 2 ; key = st_mat_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/mat/ pos = 3 ; key = st_mat_test_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//test/ff_ipwkbzr_ds_vecsv/mat/ pos = 4 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr/ pos = 5 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/profile/ ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx _ ___ st_img_path 1 1 st_mat_path 2 2 st_mat_test_path 3 3 st_matimg_path_root 4 4 st_profile_path 5 5
3. Merge Parameters Import
[param_map_ipwkbz, support_map_ipwkbz] = ffs_ipwkz_set_default_param(it_subset); % Remove Keys not Relevant for the Interest Rate Shock Model cl_st_ipwkbz_keysdrop = {'fl_z_rho', 'fl_z_mu', 'fl_z_sig', ... 'fl_r_borr'}; remove(param_map_ipwkbz, cl_st_ipwkbz_keysdrop); % Merge param_map = [param_map_ipwkbz; param_map]; support_map = [support_map_ipwkbz; support_map]; % if (bl_display_defparam) % % disp('----------------------------------------'); % disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); % disp('Display Parameters imported from IPWKBZ') % disp('Dropped Keys:') % disp(cl_st_ipwkbz_keysdrop) % disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); % % fft_container_map_display(param_map_ipwkbz); % fft_container_map_display(support_map_ipwkbz); % end
Display All Parameters
if (bl_display_defparam) disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('Display All Parameters with IPWKBZR overriding IPWKBZR') disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); fft_container_map_display(param_map); fft_container_map_display(support_map); end
---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Display All Parameters with IPWKBZR overriding IPWKBZR xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: PARAM_MAP ---------------------------------------- Map with properties: Count: 41 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_default ; val = true pos = 2 ; key = fl_Amean ; val = 1 pos = 3 ; key = fl_alpha ; val = 0.36 pos = 4 ; key = fl_b_bd ; val = -20 pos = 5 ; key = fl_beta ; val = 0.94 pos = 6 ; key = fl_c_min ; val = 0.02 pos = 7 ; key = fl_coh_interp_grid_gap ; val = 0.1 pos = 8 ; key = fl_crra ; val = 1.5 pos = 9 ; key = fl_default_wprime ; val = 0 pos = 10 ; key = fl_delta ; val = 0.08 pos = 11 ; key = fl_k_max ; val = 70 pos = 12 ; key = fl_k_min ; val = 0 pos = 13 ; key = fl_nan_replace ; val = -9999 pos = 14 ; key = fl_r_save ; val = 0.025 pos = 15 ; key = fl_tol_dist ; val = 1e-05 pos = 16 ; key = fl_tol_pol ; val = 1e-05 pos = 17 ; key = fl_tol_val ; val = 1e-05 pos = 18 ; key = fl_w ; val = 0.44365 pos = 19 ; key = fl_w_interp_grid_gap ; val = 0.1 pos = 20 ; key = fl_w_max ; val = 50 pos = 21 ; key = fl_w_min ; val = -20 pos = 22 ; key = fl_z_r_borr_max ; val = 0.095 pos = 23 ; key = fl_z_r_borr_min ; val = 0.025 pos = 24 ; key = fl_z_r_borr_n ; val = 5 pos = 25 ; key = fl_z_r_borr_poiss_mean ; val = 20 pos = 26 ; key = fl_z_wage_mu ; val = 0 pos = 27 ; key = fl_z_wage_rho ; val = 0.8 pos = 28 ; key = fl_z_wage_sig ; val = 0.2 pos = 29 ; key = it_ak_perc_n ; val = 50 pos = 30 ; key = it_c_interp_grid_gap ; val = 0.0001 pos = 31 ; key = it_maxiter_dist ; val = 1000 pos = 32 ; key = it_maxiter_val ; val = 250 pos = 33 ; key = it_tol_pol_nochange ; val = 25 pos = 34 ; key = it_w_perc_n ; val = 50 pos = 35 ; key = it_z_n ; val = 55 pos = 36 ; key = it_z_wage_n ; val = 11 pos = 37 ; key = st_analytical_stationary_type ; val = eigenvector pos = 38 ; key = st_model ; val = ipwkbzr pos = 39 ; key = st_v_coh_z_interp_method ; val = method_cell pos = 40 ; key = st_z_r_borr_drv_ele_type ; val = unif pos = 41 ; key = st_z_r_borr_drv_prb_type ; val = poiss ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Scalars in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx value __ ___ _______ bl_default 1 1 1 fl_Amean 2 2 1 fl_alpha 3 3 0.36 fl_b_bd 4 4 -20 fl_beta 5 5 0.94 fl_c_min 6 6 0.02 fl_coh_interp_grid_gap 7 7 0.1 fl_crra 8 8 1.5 fl_default_wprime 9 9 0 fl_delta 10 10 0.08 fl_k_max 11 11 70 fl_k_min 12 12 0 fl_nan_replace 13 13 -9999 fl_r_save 14 14 0.025 fl_tol_dist 15 15 1e-05 fl_tol_pol 16 16 1e-05 fl_tol_val 17 17 1e-05 fl_w 18 18 0.44365 fl_w_interp_grid_gap 19 19 0.1 fl_w_max 20 20 50 fl_w_min 21 21 -20 fl_z_r_borr_max 22 22 0.095 fl_z_r_borr_min 23 23 0.025 fl_z_r_borr_n 24 24 5 fl_z_r_borr_poiss_mean 25 25 20 fl_z_wage_mu 26 26 0 fl_z_wage_rho 27 27 0.8 fl_z_wage_sig 28 28 0.2 it_ak_perc_n 29 29 50 it_c_interp_grid_gap 30 30 0.0001 it_maxiter_dist 31 31 1000 it_maxiter_val 32 32 250 it_tol_pol_nochange 33 33 25 it_w_perc_n 34 34 50 it_z_n 35 35 55 it_z_wage_n 36 36 11 ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx _ ___ st_analytical_stationary_type 1 37 st_model 2 38 st_v_coh_z_interp_method 3 39 st_z_r_borr_drv_ele_type 4 40 st_z_r_borr_drv_prb_type 5 41 ---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: SUPPORT_MAP ---------------------------------------- Map with properties: Count: 43 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_display ; val = false pos = 2 ; key = bl_display_defparam ; val = true pos = 3 ; key = bl_display_dist ; val = false pos = 4 ; key = bl_display_evf ; val = false pos = 5 ; key = bl_display_final ; val = true pos = 6 ; key = bl_display_final_dist ; val = false pos = 7 ; key = bl_display_final_dist_detail ; val = false pos = 8 ; key = bl_display_funcgrids ; val = false pos = 9 ; key = bl_graph ; val = true pos = 10 ; key = bl_graph_coh_t_coh ; val = true pos = 11 ; key = bl_graph_evf ; val = false pos = 12 ; key = bl_graph_funcgrids ; val = false pos = 13 ; key = bl_graph_funcgrids_detail ; val = false pos = 14 ; key = bl_graph_onebyones ; val = true pos = 15 ; key = bl_graph_pol_lvl ; val = true pos = 16 ; key = bl_graph_pol_pct ; val = true pos = 17 ; key = bl_graph_val ; val = true pos = 18 ; key = bl_img_save ; val = false pos = 19 ; key = bl_mat ; val = false pos = 20 ; key = bl_post ; val = true pos = 21 ; key = bl_profile ; val = false pos = 22 ; key = bl_profile_dist ; val = false pos = 23 ; key = bl_time ; val = false pos = 24 ; key = it_display_every ; val = 5 pos = 25 ; key = it_display_final_colmax ; val = 12 pos = 26 ; key = it_display_final_rowmax ; val = 100 pos = 27 ; key = it_display_summmat_colmax ; val = 7 pos = 28 ; key = it_display_summmat_rowmax ; val = 7 pos = 29 ; key = st_img_name_main ; val = _default pos = 30 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//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_ipwkbzr//solve/mat/ pos = 35 ; key = st_mat_prefix ; val = pos = 36 ; key = st_mat_suffix ; val = _p4 pos = 37 ; key = st_mat_test_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//test/ff_ipwkbzr_ds_vecsv/mat/ pos = 38 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr/ pos = 39 ; key = st_profile_name_main ; val = _default pos = 40 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/profile/ pos = 41 ; key = st_profile_prefix ; val = pos = 42 ; key = st_profile_suffix ; val = _p4 pos = 43 ; 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_defparam 2 2 1 bl_display_dist 3 3 0 bl_display_evf 4 4 0 bl_display_final 5 5 1 bl_display_final_dist 6 6 0 bl_display_final_dist_detail 7 7 0 bl_display_funcgrids 8 8 0 bl_graph 9 9 1 bl_graph_coh_t_coh 10 10 1 bl_graph_evf 11 11 0 bl_graph_funcgrids 12 12 0 bl_graph_funcgrids_detail 13 13 0 bl_graph_onebyones 14 14 1 bl_graph_pol_lvl 15 15 1 bl_graph_pol_pct 16 16 1 bl_graph_val 17 17 1 bl_img_save 18 18 0 bl_mat 19 19 0 bl_post 20 20 1 bl_profile 21 21 0 bl_profile_dist 22 22 0 bl_time 23 23 0 it_display_every 24 24 5 it_display_final_colmax 25 25 12 it_display_final_rowmax 26 26 100 it_display_summmat_colmax 27 27 7 it_display_summmat_rowmax 28 28 7 ---------------------------------------- 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_mat_test_path 9 37 st_matimg_path_root 10 38 st_profile_name_main 11 39 st_profile_path 12 40 st_profile_prefix 13 41 st_profile_suffix 14 42 st_title_prefix 15 43
end
ans = Map with properties: Count: 41 KeyType: char ValueType: any