Test Joint Randomly (Risky + Safe Asets + Two-Step + Interpolated Distribution), Test Preference, Price and Shocks

back to Fan's Dynamic Assets Repository Table of Content. cross test: given (x,y), vary x along X, y along Y, one at a time

@include

@seealso

Contents

Simulate and Graph

Randomly draw 100 sets of parameters based on the min and max grids

% Set which to graph, simulate over which variables
ar_it_plot_sets = [1,2,101,3,4,102,5,6,103,104,105,106];
bl_simu_cross = 'r';
cl_st_param_keys = {'fl_crra','fl_beta','fl_r_save','fl_z_rho','fl_z_sig'};

% Generate Benchmark Parameters
it_param_set = 9;
[param_map, support_map] = ffs_akz_set_default_param(it_param_set);

param_map('it_st_simu_type_g_seed') = 123;
param_map('it_st_simu_type_g_simun') = 200;

support_map('bl_replacefile') = false;
support_map('bl_graph_onebyones') = true;
support_map('bl_display_graph_stats') = false;

% Generate Arrays of Parameter Values to Loop Over
it_simu_vec_len = 2;
param_tstar_map = containers.Map('KeyType','char', 'ValueType','any');
param_tstar_map('fl_crra') = linspace(1, 5, it_simu_vec_len);
param_tstar_map('fl_beta') = linspace(0.87, 0.97, it_simu_vec_len);
param_tstar_map('fl_r_save') = linspace(0, 0.06, it_simu_vec_len);
param_tstar_map('fl_z_rho') = linspace(0, 0.985, it_simu_vec_len);
param_tstar_map('fl_z_sig') = linspace(0.05, 0.65, it_simu_vec_len);

Medium Grid Simulation

it_size_type = 2;

% Simulate along parameters
ff_az_test_analyze( ...
    ar_it_plot_sets, bl_simu_cross, it_size_type, cl_st_param_keys, ...
    param_map, support_map, param_tstar_map);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: SUPPORT_MAP
----------------------------------------
  Map with properties:

        Count: 50
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = bl_display ; val = false
pos = 2 ; key = bl_display_defparam ; val = false
pos = 3 ; key = bl_display_dist ; val = false
pos = 4 ; key = bl_display_evf ; val = false
pos = 5 ; key = bl_display_final ; val = false
pos = 6 ; key = bl_display_final_dist ; val = true
pos = 7 ; key = bl_display_final_dist_detail ; val = false
pos = 8 ; key = bl_display_funcgrids ; val = false
pos = 9 ; key = bl_display_graph_stats ; val = false
pos = 10 ; key = bl_display_simu_stats ; val = true
pos = 11 ; key = bl_graph ; val = true
pos = 12 ; key = bl_graph_coh_t_coh ; val = false
pos = 13 ; key = bl_graph_evf ; val = false
pos = 14 ; key = bl_graph_funcgrids ; val = false
pos = 15 ; key = bl_graph_onebyones ; val = true
pos = 16 ; key = bl_graph_pol_lvl ; val = false
pos = 17 ; key = bl_graph_pol_pct ; val = false
pos = 18 ; key = bl_graph_val ; val = false
pos = 19 ; key = bl_img_save ; val = false
pos = 20 ; key = bl_mat ; val = false
pos = 21 ; key = bl_mat_test ; val = true
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_replacefile ; val = false
pos = 26 ; key = bl_time ; val = false
pos = 27 ; key = bl_timer ; val = true
pos = 28 ; key = it_display_every ; val = 20
pos = 29 ; key = it_display_final_colmax ; val = 12
pos = 30 ; key = it_display_final_rowmax ; val = 100
pos = 31 ; key = it_display_summmat_colmax ; val = 7
pos = 32 ; key = it_display_summmat_rowmax ; val = 7
pos = 33 ; key = st_img_name_main ; val = _default
pos = 34 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_akz//solve/img/
pos = 35 ; key = st_img_prefix ; val = 
pos = 36 ; key = st_img_suffix ; val = _p9.png
pos = 37 ; key = st_mat_name_main ; val = _default
pos = 38 ; key = st_mat_path ; val = C:/Users/fan/CodeDynaAsset//m_akz//solve/mat/
pos = 39 ; key = st_mat_prefix ; val = 
pos = 40 ; key = st_mat_suffix ; val = _p9
pos = 41 ; key = st_mat_test_name_main ; val = r
pos = 42 ; key = st_mat_test_path ; val = C:/Users/fan/CodeDynaAsset//m_akz//test/ff_iwkz_ds_vecsv/mat/
pos = 43 ; key = st_mat_test_prefix ; val = 
pos = 44 ; key = st_mat_test_suffix ; val = _g12456_cr_t2l10
pos = 45 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_akz/
pos = 46 ; key = st_profile_name_main ; val = _default
pos = 47 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_akz//solve/profile/
pos = 48 ; key = st_profile_prefix ; val = 
pos = 49 ; key = st_profile_suffix ; val = _p9
pos = 50 ; 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        0 
    bl_display_dist                  3     3        0 
    bl_display_evf                   4     4        0 
    bl_display_final                 5     5        0 
    bl_display_final_dist            6     6        1 
    bl_display_final_dist_detail     7     7        0 
    bl_display_funcgrids             8     8        0 
    bl_display_graph_stats           9     9        0 
    bl_display_simu_stats           10    10        1 
    bl_graph                        11    11        1 
    bl_graph_coh_t_coh              12    12        0 
    bl_graph_evf                    13    13        0 
    bl_graph_funcgrids              14    14        0 
    bl_graph_onebyones              15    15        1 
    bl_graph_pol_lvl                16    16        0 
    bl_graph_pol_pct                17    17        0 
    bl_graph_val                    18    18        0 
    bl_img_save                     19    19        0 
    bl_mat                          20    20        0 
    bl_mat_test                     21    21        1 
    bl_post                         22    22        1 
    bl_profile                      23    23        0 
    bl_profile_dist                 24    24        0 
    bl_replacefile                  25    25        0 
    bl_time                         26    26        0 
    bl_timer                        27    27        1 
    it_display_every                28    28       20 
    it_display_final_colmax         29    29       12 
    it_display_final_rowmax         30    30      100 
    it_display_summmat_colmax       31    31        7 
    it_display_summmat_rowmax       32    32        7 

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                             i     idx
                             __    ___

    st_img_name_main          1    33 
    st_img_path               2    34 
    st_img_prefix             3    35 
    st_img_suffix             4    36 
    st_mat_name_main          5    37 
    st_mat_path               6    38 
    st_mat_prefix             7    39 
    st_mat_suffix             8    40 
    st_mat_test_name_main     9    41 
    st_mat_test_path         10    42 
    st_mat_test_prefix       11    43 
    st_mat_test_suffix       12    44 
    st_matimg_path_root      13    45 
    st_profile_name_main     14    46 
    st_profile_path          15    47 
    st_profile_prefix        16    48 
    st_profile_suffix        17    49 
    st_title_prefix          18    50 

