Set Model Parameters
back to Fan's Dynamic Assets Repository Table of Content.
Contents
- FFS_AZ_SET_DEFAULT_PARAM setting model default parameters
- Default
- 1. Initiate Param_map
- 2. Set Asset Grid Parameters
- 3. Set Interest Rates Parameters
- 4. Set Shock Wage Shock Parameters
- 5. Set Solution Control Parameters
- 6. Setting support_map container
- Subset Options for Value Function Solutions
- Subset Options for Distribution solutions
- Display
function [param_map, support_map] = ffs_az_set_default_param(varargin)
FFS_AZ_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_az_set_default_param(it_param_set);
@seealso
- initialize paramters az: ffs_az_set_default_param
- initialize paramters abz: ffs_abz_set_default_param
- initialize functions: ffs_abz_set_functions
- set asset grid: ffs_abz_gen_borrsave_grid
- set shock borrow rate: fft_gen_discrete_var
- set shock wage: ffto_gen_tauchen_jhl
- gateway function processing grid, paramters, functions: ffs_abz_get_funcgrid
Default
it_subset = 0; 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') = 'az'; % Preferences param_map('fl_crra') = 1.5; param_map('fl_beta') = 0.94; param_map('fl_nan_replace') = -9999;
2. Set Asset Grid Parameters
see ffs_abz_gen_borrsave_grid for how these borrowing/saving grid parameters will be used.
% Choice vector param_map('fl_b_bd') = 0; % borrow bound, = 0 if save only 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;
3. Set Interest Rates Parameters
param_map('fl_r_save') = 0.025;
4. Set Shock Wage Shock Parameters
% 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;
5. Set Solution Control Parameters
% Solution Accuracy param_map('it_maxiter_val') = 1000; param_map('it_maxiter_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_trans_power_dist') = 1000; param_map('it_tol_pol_nochange') = 25; % number of iterations where policy does not change
6. Setting support_map container
Sets up support container map. One important input is st_root_path, which is obtained from the preamble file. If input for file is false, will not reload all path. Loading path takes several seconds of time.
support_map = containers.Map('KeyType','char', 'ValueType','any'); % root directory [st_root_path] = preamble(false); st_matimg_path_root = [st_root_path '/m_az/']; support_map('st_matimg_path_root') = st_matimg_path_root; % timer support_map('bl_time') = true; % Print Controls support_map('bl_display_defparam') = false; support_map('bl_display') = true; support_map('bl_display_dist') = false; support_map('it_display_every') = 5; % how often to print results vf + dist % Profile Controls support_map('bl_profile') = false; % value function profile support_map('bl_profile_dist') = false; % distribution profile support_map('st_profile_path') = [st_matimg_path_root '/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 Value Function 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) it_display_summmat_rowmax = 5; it_display_summmat_colmax = 5; support_map('it_display_summmat_rowmax') = it_display_summmat_rowmax; support_map('it_display_summmat_colmax') = it_display_summmat_colmax; % Mat File Controls support_map('bl_mat') = false; support_map('st_mat_path') = [st_matimg_path_root '/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; % 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 '/solve/img/']; support_map('st_img_prefix') = ['']; support_map('st_img_name_main') = ['_default']; support_map('st_img_suffix') = ['_p' num2str(it_subset) '.png']; % Testing Path support_map('st_mat_test_path') = [st_matimg_path_root '/test/ff_az_ds_vecsv/mat/']; % Sub-function graphing controls support_map('bl_graph_funcgrids') = false; support_map('bl_display_funcgrids') = false; support_map('bl_display_defparam') = false;
Subset Options for Value Function Solutions
- 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') = 5; 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 all close all; % Main Run support_map('bl_time') = true; support_map('bl_display_defparam') = 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') = 50; 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_defparam') = 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; 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])) % quietly turn off all graphs, only tables support_map('bl_display_final_dist_detail') = false; support_map('bl_display_defparam') = false; support_map('bl_graph_coh_t_coh') = 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
if (bl_display_defparam) fft_container_map_display(param_map, it_display_summmat_rowmax, it_display_summmat_colmax); fft_container_map_display(support_map, it_display_summmat_rowmax, it_display_summmat_colmax); end
---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: PARAM_MAP ---------------------------------------- Map with properties: Count: 24 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_loglin ; val = false pos = 2 ; key = fl_a_max ; val = 50 pos = 3 ; key = fl_a_min ; val = 0 pos = 4 ; key = fl_b_bd ; val = 0 pos = 5 ; key = fl_beta ; val = 0.94 pos = 6 ; key = fl_crra ; val = 1.5 pos = 7 ; key = fl_loglin_threshold ; val = 1 pos = 8 ; key = fl_nan_replace ; val = -9999 pos = 9 ; key = fl_r_save ; val = 0.025 pos = 10 ; key = fl_tol_dist ; val = 1e-05 pos = 11 ; key = fl_tol_pol ; val = 1e-05 pos = 12 ; key = fl_tol_val ; val = 1e-05 pos = 13 ; key = fl_w ; val = 1.28 pos = 14 ; key = fl_z_mu ; val = 0 pos = 15 ; key = fl_z_rho ; val = 0.8 pos = 16 ; key = fl_z_sig ; val = 0.2 pos = 17 ; key = it_a_n ; val = 750 pos = 18 ; key = it_maxiter_dist ; val = 1000 pos = 19 ; key = it_maxiter_val ; val = 1000 pos = 20 ; key = it_tol_pol_nochange ; val = 25 pos = 21 ; key = it_trans_power_dist ; val = 1000 pos = 22 ; key = it_z_n ; val = 15 pos = 23 ; key = st_analytical_stationary_type ; val = eigenvector pos = 24 ; key = st_model ; val = az ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Scalars in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx value __ ___ _____ bl_loglin 1 1 0 fl_a_max 2 2 50 fl_a_min 3 3 0 fl_b_bd 4 4 0 fl_beta 5 5 0.94 fl_crra 6 6 1.5 fl_loglin_threshold 7 7 1 fl_nan_replace 8 8 -9999 fl_r_save 9 9 0.025 fl_tol_dist 10 10 1e-05 fl_tol_pol 11 11 1e-05 fl_tol_val 12 12 1e-05 fl_w 13 13 1.28 fl_z_mu 14 14 0 fl_z_rho 15 15 0.8 fl_z_sig 16 16 0.2 it_a_n 17 17 750 it_maxiter_dist 18 18 1000 it_maxiter_val 19 19 1000 it_tol_pol_nochange 20 20 25 it_trans_power_dist 21 21 1000 it_z_n 22 22 15 ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx _ ___ st_analytical_stationary_type 1 23 st_model 2 24 ---------------------------------------- ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Begin: Show all key and value pairs from container CONTAINER NAME: SUPPORT_MAP ---------------------------------------- Map with properties: Count: 40 KeyType: char ValueType: any xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ---------------------------------------- ---------------------------------------- pos = 1 ; key = bl_display ; val = true pos = 2 ; key = bl_display_defparam ; val = false pos = 3 ; key = bl_display_dist ; val = false pos = 4 ; key = bl_display_final ; val = false pos = 5 ; key = bl_display_final_dist ; val = false pos = 6 ; key = bl_display_final_dist_detail ; val = false pos = 7 ; key = bl_display_funcgrids ; val = false pos = 8 ; key = bl_graph ; val = false pos = 9 ; key = bl_graph_coh_t_coh ; val = true pos = 10 ; key = bl_graph_funcgrids ; val = false pos = 11 ; key = bl_graph_onebyones ; val = true pos = 12 ; key = bl_graph_pol_lvl ; val = true pos = 13 ; key = bl_graph_pol_pct ; val = true pos = 14 ; key = bl_graph_val ; val = true pos = 15 ; key = bl_img_save ; val = false pos = 16 ; key = bl_mat ; val = false pos = 17 ; key = bl_post ; val = false pos = 18 ; key = bl_profile ; val = false pos = 19 ; key = bl_profile_dist ; val = false pos = 20 ; key = bl_time ; val = true pos = 21 ; key = it_display_every ; val = 5 pos = 22 ; key = it_display_final_colmax ; val = 12 pos = 23 ; key = it_display_final_rowmax ; val = 100 pos = 24 ; key = it_display_summmat_colmax ; val = 5 pos = 25 ; key = it_display_summmat_rowmax ; val = 5 pos = 26 ; key = st_img_name_main ; val = _default pos = 27 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_az//solve/img/ pos = 28 ; key = st_img_prefix ; val = pos = 29 ; key = st_img_suffix ; val = _p0.png pos = 30 ; key = st_mat_name_main ; val = _default pos = 31 ; key = st_mat_path ; val = C:/Users/fan/CodeDynaAsset//m_az//solve/mat/ pos = 32 ; key = st_mat_prefix ; val = pos = 33 ; key = st_mat_suffix ; val = _p0 pos = 34 ; key = st_mat_test_path ; val = C:/Users/fan/CodeDynaAsset//m_az//test/ff_az_ds_vecsv/mat/ pos = 35 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_az/ pos = 36 ; key = st_profile_name_main ; val = _default pos = 37 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_az//solve/profile/ pos = 38 ; key = st_profile_prefix ; val = pos = 39 ; key = st_profile_suffix ; val = _p0 pos = 40 ; key = st_title_prefix ; val = ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Scalars in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx value __ ___ _____ bl_display 1 1 1 bl_display_defparam 2 2 0 bl_display_dist 3 3 0 bl_display_final 4 4 0 bl_display_final_dist 5 5 0 bl_display_final_dist_detail 6 6 0 bl_display_funcgrids 7 7 0 bl_graph 8 8 0 bl_graph_coh_t_coh 9 9 1 bl_graph_funcgrids 10 10 0 bl_graph_onebyones 11 11 1 bl_graph_pol_lvl 12 12 1 bl_graph_pol_pct 13 13 1 bl_graph_val 14 14 1 bl_img_save 15 15 0 bl_mat 16 16 0 bl_post 17 17 0 bl_profile 18 18 0 bl_profile_dist 19 19 0 bl_time 20 20 1 it_display_every 21 21 5 it_display_final_colmax 22 22 12 it_display_final_rowmax 23 23 100 it_display_summmat_colmax 24 24 5 it_display_summmat_rowmax 25 25 5 ---------------------------------------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Strings in Container and Sizes and Basic Statistics xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx i idx __ ___ st_img_name_main 1 26 st_img_path 2 27 st_img_prefix 3 28 st_img_suffix 4 29 st_mat_name_main 5 30 st_mat_path 6 31 st_mat_prefix 7 32 st_mat_suffix 8 33 st_mat_test_path 9 34 st_matimg_path_root 10 35 st_profile_name_main 11 36 st_profile_path 12 37 st_profile_prefix 13 38 st_profile_suffix 14 39 st_title_prefix 15 40
end
ans = Map with properties: Count: 24 KeyType: char ValueType: any