Test Borrow Joint Randomly Default (Risky + Safe Asset + Save + Borr + R Shock + Interpolated-Percentage), 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

Compare against fsi_iwkz_ds_vecsv_joint_rand from iwkz. Here, we use ipwkz.

@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,106,10];
bl_simu_cross = 'r';
cl_st_param_keys = {'fl_z_r_borr_poiss_mean', 'fl_z_r_borr_max', 'fl_b_bd', 'fl_c_min', 'fl_z_r_borr_n'};

% Generate Benchmark Parameters
it_param_set = 9;
[param_map, support_map] = ffs_ipwkbzr_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_z_r_borr_poiss_mean') = linspace(2, 10, it_simu_vec_len);
param_tstar_map('fl_z_r_borr_max') = linspace(0.095, 0.150, it_simu_vec_len);
param_tstar_map('fl_b_bd') = linspace(-20, -5, it_simu_vec_len);
param_tstar_map('fl_c_min') = linspace(0.03, 0.001, it_simu_vec_len);
param_tstar_map('fl_z_r_borr_n') = 3:1:(3+15-1);

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);

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

        Count: 51
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 34 ; key = st_img_name_main ; val = _default
pos = 35 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/img/
pos = 36 ; key = st_img_prefix ; val = 
pos = 37 ; key = st_img_suffix ; val = _p9.png
pos = 38 ; key = st_mat_name_main ; val = _default
pos = 39 ; key = st_mat_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/mat/
pos = 40 ; key = st_mat_prefix ; val = 
pos = 41 ; key = st_mat_suffix ; val = _p9
pos = 42 ; key = st_mat_test_name_main ; val = r
pos = 43 ; key = st_mat_test_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//test/ff_ipwkbzr_ds_vecsv/mat/
pos = 44 ; key = st_mat_test_prefix ; val = 
pos = 45 ; key = st_mat_test_suffix ; val = _g1011121314_cr_t2l23
pos = 46 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr/
pos = 47 ; key = st_profile_name_main ; val = _default
pos = 48 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_ipwkbzr//solve/profile/
pos = 49 ; key = st_profile_prefix ; val = 
pos = 50 ; key = st_profile_suffix ; val = _p9
pos = 51 ; 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        0 
    bl_graph_coh_t_coh              12    12        0 
    bl_graph_evf                    13    13        0 
    bl_graph_funcgrids              14    14        0 
    bl_graph_funcgrids_detail       15    15        0 
    bl_graph_onebyones              16    16        1 
    bl_graph_pol_lvl                17    17        0 
    bl_graph_pol_pct                18    18        0 
    bl_graph_val                    19    19        0 
    bl_img_save                     20    20        0 
    bl_mat                          21    21        0 
    bl_mat_test                     22    22        1 
    bl_post                         23    23        1 
    bl_profile                      24    24        0 
    bl_profile_dist                 25    25        0 
    bl_replacefile                  26    26        0 
    bl_time                         27    27        1 
    bl_timer                        28    28        1 
    it_display_every                29    29       20 
    it_display_final_colmax         30    30       12 
    it_display_final_rowmax         31    31      100 
    it_display_summmat_colmax       32    32        7 
    it_display_summmat_rowmax       33    33        7 

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

        Count: 55
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 4 ; key = cl_st_param_keys ; val = fl_z_r_borr_poiss_mean
pos = 51 ; key = st_analytical_stationary_type ; val = eigenvector
pos = 52 ; key = st_model ; val = ipwkbzr
pos = 53 ; key = st_v_coh_z_interp_method ; val = method_cell
pos = 54 ; key = st_z_r_borr_drv_ele_type ; val = unif
pos = 55 ; key = st_z_r_borr_drv_prb_type ; val = poiss
----------------------------------------
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       12     1.5811    10     14 

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

    bl_default                  1     2           1
    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         -20
    fl_beta                     8    10        0.94
    fl_c_min                    9    11        0.02
    fl_coh_interp_grid_gap     10    12         0.1
    fl_crra                    11    13         1.5
    fl_default_wprime          12    14           0
    fl_delta                   13    15        0.08
    fl_k_max                   14    16          70
    fl_k_min                   15    17           0
    fl_loglin_threshold        16    18           1
    fl_nan_replace             17    19       -9999
    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_interp_grid_gap       23    25         0.1
    fl_w_max                   24    26          50
    fl_w_min                   25    27         -20
    fl_z_mu                    26    28           0
    fl_z_r_borr_max            27    29       0.095
    fl_z_r_borr_min            28    30       0.025
    fl_z_r_borr_n              29    31           5
    fl_z_r_borr_poiss_mean     30    32          20
    fl_z_rho                   31    33         0.8
    fl_z_sig                   32    34         0.2
    fl_z_wage_mu               33    35           0
    fl_z_wage_rho              34    36         0.8
    fl_z_wage_sig              35    37         0.2
    it_a_n                     36    38         750
    it_ak_perc_n               37    39          50
    it_c_interp_grid_gap       38    40      0.0001
    it_maxiter_dist            39    41        1000
    it_maxiter_val             40    42         250
    it_size_type               41    43           2
    it_st_simu_type_g_seed     42    44         123
    it_st_simu_type_g_simun    43    45         200
    it_tol_pol_nochange        44    46          25
    it_trans_power_dist        45    47        1000
    it_w_perc_n                46    48          50
    it_z_n                     47    49          55
    it_z_wage_n                48    50          11

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

        Count: 19
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
----------------------------------------
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        2      -12.5      10.607      -20      -5
    fl_beta                    4     4      1       15       0.92    0.031944     0.87    0.97
    fl_c_min                   5     5      1        2     0.0155    0.020506    0.001    0.03
    fl_crra                    6     6      1       15          3      1.2778        1       5
    fl_delta                   7     7      1        5       0.08    0.047434     0.02    0.14
    fl_r_borr                  8     8      1        5      0.125    0.098821        0    0.25
    fl_r_save                  9     9      1        5      0.025    0.011859     0.01    0.04
    fl_w                      10    10      1        5       1.25     0.11859      1.1     1.4
    fl_z_r_borr_max           11    11      1        2     0.1225    0.038891    0.095    0.15
    fl_z_r_borr_n             12    12      1       15         10      4.4721        3      17
    fl_z_r_borr_poiss_mean    13    13      1        2          6      5.6569        2      10
    fl_z_rho                  14    14      1        5      0.495     0.39133        0    0.99
    fl_z_sig                  15    15      1        5      0.255     0.19369     0.01     0.5
    fl_z_wage_rho             16    16      1        5      0.495     0.39133        0    0.99
    fl_z_wage_sig             17    17      1        5      0.255     0.19369     0.01     0.5
    it_a_n                    18    18      1        5       1300      948.68      100    2500
    it_z_n                    19    19      1        5         15      7.9057        5      25