----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: PARAM_MAP
----------------------------------------
  Map with properties:

        Count: 42
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = ar_param_keys_idx ;rown= 1 ,coln= 5
ar_param_keys_idx :mu= 3.6 ,sd= 2.0736 ,min= 1 ,max= 6
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1       1          2          4          5          6   

pos = 2 ; key = bl_default ; val = 0
pos = 3 ; key = bl_loglin ; val = false
pos = 4 ; key = cl_st_param_keys ; val = fl_crra
pos = 5 ; key = fl_Amean ; val = 1
pos = 6 ; key = fl_a_max ; val = 50
pos = 7 ; key = fl_a_min ; val = 0
pos = 8 ; key = fl_alpha ; val = 0.36
pos = 9 ; key = fl_b_bd ; val = 0
pos = 10 ; key = fl_beta ; val = 0.94
pos = 11 ; key = fl_c_min ; val = 0.001
pos = 12 ; key = fl_coh_interp_grid_gap ; val = 0.1
pos = 13 ; key = fl_crra ; val = 1.5
pos = 14 ; key = fl_default_aprime ; val = 0
pos = 15 ; key = fl_delta ; val = 0.08
pos = 16 ; key = fl_k_min ; val = 0
pos = 17 ; key = fl_loglin_threshold ; val = 1
pos = 18 ; key = fl_nan_replace ; val = -9999
pos = 19 ; key = fl_r_borr ; val = 0.025
pos = 20 ; key = fl_r_save ; val = 0.025
pos = 21 ; key = fl_tol_dist ; val = 1e-05
pos = 22 ; key = fl_tol_pol ; val = 1e-05
pos = 23 ; key = fl_tol_val ; val = 1e-05
pos = 24 ; key = fl_w ; val = 0.44365
pos = 25 ; key = fl_w_max ; val = 50
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_ak_n ; val = 50
pos = 31 ; key = it_c_interp_grid_gap ; val = 0.0001
pos = 32 ; key = it_maxiter_dist ; val = 1000
pos = 33 ; key = it_maxiter_val ; val = 250
pos = 34 ; key = it_size_type ; val = 2
pos = 35 ; key = it_st_simu_type_g_seed ; val = 123
pos = 36 ; key = it_st_simu_type_g_simun ; val = 200
pos = 37 ; key = it_tol_pol_nochange ; val = 25
pos = 38 ; key = it_trans_power_dist ; val = 1000
pos = 39 ; key = it_w_n ; val = 50
pos = 40 ; key = it_z_n ; val = 15
pos = 41 ; key = st_analytical_stationary_type ; val = eigenvector
pos = 42 ; key = st_model ; val = akz_wkz_iwkz
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Matrix in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         i    idx    rowN    colN    mean     std      min    max
                         _    ___    ____    ____    ____    ______    ___    ___

    ar_param_keys_idx    1     1      1       5      3.6     2.0736     1      6 

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                               i     idx     value 
                               __    ___    _______

    bl_default                  1     2           0
    bl_loglin                   2     3           0
    fl_Amean                    3     5           1
    fl_a_max                    4     6          50
    fl_a_min                    5     7           0
    fl_alpha                    6     8        0.36
    fl_b_bd                     7     9           0
    fl_beta                     8    10        0.94
    fl_c_min                    9    11       0.001
    fl_coh_interp_grid_gap     10    12         0.1
    fl_crra                    11    13         1.5
    fl_default_aprime          12    14           0
    fl_delta                   13    15        0.08
    fl_k_min                   14    16           0
    fl_loglin_threshold        15    17           1
    fl_nan_replace             16    18       -9999
    fl_r_borr                  17    19       0.025
    fl_r_save                  18    20       0.025
    fl_tol_dist                19    21       1e-05
    fl_tol_pol                 20    22       1e-05
    fl_tol_val                 21    23       1e-05
    fl_w                       22    24     0.44365
    fl_w_max                   23    25          50
    fl_z_mu                    24    26           0
    fl_z_rho                   25    27         0.8
    fl_z_sig                   26    28         0.2
    it_a_n                     27    29         750
    it_ak_n                    28    30          50
    it_c_interp_grid_gap       29    31      0.0001
    it_maxiter_dist            30    32        1000
    it_maxiter_val             31    33         250
    it_size_type               32    34           2
    it_st_simu_type_g_seed     33    35         123
    it_st_simu_type_g_simun    34    36         200
    it_tol_pol_nochange        35    37          25
    it_trans_power_dist        36    38        1000
    it_w_n                     37    39          50
    it_z_n                     38    40          15

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                     i    idx
                                     _    ___

    cl_st_param_keys                 1     4 
    st_analytical_stationary_type    2    41 
    st_model                         3    42 