---------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxx
  Columns 1 through 3

    'Vary These Param...'    'fl_z_r_borr_pois...'    'fl_z_r_borr_max'

  Columns 4 through 6

    'fl_b_bd'    'fl_c_min'    'fl_z_r_borr_n'

xxxxxxxxxxxxxxxxxxxxxxxxxxx
---------------------------
            fl_z_r_borr_poiss_mean    fl_z_r_borr_max    fl_b_bd    fl_c_min     fl_z_r_borr_n
            ______________________    _______________    _______    _________    _____________

    j=1             5.4095                0.10819        -11.109    0.0052876       4.1277    
    j=2             5.1016                0.13209        -16.073     0.016185       8.7197    
    j=3             6.5086                0.14375        -16.539     0.024518       12.616    
    j=4              4.054                0.13754        -12.499     0.026057       11.564    
    j=5             3.8951                0.13882        -11.284    0.0053413       12.858    
    j=6             9.9532                0.14809        -6.0295    0.0049194       16.605    
    j=7              3.525                0.13965        -12.511     0.019122       7.9446    
    j=8             9.0171                0.12372        -16.084     0.022174       12.812    
    j=9             2.5915                0.13859         -17.47    0.0017886       14.956    
    j=10            4.7774                0.12673        -12.281    0.0025887       3.9046    

             fl_z_r_borr_poiss_mean    fl_z_r_borr_max    fl_b_bd    fl_c_min     fl_z_r_borr_n
             ______________________    _______________    _______    _________    _____________

    j=191            8.3281                0.14328        -13.993     0.025486       14.303    
    j=192            2.8638                0.11171        -9.5589    0.0071352       6.2761    
    j=193            5.2251                0.11435        -7.2883     0.001521       12.724    
    j=194            2.2177                0.10707        -15.265     0.023234       10.728    
    j=195            5.5716                0.12288        -13.234     0.017813       11.886    
    j=196            9.3061                0.14143        -18.351     0.014035       7.7509    
    j=197            6.5909               0.096429        -12.535     0.019051       6.2779    
    j=198            6.5323               0.095574        -7.2501    0.0022239       9.6654    
    j=199            9.0951                 0.1086        -14.035     0.021475       4.2528    
    j=200            8.6122                0.13349        -6.7827     0.015355       9.9207    

xxxxx Shift to: xxxxx
           fl_z_r_borr_poiss_mean    fl_z_r_borr_max    fl_b_bd    fl_c_min     fl_z_r_borr_n
           ______________________    _______________    _______    _________    _____________

    j=1            5.4095                0.10819        -11.109    0.0052876       4.1277    

xxxxx st_model = ipwkbzr, it_w_perc_n = 50, it_ak_perc_n = 50, it_z_n = 45.4052 xxxxx
Error using reshape
Size arguments must be real integers.

Error in ffs_ipwkbzr_get_funcgrid (line 458)
mt_coh_wkb_full = reshape(mt_coh_wkb_full, [it_coh_wkb_reshape_rows, it_coh_wkb_reshape_cols]);

Error in ff_az_test_gen>simu_model_gen_stats (line 592)
    [armt_map, func_map] = ffs_ipwkbzr_get_funcgrid(param_map, support_map);

Error in ff_az_test_gen (line 502)
            [tb_outcomes_simu, variablenames] = simu_model_gen_stats(param_map, support_map, ar_simu_info, cl_col_names);

Error in ff_az_test_analyze (line 156)
    st_simu_type, it_size_type, cl_st_param_keys, ...

Error in fsi_ipwkbzr_ds_vecsv_default_rand (line 74)
ff_az_test_analyze( ...