----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: PARAM_TSTAR_MAP
----------------------------------------
  Map with properties:

        Count: 18
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = fl_a_max ;rown= 1 ,coln= 5
fl_a_max :mu= 65 ,sd= 11.8585 ,min= 50 ,max= 80
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1      50        57.5        65        72.5        80   

pos = 2 ; key = fl_alpha ;rown= 1 ,coln= 5
fl_alpha :mu= 0.4 ,sd= 0.079057 ,min= 0.3 ,max= 0.5
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1      0.3       0.35        0.4       0.45        0.5  

pos = 3 ; key = fl_b_bd ;rown= 1 ,coln= 5
fl_b_bd :mu= -12.5 ,sd= 5.9293 ,min= -20 ,max= -5
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1      -20      -16.25      -12.5      -8.75       -5   

pos = 4 ; key = fl_beta ;rown= 1 ,coln= 2
fl_beta :mu= 0.92 ,sd= 0.070711 ,min= 0.87 ,max= 0.97
               zi_1_c1    zi_2_c2
               _______    _______

    zi_1_r1     0.87       0.97  

pos = 5 ; key = fl_c_min ;rown= 1 ,coln= 5
fl_c_min :mu= 0.0155 ,sd= 0.011463 ,min= 0.001 ,max= 0.03
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1     0.03      0.02275    0.0155     0.00825     0.001 

pos = 6 ; key = fl_crra ;rown= 1 ,coln= 2
fl_crra :mu= 3 ,sd= 2.8284 ,min= 1 ,max= 5
               zi_1_c1    zi_2_c2
               _______    _______

    zi_1_r1       1          5   

pos = 7 ; key = fl_delta ;rown= 1 ,coln= 5
fl_delta :mu= 0.08 ,sd= 0.047434 ,min= 0.02 ,max= 0.14
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1     0.02       0.05       0.08       0.11       0.14  

pos = 8 ; key = fl_r_save ;rown= 1 ,coln= 2
fl_r_save :mu= 0.03 ,sd= 0.042426 ,min= 0 ,max= 0.06
               zi_1_c1    zi_2_c2
               _______    _______

    zi_1_r1       0        0.06  

pos = 9 ; key = fl_w ;rown= 1 ,coln= 5
fl_w :mu= 1.25 ,sd= 0.11859 ,min= 1.1 ,max= 1.4
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1      1.1       1.175      1.25       1.325       1.4  

pos = 10 ; key = fl_z_r_borr_max ;rown= 1 ,coln= 5
fl_z_r_borr_max :mu= 0.1225 ,sd= 0.021741 ,min= 0.095 ,max= 0.15
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1     0.095     0.10875    0.1225     0.13625     0.15  

pos = 11 ; key = fl_z_r_borr_n ;rown= 1 ,coln= 6
fl_z_r_borr_n :mu= 15 ,sd= 7.4833 ,min= 5 ,max= 25
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5    zi_6_c6
               _______    _______    _______    _______    _______    _______

    zi_1_r1       5          9         13         17         21         25   

pos = 12 ; key = fl_z_r_borr_poiss_mean ;rown= 1 ,coln= 5
fl_z_r_borr_poiss_mean :mu= 12.5 ,sd= 5.9293 ,min= 5 ,max= 20
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1       5        8.75       12.5       16.25       20   

pos = 13 ; key = fl_z_rho ;rown= 1 ,coln= 2
fl_z_rho :mu= 0.4925 ,sd= 0.6965 ,min= 0 ,max= 0.985
               zi_1_c1    zi_2_c2
               _______    _______

    zi_1_r1       0        0.985 

pos = 14 ; key = fl_z_sig ;rown= 1 ,coln= 2
fl_z_sig :mu= 0.35 ,sd= 0.42426 ,min= 0.05 ,max= 0.65
               zi_1_c1    zi_2_c2
               _______    _______

    zi_1_r1     0.05       0.65  

pos = 15 ; key = fl_z_wage_rho ;rown= 1 ,coln= 5
fl_z_wage_rho :mu= 0.495 ,sd= 0.39133 ,min= 0 ,max= 0.99
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1       0       0.2475      0.495     0.7425      0.99  

pos = 16 ; key = fl_z_wage_sig ;rown= 1 ,coln= 5
fl_z_wage_sig :mu= 0.255 ,sd= 0.19369 ,min= 0.01 ,max= 0.5
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1     0.01      0.1325      0.255     0.3775       0.5  

pos = 17 ; key = it_a_n ;rown= 1 ,coln= 5
it_a_n :mu= 1300 ,sd= 948.6833 ,min= 100 ,max= 2500
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1      100        700       1300       1900       2500  

pos = 18 ; key = it_z_n ;rown= 1 ,coln= 5
it_z_n :mu= 15 ,sd= 7.9057 ,min= 5 ,max= 25
               zi_1_c1    zi_2_c2    zi_3_c3    zi_4_c4    zi_5_c5
               _______    _______    _______    _______    _______

    zi_1_r1       5         10         15         20         25   

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Matrix in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                              i     idx    rowN    colN     mean       std        min      max 
                              __    ___    ____    ____    ______    ________    _____    _____

    fl_a_max                   1     1      1       5          65      11.859       50       80
    fl_alpha                   2     2      1       5         0.4    0.079057      0.3      0.5
    fl_b_bd                    3     3      1       5       -12.5      5.9293      -20       -5
    fl_beta                    4     4      1       2        0.92    0.070711     0.87     0.97
    fl_c_min                   5     5      1       5      0.0155    0.011463    0.001     0.03
    fl_crra                    6     6      1       2           3      2.8284        1        5
    fl_delta                   7     7      1       5        0.08    0.047434     0.02     0.14
    fl_r_save                  8     8      1       2        0.03    0.042426        0     0.06
    fl_w                       9     9      1       5        1.25     0.11859      1.1      1.4
    fl_z_r_borr_max           10    10      1       5      0.1225    0.021741    0.095     0.15
    fl_z_r_borr_n             11    11      1       6          15      7.4833        5       25
    fl_z_r_borr_poiss_mean    12    12      1       5        12.5      5.9293        5       20
    fl_z_rho                  13    13      1       2      0.4925      0.6965        0    0.985
    fl_z_sig                  14    14      1       2        0.35     0.42426     0.05     0.65
    fl_z_wage_rho             15    15      1       5       0.495     0.39133        0     0.99
    fl_z_wage_sig             16    16      1       5       0.255     0.19369     0.01      0.5
    it_a_n                    17    17      1       5        1300      948.68      100     2500
    it_z_n                    18    18      1       5          15      7.9057        5       25