2nd Stage Optimization for Risky + Safe Asset (Save + Borr) Interpolated-Percentage
back to Fan's Dynamic Assets Repository Table of Content.
Contents
- FF_IPWKBZ_EVF solves the k' vs b' problem given aggregate savings
- Default
- Parse Parameters
- Integrate E(V(coh(k',b'), z')|z, w)
- Reshape E(V(coh,z'|z,w)) to allow for maxing
- Maximize max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)) optimal value and index
- Reindex K' and B' Choices for each State at the Optimal w'=k'+b' choice
- Graph
- Graph 1, V and EV
- Graph 2, max(EV)
- Graph 3, at max(EV) optimal choice category, color regions, borrow save
- Graph 4, Optimal K' and B' Levels
- Display Various Containers
- Display 1 support_map
- Display 2 armt_map
- Display 3 param_map
- Display 4 func_map
function [mt_ev_condi_z_max, mt_ev_condi_z_max_idx, mt_ev_condi_z_max_kp, mt_ev_condi_z_max_bp] = ff_ipwkbz_evf(varargin)
FF_IPWKBZ_EVF solves the k' vs b' problem given aggregate savings
This function follows the structure set up here: ff_wkz_evf but now we solve the second stage with percentage choice grid
We solve along a vector of w_n vector, that is an interpolation vector, not a vector of actual w choices picked in the first stage. k' choices are in terms of percentages. Compared to ff_wkz_evf where we only had an upper triangle of choices, now we have a full matrix of percentage choices.
@param mt_val matrix state_n I^2 by shock_n. This is the value matrix each row is a feasible reachable state given the choice vectors/matrix and each column is a shock state.
@param param_map container parameter container
@param support_map container support container
@param armt_map container container with states, choices and shocks grids that are inputs for grid based solution algorithm
@return mt_ev_condi_z_max matrix choice_w_n by shock_n max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)) conditional on z and w, at the optimal k' choice (w=k'+b') what is the expected utility? This is the value result from the 2nd stage problem. Note the result integrates over z'.
@return mt_ev_condi_z_max_idx matrix choice_w_n by shock_n this is the argmax from max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)). Given the vector of k' choices, which index maximized conditional on z and w integrating over z'/
@return mt_ev_condi_z_max_kp matrix choice_w_level_n by shock_n the k' choice at max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w))
@return mt_ev_condi_z_max_bp matrix choice_w_n by shock_n the b'=w-k' choice at max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w))
@example
@include
Default
params_len = length(varargin); bl_input_override = 0; if (params_len == 5) bl_input_override = varargin{5}; end if (bl_input_override) % override when called from outside [mt_val, param_map, support_map, armt_map, ~] = varargin{:}; else clear all; close all; % Not default parameters, but parameters that generate defaults [param_map, support_map] = ffs_ipwkbz_set_default_param(); support_map('bl_graph_evf') = true; bl_display_evf = true; support_map('bl_display_evf') = bl_display_evf; param_map('it_ak_perc_n') = 250; param_map('fl_w_interp_grid_gap') = (param_map('fl_w_max')-param_map('fl_b_bd'))/param_map('it_ak_perc_n'); [armt_map, func_map] = ffs_ipwkbz_get_funcgrid(param_map, support_map); % 1 for override % Generating Defaults params_group = values(armt_map, {'ar_a_meshk', 'ar_k_mesha', 'ar_z'}); [ar_a_meshk, ar_k_mesha, ar_z] = params_group{:}; params_group = values(func_map, {'f_util_standin', 'f_coh'}); [f_util_standin, f_coh] = params_group{:}; mt_val = f_util_standin(ar_z, ar_a_meshk, ar_k_mesha); mt_coh = f_coh(ar_z, ar_a_meshk, ar_k_mesha); 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: 9
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 = st_model ; val = ipwkbz
pos = 9 ; key = st_v_coh_z_interp_method ; val = method_cell
----------------------------------------
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
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx
_ ___
st_model 1 8
st_v_coh_z_interp_method 2 9
----------------------------------------
----------------------------------------
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_ipwkbz_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
----------------------------------------
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: 35
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_borr ; val = 0.095
pos = 15 ; key = fl_r_save ; val = 0.025
pos = 16 ; key = fl_tol_dist ; val = 1e-05
pos = 17 ; key = fl_tol_pol ; val = 1e-05
pos = 18 ; key = fl_tol_val ; val = 1e-05
pos = 19 ; key = fl_w ; val = 0.44365
pos = 20 ; key = fl_w_interp_grid_gap ; val = 0.1
pos = 21 ; key = fl_w_max ; val = 50
pos = 22 ; key = fl_w_min ; val = -20
pos = 23 ; key = fl_z_mu ; val = 0
pos = 24 ; key = fl_z_rho ; val = 0.8
pos = 25 ; key = fl_z_sig ; val = 0.2
pos = 26 ; key = it_ak_perc_n ; val = 50
pos = 27 ; key = it_c_interp_grid_gap ; val = 0.0001
pos = 28 ; key = it_maxiter_dist ; val = 1000
pos = 29 ; key = it_maxiter_val ; val = 250
pos = 30 ; key = it_tol_pol_nochange ; val = 25
pos = 31 ; key = it_w_perc_n ; val = 50
pos = 32 ; key = it_z_n ; val = 15
pos = 33 ; key = st_analytical_stationary_type ; val = eigenvector
pos = 34 ; key = st_model ; val = ipwkbz
pos = 35 ; key = st_v_coh_z_interp_method ; val = method_cell
----------------------------------------
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_borr 14 14 0.095
fl_r_save 15 15 0.025
fl_tol_dist 16 16 1e-05
fl_tol_pol 17 17 1e-05
fl_tol_val 18 18 1e-05
fl_w 19 19 0.44365
fl_w_interp_grid_gap 20 20 0.1
fl_w_max 21 21 50
fl_w_min 22 22 -20
fl_z_mu 23 23 0
fl_z_rho 24 24 0.8
fl_z_sig 25 25 0.2
it_ak_perc_n 26 26 50
it_c_interp_grid_gap 27 27 0.0001
it_maxiter_dist 28 28 1000
it_maxiter_val 29 29 250
it_tol_pol_nochange 30 30 25
it_w_perc_n 31 31 50
it_z_n 32 32 15
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx
_ ___
st_analytical_stationary_type 1 33
st_model 2 34
st_v_coh_z_interp_method 3 35
----------------------------------------
----------------------------------------
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_ipwkbz_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
Parse Parameters
params_group = values(armt_map, {'mt_z_trans', 'ar_z',...
'ar_w_level', 'ar_k_mesha', 'ar_a_meshk', 'mt_k'});
[mt_z_trans, ar_z, ar_w_level, ...
ar_k_mesha, ar_a_meshk, mt_k] = params_group{:};
params_group = values(param_map, {'it_z_n', 'fl_nan_replace', 'fl_b_bd'});
[it_z_n, fl_nan_replace, fl_b_bd] = params_group{:};
params_group = values(support_map, {'bl_graph_onebyones','bl_display_evf', 'bl_graph_evf'});
[bl_graph_onebyones, bl_display_evf, bl_graph_evf] = params_group{:};
params_group = values(support_map, {'bl_img_save', 'st_img_path', 'st_img_prefix', 'st_img_name_main', 'st_img_suffix'});
[bl_img_save, st_img_path, st_img_prefix, st_img_name_main, st_img_suffix] = params_group{:};
params_group = values(support_map, {'it_display_summmat_rowmax', 'it_display_summmat_colmax'});
[it_display_summmat_rowmax, it_display_summmat_colmax] = params_group{:};
% append function name
st_func_name = 'ff_ipwkbz_evf';
st_img_name_main = [st_func_name st_img_name_main];
Integrate E(V(coh(k',b'), z')|z, w)
Each column for a different state z, each value E(V(coh,z')|z) integrated already Here, each column is a current z, more to right higher EV dim(mt_ev_condi_z): Q by M Note that: mt_ev_condi_z = mt_val*mt_z_trans' is a mistake, that would be what we do in the ffs_ipwkbz_set_functions code where we loop over current z, and for each current z, grab out a particular row from the mt_z_trans that corresponds to a current shock's transition into all future states.
here, each column of mt_val corresponds to a state z, think of that as future state z. The input mt_val is V(coh, z), we need to integrate to get E(V(coh,z')|z).
mt_ev_condi_z = mt_val*mt_z_trans'; if(bl_display_evf) disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z: Q by M'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z)); disp(head(array2table(mt_ev_condi_z), 20)); disp(tail(array2table(mt_ev_condi_z), 20)); end
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z: Q by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
62250 15
mt_ev_condi_z1 mt_ev_condi_z2 mt_ev_condi_z3 mt_ev_condi_z4 mt_ev_condi_z5 mt_ev_condi_z6 mt_ev_condi_z7 mt_ev_condi_z8 mt_ev_condi_z9 mt_ev_condi_z10 mt_ev_condi_z11 mt_ev_condi_z12 mt_ev_condi_z13 mt_ev_condi_z14 mt_ev_condi_z15
______________ ______________ ______________ ______________ ______________ ______________ ______________ ______________ ______________ _______________ _______________ _______________ _______________ _______________ _______________
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
mt_ev_condi_z1 mt_ev_condi_z2 mt_ev_condi_z3 mt_ev_condi_z4 mt_ev_condi_z5 mt_ev_condi_z6 mt_ev_condi_z7 mt_ev_condi_z8 mt_ev_condi_z9 mt_ev_condi_z10 mt_ev_condi_z11 mt_ev_condi_z12 mt_ev_condi_z13 mt_ev_condi_z14 mt_ev_condi_z15
______________ ______________ ______________ ______________ ______________ ______________ ______________ ______________ ______________ _______________ _______________ _______________ _______________ _______________ _______________
4.1873 4.1906 4.1945 4.1989 4.2039 4.2094 4.2156 4.2224 4.23 4.2385 4.2479 4.2584 4.2698 4.2821 4.2944
4.1866 4.1899 4.1938 4.1982 4.2032 4.2087 4.2149 4.2218 4.2294 4.2379 4.2474 4.2578 4.2693 4.2816 4.2939
4.1859 4.1892 4.1931 4.1976 4.2025 4.2081 4.2143 4.2212 4.2288 4.2373 4.2468 4.2573 4.2688 4.2811 4.2934
4.1852 4.1885 4.1924 4.1969 4.2019 4.2074 4.2136 4.2205 4.2282 4.2368 4.2462 4.2567 4.2683 4.2806 4.293
4.1845 4.1878 4.1918 4.1962 4.2012 4.2068 4.213 4.2199 4.2276 4.2362 4.2457 4.2562 4.2677 4.2801 4.2925
4.1838 4.1871 4.1911 4.1955 4.2006 4.2061 4.2124 4.2193 4.227 4.2356 4.2451 4.2556 4.2672 4.2796 4.292
4.1831 4.1864 4.1904 4.1949 4.1999 4.2055 4.2117 4.2187 4.2264 4.235 4.2445 4.2551 4.2667 4.2791 4.2915
4.1824 4.1857 4.1897 4.1942 4.1992 4.2048 4.2111 4.218 4.2258 4.2344 4.244 4.2545 4.2662 4.2786 4.2911
4.1816 4.185 4.189 4.1935 4.1985 4.2042 4.2104 4.2174 4.2252 4.2338 4.2434 4.254 4.2656 4.2781 4.2906
4.1809 4.1843 4.1883 4.1928 4.1979 4.2035 4.2098 4.2168 4.2246 4.2332 4.2428 4.2534 4.2651 4.2776 4.2901
4.1802 4.1836 4.1876 4.1921 4.1972 4.2029 4.2092 4.2162 4.224 4.2326 4.2422 4.2529 4.2646 4.2771 4.2896
4.1795 4.1829 4.1869 4.1915 4.1965 4.2022 4.2085 4.2155 4.2233 4.232 4.2417 4.2523 4.264 4.2766 4.2891
4.1788 4.1822 4.1862 4.1908 4.1959 4.2015 4.2079 4.2149 4.2227 4.2314 4.2411 4.2518 4.2635 4.2761 4.2887
4.1781 4.1815 4.1856 4.1901 4.1952 4.2009 4.2072 4.2143 4.2221 4.2308 4.2405 4.2512 4.263 4.2756 4.2882
4.1774 4.1808 4.1849 4.1894 4.1945 4.2002 4.2066 4.2136 4.2215 4.2302 4.2399 4.2507 4.2624 4.275 4.2877
4.1767 4.1801 4.1842 4.1887 4.1939 4.1996 4.2059 4.213 4.2209 4.2296 4.2394 4.2501 4.2619 4.2745 4.2872
4.176 4.1794 4.1835 4.1881 4.1932 4.1989 4.2053 4.2124 4.2203 4.229 4.2388 4.2496 4.2614 4.274 4.2867
4.1753 4.1787 4.1828 4.1874 4.1925 4.1982 4.2046 4.2117 4.2196 4.2284 4.2382 4.249 4.2608 4.2735 4.2863
4.1746 4.178 4.1821 4.1867 4.1918 4.1976 4.204 4.2111 4.219 4.2278 4.2376 4.2484 4.2603 4.273 4.2858
4.1738 4.1773 4.1814 4.186 4.1912 4.1969 4.2033 4.2105 4.2184 4.2272 4.237 4.2479 4.2598 4.2725 4.2853
Reshape E(V(coh,z'|z,w)) to allow for maxing
dim(mt_ev_condi_z): IxJ by M
[it_mt_bp_rown, it_mt_bp_coln] = size(mt_k); mt_ev_condi_z_full = reshape(mt_ev_condi_z, [it_mt_bp_rown, it_mt_bp_coln*it_z_n]);
Maximize max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)) optimal value and index
Maximization, find optimal k'/b' combination given z and w=k'+b'
[ar_ev_condi_z_max, ar_ev_condi_z_max_idx] = max(mt_ev_condi_z_full); mt_ev_condi_z_max = reshape(ar_ev_condi_z_max, [it_mt_bp_coln, it_z_n]); mt_ev_condi_z_max_idx = reshape(ar_ev_condi_z_max_idx, [it_mt_bp_coln, it_z_n]); if(bl_display_evf) disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z_full: J by IxM'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z_full)); % disp(head(array2table(mt_ev_condi_z_full), 20)); % disp(tail(array2table(mt_ev_condi_z_full), 20)); disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z_max: I by M'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z_max)); disp(head(array2table(mt_ev_condi_z_max), 20)); disp(tail(array2table(mt_ev_condi_z_max), 20)); disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z_max_idx: I by M'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z_max_idx)); disp(head(array2table(mt_ev_condi_z_max_idx), 20)); disp(tail(array2table(mt_ev_condi_z_max_idx), 20)); end
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_full: J by IxM
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
250 3735
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
249 15
mt_ev_condi_z_max1 mt_ev_condi_z_max2 mt_ev_condi_z_max3 mt_ev_condi_z_max4 mt_ev_condi_z_max5 mt_ev_condi_z_max6 mt_ev_condi_z_max7 mt_ev_condi_z_max8 mt_ev_condi_z_max9 mt_ev_condi_z_max10 mt_ev_condi_z_max11 mt_ev_condi_z_max12 mt_ev_condi_z_max13 mt_ev_condi_z_max14 mt_ev_condi_z_max15
__________________ __________________ __________________ __________________ __________________ __________________ __________________ __________________ __________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912
-3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.912 -3.9117 -3.9096 -3.899 -3.8579 -3.7363 -3.4618 -2.9895 -2.3703
-3.912 -3.912 -3.912 -3.9114 -3.9078 -3.8901 -3.8268 -3.658 -3.3192 -2.7996 -2.1748 -1.5628 -1.0471 -0.64735 -0.34769
-3.9092 -3.8965 -3.8478 -3.71 -3.4188 -2.9531 -2.3757 -1.7992 -1.3069 -0.91756 -0.60933 -0.35427 -0.13356 0.0614 0.23041
-3.1231 -2.6385 -2.1416 -1.701 -1.3406 -1.0471 -0.79986 -0.58288 -0.38654 -0.20508 -0.034881 0.12637 0.27979 0.42436 0.55531
-1.0435 -0.92496 -0.79232 -0.65115 -0.50573 -0.36361 -0.22515 -0.089811 0.042866 0.17326 0.30166 0.42824 0.55262 0.67289 0.78402
-0.40662 -0.34046 -0.26298 -0.17635 -0.081541 0.01949 0.12207 0.2258 0.33057 0.43628 0.54284 0.65006 0.75733 0.86263 0.9611
-0.022755 0.023335 0.078333 0.14119 0.21159 0.2896 0.37324 0.45939 0.54788 0.63856 0.73128 0.82581 0.92149 1.0164 1.1059
0.25349 0.28888 0.33157 0.38097 0.43706 0.50011 0.57038 0.64512 0.72274 0.80311 0.88612 0.97152 1.0587 1.1458 1.2285
0.46954 0.49828 0.53318 0.57389 0.62054 0.6735 0.73319 0.79939 0.86914 0.94192 1.0176 1.0961 1.1767 1.2577 1.3349
0.64704 0.67123 0.70076 0.73539 0.77533 0.821 0.87286 0.93138 0.99512 1.062 1.132 1.2049 1.2803 1.3563 1.4291
0.79769 0.81859 0.84417 0.87431 0.90924 0.94938 0.99525 1.0473 1.1057 1.1679 1.2333 1.3017 1.3726 1.4445 1.5136
0.92857 0.94696 0.96953 0.99621 1.0272 1.0631 1.1042 1.1511 1.2043 1.2626 1.3241 1.3887 1.456 1.5244 1.5902
1.0443 1.0607 1.0809 1.1048 1.1328 1.1651 1.2024 1.2451 1.2937 1.3483 1.4066 1.4679 1.532 1.5974 1.6604
1.148 1.1628 1.1811 1.2028 1.2282 1.2576 1.2917 1.3309 1.3757 1.4266 1.482 1.5406 1.6019 1.6646 1.7252
1.2419 1.2554 1.2721 1.292 1.3152 1.3423 1.3737 1.4099 1.4514 1.4988 1.5516 1.6077 1.6666 1.7269 1.7853
1.3278 1.3402 1.3555 1.3738 1.3953 1.4204 1.4495 1.4831 1.5218 1.5661 1.6162 1.6701 1.7268 1.785 1.8414
1.4068 1.4183 1.4325 1.4495 1.4694 1.4927 1.5199 1.5513 1.5875 1.6291 1.6765 1.7284 1.7831 1.8394 1.8941
1.4801 1.4908 1.504 1.5198 1.5384 1.5602 1.5856 1.6151 1.6492 1.6883 1.7331 1.7831 1.8361 1.8906 1.9437
1.5483 1.5583 1.5707 1.5855 1.603 1.6234 1.6473 1.6751 1.7072 1.7442 1.7867 1.8347 1.886 1.939 1.9906
mt_ev_condi_z_max1 mt_ev_condi_z_max2 mt_ev_condi_z_max3 mt_ev_condi_z_max4 mt_ev_condi_z_max5 mt_ev_condi_z_max6 mt_ev_condi_z_max7 mt_ev_condi_z_max8 mt_ev_condi_z_max9 mt_ev_condi_z_max10 mt_ev_condi_z_max11 mt_ev_condi_z_max12 mt_ev_condi_z_max13 mt_ev_condi_z_max14 mt_ev_condi_z_max15
__________________ __________________ __________________ __________________ __________________ __________________ __________________ __________________ __________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________
4.1976 4.1986 4.1998 4.2012 4.2029 4.205 4.2075 4.2104 4.2139 4.218 4.223 4.2289 4.2358 4.2436 4.2521
4.202 4.2029 4.2041 4.2055 4.2073 4.2093 4.2118 4.2147 4.2182 4.2223 4.2272 4.2331 4.2399 4.2478 4.2562
4.2063 4.2072 4.2084 4.2099 4.2116 4.2136 4.2161 4.219 4.2224 4.2266 4.2315 4.2373 4.2441 4.2519 4.2603
4.2106 4.2116 4.2127 4.2142 4.2159 4.2179 4.2203 4.2232 4.2267 4.2308 4.2357 4.2415 4.2483 4.2561 4.2644
4.2149 4.2159 4.217 4.2184 4.2201 4.2222 4.2246 4.2275 4.2309 4.235 4.2399 4.2456 4.2524 4.2602 4.2685
4.2192 4.2201 4.2213 4.2227 4.2244 4.2264 4.2288 4.2317 4.2351 4.2392 4.2441 4.2498 4.2566 4.2643 4.2725
4.2235 4.2244 4.2256 4.227 4.2287 4.2307 4.2331 4.2359 4.2393 4.2434 4.2482 4.2539 4.2607 4.2683 4.2766
4.2277 4.2286 4.2298 4.2312 4.2329 4.2349 4.2373 4.2401 4.2435 4.2475 4.2524 4.2581 4.2648 4.2724 4.2806
4.2319 4.2329 4.234 4.2354 4.2371 4.2391 4.2415 4.2443 4.2477 4.2517 4.2565 4.2622 4.2688 4.2764 4.2846
4.2362 4.2371 4.2382 4.2396 4.2413 4.2433 4.2456 4.2485 4.2518 4.2558 4.2606 4.2662 4.2729 4.2805 4.2886
4.2403 4.2413 4.2424 4.2438 4.2454 4.2474 4.2498 4.2526 4.2559 4.2599 4.2647 4.2703 4.2769 4.2845 4.2926
4.2445 4.2454 4.2466 4.2479 4.2496 4.2516 4.2539 4.2567 4.2601 4.264 4.2688 4.2744 4.281 4.2885 4.2965
4.2487 4.2496 4.2507 4.2521 4.2537 4.2557 4.258 4.2608 4.2641 4.2681 4.2728 4.2784 4.285 4.2925 4.3005
4.2528 4.2537 4.2548 4.2562 4.2579 4.2598 4.2621 4.2649 4.2682 4.2722 4.2769 4.2824 4.289 4.2964 4.3044
4.2569 4.2578 4.259 4.2603 4.262 4.2639 4.2662 4.269 4.2723 4.2762 4.2809 4.2864 4.2929 4.3004 4.3083
4.261 4.2619 4.2631 4.2644 4.266 4.268 4.2703 4.273 4.2763 4.2802 4.2849 4.2904 4.2969 4.3043 4.3122
4.2651 4.266 4.2671 4.2685 4.2701 4.272 4.2743 4.2771 4.2804 4.2843 4.2889 4.2944 4.3008 4.3082 4.3161
4.2692 4.2701 4.2712 4.2726 4.2742 4.2761 4.2784 4.2811 4.2844 4.2882 4.2929 4.2983 4.3048 4.3121 4.32
4.2733 4.2742 4.2753 4.2766 4.2782 4.2801 4.2824 4.2851 4.2884 4.2922 4.2968 4.3023 4.3087 4.316 4.3239
4.2773 4.2782 4.2793 4.2806 4.2822 4.2841 4.2864 4.2891 4.2923 4.2962 4.3008 4.3062 4.3126 4.3199 4.3277
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_idx: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
249 15
mt_ev_condi_z_max_idx1 mt_ev_condi_z_max_idx2 mt_ev_condi_z_max_idx3 mt_ev_condi_z_max_idx4 mt_ev_condi_z_max_idx5 mt_ev_condi_z_max_idx6 mt_ev_condi_z_max_idx7 mt_ev_condi_z_max_idx8 mt_ev_condi_z_max_idx9 mt_ev_condi_z_max_idx10 mt_ev_condi_z_max_idx11 mt_ev_condi_z_max_idx12 mt_ev_condi_z_max_idx13 mt_ev_condi_z_max_idx14 mt_ev_condi_z_max_idx15
______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ _______________________ _______________________ _______________________ _______________________ _______________________ _______________________
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
221 231 248 250 250 250 250 250 250 250 250 250 250 250 250
142 165 195 232 250 250 250 250 250 250 250 250 250 250 250
122 142 168 200 237 250 250 250 250 250 250 250 250 250 250
105 123 146 174 206 245 250 250 250 250 250 250 250 250 250
93 109 129 153 182 217 250 250 250 250 250 250 250 250 250
83 97 115 137 163 194 231 250 250 250 250 250 250 250 250
75 88 104 124 147 175 209 248 250 250 250 250 250 250 250
68 80 95 113 134 160 190 227 250 250 250 250 250 250 250
63 74 87 104 124 147 175 208 248 250 250 250 250 250 250
58 68 81 96 114 136 162 193 230 250 250 250 250 250 250
54 63 75 89 106 127 151 180 214 250 250 250 250 250 250
50 59 70 84 100 119 141 168 200 238 250 250 250 250 250
47 56 66 79 93 111 133 158 188 224 250 250 250 250 250
45 52 62 74 88 105 125 149 177 211 250 250 250 250 250
42 50 59 70 83 99 118 141 168 200 238 250 250 250 250
40 47 56 66 79 94 112 134 159 189 225 250 250 250 250
mt_ev_condi_z_max_idx1 mt_ev_condi_z_max_idx2 mt_ev_condi_z_max_idx3 mt_ev_condi_z_max_idx4 mt_ev_condi_z_max_idx5 mt_ev_condi_z_max_idx6 mt_ev_condi_z_max_idx7 mt_ev_condi_z_max_idx8 mt_ev_condi_z_max_idx9 mt_ev_condi_z_max_idx10 mt_ev_condi_z_max_idx11 mt_ev_condi_z_max_idx12 mt_ev_condi_z_max_idx13 mt_ev_condi_z_max_idx14 mt_ev_condi_z_max_idx15
______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ _______________________ _______________________ _______________________ _______________________ _______________________ _______________________
8 10 11 13 16 18 22 26 31 37 44 52 62 73 85
8 10 11 13 16 18 22 26 31 36 43 52 61 72 85
8 10 11 13 15 18 22 26 31 36 43 51 61 72 84
8 9 11 13 15 18 22 26 30 36 43 51 61 72 84
8 9 11 13 15 18 21 25 30 36 43 51 61 72 84
8 9 11 13 15 18 21 25 30 36 43 51 60 71 83
8 9 11 13 15 18 21 25 30 36 42 50 60 71 83
8 9 11 13 15 18 21 25 30 36 42 50 60 71 82
8 9 11 13 15 18 21 25 30 35 42 50 60 70 82
8 9 11 13 15 18 21 25 30 35 42 50 59 70 82
8 9 11 13 15 18 21 25 30 35 42 50 59 70 81
8 9 11 13 15 18 21 25 29 35 42 49 59 70 81
8 9 11 13 15 18 21 25 29 35 41 49 59 69 81
8 9 11 13 15 18 21 25 29 35 41 49 58 69 80
8 9 11 13 15 17 21 24 29 35 41 49 58 69 80
8 9 11 12 15 17 21 24 29 34 41 49 58 68 80
8 9 11 12 15 17 20 24 29 34 41 48 58 68 79
8 9 11 12 15 17 20 24 29 34 41 48 57 68 79
8 9 10 12 15 17 20 24 29 34 40 48 57 68 79
8 9 10 12 14 17 20 24 28 34 40 48 57 67 79
Reindex K' and B' Choices for each State at the Optimal w'=k'+b' choice
The K' and B' Optimal Choices Associated with EV opti dim(mt_ev_condi_z_max_kp): I by M
ar_add_grid = linspace(0, it_mt_bp_rown*(it_mt_bp_coln-1), it_mt_bp_coln); mt_ev_condi_z_max_idx = mt_ev_condi_z_max_idx + ar_add_grid'; if(bl_display_evf) disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z_max_idx: I by M'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z_max_idx)); disp(head(array2table(mt_ev_condi_z_max_idx), 20)); disp(tail(array2table(mt_ev_condi_z_max_idx), 20)); end mt_ev_condi_z_max_kp = reshape(ar_k_mesha(mt_ev_condi_z_max_idx), [it_mt_bp_coln, it_z_n]); mt_ev_condi_z_max_bp = reshape(ar_a_meshk(mt_ev_condi_z_max_idx), [it_mt_bp_coln, it_z_n]); if(bl_display_evf) disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z_max_kp: I by M'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z_max_kp)); disp(head(array2table(mt_ev_condi_z_max_kp), 20)); disp(tail(array2table(mt_ev_condi_z_max_kp), 20)); disp('----------------------------------------'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp('mt_ev_condi_z_max_bp: I by M'); disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); disp(size(mt_ev_condi_z_max_bp)); disp(head(array2table(mt_ev_condi_z_max_bp), 20)); disp(tail(array2table(mt_ev_condi_z_max_bp), 20)); end
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_idx: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
249 15
mt_ev_condi_z_max_idx1 mt_ev_condi_z_max_idx2 mt_ev_condi_z_max_idx3 mt_ev_condi_z_max_idx4 mt_ev_condi_z_max_idx5 mt_ev_condi_z_max_idx6 mt_ev_condi_z_max_idx7 mt_ev_condi_z_max_idx8 mt_ev_condi_z_max_idx9 mt_ev_condi_z_max_idx10 mt_ev_condi_z_max_idx11 mt_ev_condi_z_max_idx12 mt_ev_condi_z_max_idx13 mt_ev_condi_z_max_idx14 mt_ev_condi_z_max_idx15
______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ _______________________ _______________________ _______________________ _______________________ _______________________ _______________________
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
500 500 500 500 500 500 500 500 500 500 500 500 500 500 500
750 750 750 750 750 750 750 750 750 750 750 750 750 750 750
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1221 1231 1248 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250 1250
1392 1415 1445 1482 1500 1500 1500 1500 1500 1500 1500 1500 1500 1500 1500
1622 1642 1668 1700 1737 1750 1750 1750 1750 1750 1750 1750 1750 1750 1750
1855 1873 1896 1924 1956 1995 2000 2000 2000 2000 2000 2000 2000 2000 2000
2093 2109 2129 2153 2182 2217 2250 2250 2250 2250 2250 2250 2250 2250 2250
2333 2347 2365 2387 2413 2444 2481 2500 2500 2500 2500 2500 2500 2500 2500
2575 2588 2604 2624 2647 2675 2709 2748 2750 2750 2750 2750 2750 2750 2750
2818 2830 2845 2863 2884 2910 2940 2977 3000 3000 3000 3000 3000 3000 3000
3063 3074 3087 3104 3124 3147 3175 3208 3248 3250 3250 3250 3250 3250 3250
3308 3318 3331 3346 3364 3386 3412 3443 3480 3500 3500 3500 3500 3500 3500
3554 3563 3575 3589 3606 3627 3651 3680 3714 3750 3750 3750 3750 3750 3750
3800 3809 3820 3834 3850 3869 3891 3918 3950 3988 4000 4000 4000 4000 4000
4047 4056 4066 4079 4093 4111 4133 4158 4188 4224 4250 4250 4250 4250 4250
4295 4302 4312 4324 4338 4355 4375 4399 4427 4461 4500 4500 4500 4500 4500
4542 4550 4559 4570 4583 4599 4618 4641 4668 4700 4738 4750 4750 4750 4750
4790 4797 4806 4816 4829 4844 4862 4884 4909 4939 4975 5000 5000 5000 5000
mt_ev_condi_z_max_idx1 mt_ev_condi_z_max_idx2 mt_ev_condi_z_max_idx3 mt_ev_condi_z_max_idx4 mt_ev_condi_z_max_idx5 mt_ev_condi_z_max_idx6 mt_ev_condi_z_max_idx7 mt_ev_condi_z_max_idx8 mt_ev_condi_z_max_idx9 mt_ev_condi_z_max_idx10 mt_ev_condi_z_max_idx11 mt_ev_condi_z_max_idx12 mt_ev_condi_z_max_idx13 mt_ev_condi_z_max_idx14 mt_ev_condi_z_max_idx15
______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________ _______________________ _______________________ _______________________ _______________________ _______________________ _______________________
57258 57260 57261 57263 57266 57268 57272 57276 57281 57287 57294 57302 57312 57323 57335
57508 57510 57511 57513 57516 57518 57522 57526 57531 57536 57543 57552 57561 57572 57585
57758 57760 57761 57763 57765 57768 57772 57776 57781 57786 57793 57801 57811 57822 57834
58008 58009 58011 58013 58015 58018 58022 58026 58030 58036 58043 58051 58061 58072 58084
58258 58259 58261 58263 58265 58268 58271 58275 58280 58286 58293 58301 58311 58322 58334
58508 58509 58511 58513 58515 58518 58521 58525 58530 58536 58543 58551 58560 58571 58583
58758 58759 58761 58763 58765 58768 58771 58775 58780 58786 58792 58800 58810 58821 58833
59008 59009 59011 59013 59015 59018 59021 59025 59030 59036 59042 59050 59060 59071 59082
59258 59259 59261 59263 59265 59268 59271 59275 59280 59285 59292 59300 59310 59320 59332
59508 59509 59511 59513 59515 59518 59521 59525 59530 59535 59542 59550 59559 59570 59582
59758 59759 59761 59763 59765 59768 59771 59775 59780 59785 59792 59800 59809 59820 59831
60008 60009 60011 60013 60015 60018 60021 60025 60029 60035 60042 60049 60059 60070 60081
60258 60259 60261 60263 60265 60268 60271 60275 60279 60285 60291 60299 60309 60319 60331
60508 60509 60511 60513 60515 60518 60521 60525 60529 60535 60541 60549 60558 60569 60580
60758 60759 60761 60763 60765 60767 60771 60774 60779 60785 60791 60799 60808 60819 60830
61008 61009 61011 61012 61015 61017 61021 61024 61029 61034 61041 61049 61058 61068 61080
61258 61259 61261 61262 61265 61267 61270 61274 61279 61284 61291 61298 61308 61318 61329
61508 61509 61511 61512 61515 61517 61520 61524 61529 61534 61541 61548 61557 61568 61579
61758 61759 61760 61762 61765 61767 61770 61774 61779 61784 61790 61798 61807 61818 61829
62008 62009 62010 62012 62014 62017 62020 62024 62028 62034 62040 62048 62057 62067 62079
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_kp: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
249 15
mt_ev_condi_z_max_kp1 mt_ev_condi_z_max_kp2 mt_ev_condi_z_max_kp3 mt_ev_condi_z_max_kp4 mt_ev_condi_z_max_kp5 mt_ev_condi_z_max_kp6 mt_ev_condi_z_max_kp7 mt_ev_condi_z_max_kp8 mt_ev_condi_z_max_kp9 mt_ev_condi_z_max_kp10 mt_ev_condi_z_max_kp11 mt_ev_condi_z_max_kp12 mt_ev_condi_z_max_kp13 mt_ev_condi_z_max_kp14 mt_ev_condi_z_max_kp15
_____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834 0.2834
0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668 0.5668
0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502 0.8502
1.0016 1.0471 1.1245 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336 1.1336
0.8024 0.93329 1.104 1.3146 1.417 1.417 1.417 1.417 1.417 1.417 1.417 1.417 1.417 1.417 1.417
0.8263 0.96288 1.1404 1.359 1.6116 1.7004 1.7004 1.7004 1.7004 1.7004 1.7004 1.7004 1.7004 1.7004 1.7004
0.82858 0.97199 1.1552 1.3783 1.6333 1.944 1.9838 1.9838 1.9838 1.9838 1.9838 1.9838 1.9838 1.9838 1.9838
0.83768 0.98337 1.1655 1.384 1.648 1.9667 2.2672 2.2672 2.2672 2.2672 2.2672 2.2672 2.2672 2.2672 2.2672
0.83996 0.98337 1.1677 1.3931 1.6594 1.977 2.356 2.5506 2.5506 2.5506 2.5506 2.5506 2.5506 2.5506 2.5506
0.84224 0.9902 1.1723 1.3999 1.6617 1.9804 2.3674 2.8112 2.834 2.834 2.834 2.834 2.834 2.834 2.834
0.83882 0.98906 1.1769 1.4022 1.6651 1.9906 2.3662 2.8295 3.1174 3.1174 3.1174 3.1174 3.1174 3.1174 3.1174
0.84679 0.99702 1.1746 1.4068 1.6799 1.994 2.3765 2.8272 3.3735 3.4008 3.4008 3.4008 3.4008 3.4008 3.4008
0.84337 0.99133 1.1837 1.4056 1.672 1.9975 2.3822 2.8408 3.3883 3.6842 3.6842 3.6842 3.6842 3.6842 3.6842
0.84451 0.98792 1.1791 1.4022 1.6731 2.0077 2.3901 2.8522 3.394 3.9676 3.9676 3.9676 3.9676 3.9676 3.9676
0.83654 0.9902 1.178 1.417 1.6902 2.0145 2.3901 2.8511 3.3974 4.0461 4.251 4.251 4.251 4.251 4.251
0.83768 1.0016 1.1837 1.4204 1.6754 2.0032 2.4038 2.859 3.4054 4.0609 4.5344 4.5344 4.5344 4.5344 4.5344
0.85134 0.98678 1.1803 1.4125 1.6833 2.0123 2.3992 2.8636 3.4054 4.0632 4.8178 4.8178 4.8178 4.8178 4.8178
0.83996 1.0039 1.1882 1.4136 1.6799 2.0077 2.397 2.8682 3.4213 4.0769 4.8554 5.1012 5.1012 5.1012 5.1012
0.84337 0.99475 1.1894 1.4056 1.6867 2.0111 2.4004 2.8761 3.4167 4.0655 4.844 5.3846 5.3846 5.3846 5.3846
mt_ev_condi_z_max_kp1 mt_ev_condi_z_max_kp2 mt_ev_condi_z_max_kp3 mt_ev_condi_z_max_kp4 mt_ev_condi_z_max_kp5 mt_ev_condi_z_max_kp6 mt_ev_condi_z_max_kp7 mt_ev_condi_z_max_kp8 mt_ev_condi_z_max_kp9 mt_ev_condi_z_max_kp10 mt_ev_condi_z_max_kp11 mt_ev_condi_z_max_kp12 mt_ev_condi_z_max_kp13 mt_ev_condi_z_max_kp14 mt_ev_condi_z_max_kp15
_____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________
1.8165 2.3355 2.595 3.114 3.8925 4.4115 5.4495 6.4875 7.785 9.342 11.158 13.234 15.829 18.684 21.798
1.8245 2.3457 2.6064 3.1277 3.9096 4.4308 5.4734 6.5159 7.8191 9.1223 10.947 13.293 15.638 18.505 21.894
1.8324 2.356 2.6178 3.1413 3.6649 4.4502 5.4973 6.5444 7.8533 9.1622 10.995 13.089 15.707 18.586 21.727
1.8404 2.1033 2.6291 3.155 3.6808 4.4695 5.5212 6.5729 7.6245 9.202 11.042 13.146 15.775 18.667 21.822
1.8484 2.1124 2.6405 3.1686 3.6967 4.4889 5.281 6.3373 7.6575 9.2418 11.09 13.203 15.843 18.748 21.916
1.8563 2.1215 2.6519 3.1823 3.7127 4.5082 5.3038 6.3646 7.6905 9.2817 11.138 13.26 15.646 18.563 21.746
1.8643 2.1306 2.6633 3.1959 3.7286 4.5276 5.3266 6.3919 7.7235 9.3215 10.919 13.05 15.713 18.643 21.839
1.8723 2.1397 2.6747 3.2096 3.7445 4.5469 5.3493 6.4192 7.7565 9.3613 10.966 13.106 15.781 18.723 21.665
1.8802 2.1488 2.686 3.2233 3.7605 4.5663 5.3721 6.4465 7.7895 9.1326 11.013 13.162 15.848 18.534 21.757
1.8882 2.1579 2.6974 3.2369 3.7764 4.5856 5.3949 6.4738 7.8225 9.1713 11.059 13.217 15.645 18.612 21.849
1.8962 2.167 2.7088 3.2506 3.7923 4.605 5.4176 6.5011 7.8556 9.21 11.106 13.273 15.711 18.691 21.67
1.9041 2.1762 2.7202 3.2642 3.8083 4.6243 5.4404 6.5285 7.6165 9.2487 11.153 13.057 15.777 18.769 21.762
1.9121 2.1853 2.7316 3.2779 3.8242 4.6437 5.4631 6.5558 7.6484 9.2874 10.926 13.112 15.843 18.575 21.853
1.9201 2.1944 2.743 3.2915 3.8401 4.663 5.4859 6.5831 7.6803 9.326 10.972 13.166 15.635 18.652 21.669
1.928 2.2035 2.7543 3.3052 3.8561 4.4069 5.5087 6.335 7.7121 9.3647 11.017 13.221 15.7 18.729 21.759
1.936 2.2126 2.7657 3.0423 3.872 4.4251 5.5314 6.3612 7.744 9.1269 11.063 13.275 15.765 18.53 21.849
1.944 2.2217 2.7771 3.0548 3.8879 4.4434 5.2765 6.3873 7.7759 9.1644 11.108 13.052 15.829 18.607 21.661
1.9519 2.2308 2.7885 3.0673 3.9039 4.4616 5.2981 6.4135 7.8077 9.202 11.154 13.106 15.615 18.683 21.75
1.9599 2.2399 2.5199 3.0798 3.9198 4.4798 5.3197 6.4397 7.8396 9.2395 10.919 13.159 15.679 18.759 21.839
1.9679 2.249 2.5301 3.0924 3.6546 4.498 5.3414 6.4659 7.5904 9.2771 10.964 13.213 15.743 18.554 21.928
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_bp: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
249 15
mt_ev_condi_z_max_bp1 mt_ev_condi_z_max_bp2 mt_ev_condi_z_max_bp3 mt_ev_condi_z_max_bp4 mt_ev_condi_z_max_bp5 mt_ev_condi_z_max_bp6 mt_ev_condi_z_max_bp7 mt_ev_condi_z_max_bp8 mt_ev_condi_z_max_bp9 mt_ev_condi_z_max_bp10 mt_ev_condi_z_max_bp11 mt_ev_condi_z_max_bp12 mt_ev_condi_z_max_bp13 mt_ev_condi_z_max_bp14 mt_ev_condi_z_max_bp15
_____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________
-20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-19.868 -19.914 -19.991 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-19.385 -19.516 -19.687 -19.898 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-19.126 -19.262 -19.44 -19.659 -19.911 -20 -20 -20 -20 -20 -20 -20 -20 -20 -20
-18.845 -18.988 -19.171 -19.395 -19.649 -19.96 -20 -20 -20 -20 -20 -20 -20 -20 -20
-18.57 -18.716 -18.898 -19.117 -19.381 -19.7 -20 -20 -20 -20 -20 -20 -20 -20 -20
-18.289 -18.433 -18.617 -18.842 -19.109 -19.426 -19.805 -20 -20 -20 -20 -20 -20 -20 -20
-18.008 -18.156 -18.338 -18.566 -18.828 -19.146 -19.533 -19.977 -20 -20 -20 -20 -20 -20 -20
-17.721 -17.872 -18.059 -18.285 -18.548 -18.873 -19.249 -19.712 -20 -20 -20 -20 -20 -20 -20
-17.446 -17.596 -17.774 -18.006 -18.279 -18.593 -18.976 -19.426 -19.973 -20 -20 -20 -20 -20 -20
-17.159 -17.307 -17.499 -17.721 -17.988 -18.313 -18.698 -19.157 -19.704 -20 -20 -20 -20 -20 -20
-16.877 -17.02 -17.212 -17.435 -17.705 -18.04 -18.423 -18.885 -19.426 -20 -20 -20 -20 -20 -20
-16.586 -16.739 -16.927 -17.166 -17.439 -17.764 -18.139 -18.6 -19.146 -19.795 -20 -20 -20 -20 -20
-16.303 -16.467 -16.649 -16.886 -17.141 -17.469 -17.869 -18.325 -18.871 -19.527 -20 -20 -20 -20 -20
-16.034 -16.169 -16.362 -16.595 -16.866 -17.194 -17.581 -18.046 -18.588 -19.245 -20 -20 -20 -20 -20
-15.739 -15.903 -16.087 -16.312 -16.579 -16.906 -17.296 -17.767 -18.32 -18.976 -19.754 -20 -20 -20 -20
-15.459 -15.61 -15.805 -16.021 -16.302 -16.627 -17.016 -17.492 -18.032 -18.681 -19.459 -20 -20 -20 -20
mt_ev_condi_z_max_bp1 mt_ev_condi_z_max_bp2 mt_ev_condi_z_max_bp3 mt_ev_condi_z_max_bp4 mt_ev_condi_z_max_bp5 mt_ev_condi_z_max_bp6 mt_ev_condi_z_max_bp7 mt_ev_condi_z_max_bp8 mt_ev_condi_z_max_bp9 mt_ev_condi_z_max_bp10 mt_ev_condi_z_max_bp11 mt_ev_condi_z_max_bp12 mt_ev_condi_z_max_bp13 mt_ev_condi_z_max_bp14 mt_ev_condi_z_max_bp15
_____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ ______________________ ______________________ ______________________ ______________________ ______________________ ______________________
42.799 42.28 42.02 41.501 40.723 40.204 39.166 38.128 36.83 35.273 33.457 31.381 28.786 25.931 22.817
43.074 42.553 42.292 41.771 40.989 40.468 39.425 38.383 37.08 35.776 33.952 31.606 29.261 26.394 23.005
43.35 42.826 42.564 42.041 41.517 40.732 39.685 38.638 37.329 36.02 34.188 32.093 29.476 26.596 23.455
43.625 43.362 42.836 42.311 41.785 40.996 39.944 38.893 37.841 36.264 34.423 32.32 29.691 26.799 23.644
43.901 43.637 43.108 42.58 42.052 41.26 40.468 39.412 38.091 36.507 34.659 32.546 29.906 27.001 23.833
44.176 43.911 43.38 42.85 42.32 41.524 40.729 39.668 38.342 36.751 34.894 32.773 30.386 27.469 24.287
44.451 44.185 43.653 43.12 42.587 41.788 40.989 39.924 38.592 36.994 35.396 33.266 30.602 27.673 24.477
44.727 44.459 43.925 43.39 42.855 42.052 41.25 40.18 38.843 37.238 35.633 33.493 30.819 27.877 24.934
45.002 44.734 44.197 43.659 43.122 42.316 41.51 40.436 39.093 37.75 35.87 33.721 31.035 28.349 25.126
45.278 45.008 44.469 43.929 43.39 42.58 41.771 40.692 39.343 37.995 36.107 33.949 31.521 28.554 25.317
45.553 45.282 44.741 44.199 43.657 42.844 42.032 40.948 39.594 38.239 36.343 34.176 31.738 28.759 25.779
45.829 45.557 45.013 44.469 43.925 43.108 42.292 41.204 40.116 38.484 36.58 34.676 31.956 28.963 25.971
46.104 45.831 45.285 44.738 44.192 43.373 42.553 41.46 40.368 38.729 37.09 34.905 32.173 29.441 26.164
46.38 46.105 45.557 45.008 44.459 43.637 42.814 41.717 40.619 38.974 37.328 35.133 32.665 29.647 26.63
46.655 46.38 45.829 45.278 44.727 44.176 43.074 42.248 40.871 39.218 37.566 35.362 32.883 29.854 26.824
46.93 46.654 46.101 45.824 44.994 44.441 43.335 42.505 41.122 39.74 37.804 35.591 33.102 30.336 27.017
47.206 46.928 46.373 46.095 45.262 44.706 43.873 42.762 41.374 39.985 38.041 36.097 33.32 30.543 27.488
47.481 47.202 46.645 46.366 45.529 44.972 44.135 43.02 41.625 40.231 38.279 36.327 33.818 30.75 27.683
47.757 47.477 47.197 46.637 45.797 45.237 44.397 43.277 41.877 40.477 38.797 36.557 34.037 30.958 27.878
48.032 47.751 47.47 46.908 46.345 45.502 44.659 43.534 42.41 40.723 39.036 36.787 34.257 31.446 28.072
Graph
if (bl_graph_evf)
Graph 1, V and EV
if (~bl_graph_onebyones) figure('PaperPosition', [0 0 14 4]); hold on; end for subplot_j=1:1:2 if (~bl_graph_onebyones) hAxis(subplot_j) = subplot(1,2,subplot_j); else figure('PaperPosition', [0 0 7 4]); end if (subplot_j==1) chart = plot(mt_val); end if (subplot_j==2) chart = plot(mt_ev_condi_z); end clr = jet(numel(chart)); for m = 1:numel(chart) set(chart(m),'Color',clr(m,:)) end legend2plot = fliplr([1 round(numel(chart)/3) round((2*numel(chart))/3) numel(chart)]); legendCell = cellstr(num2str(ar_z', 'shock=%3.2f')); legend(chart(legend2plot), legendCell(legend2plot), 'Location','southeast'); if (subplot_j==1) title('V(coh,zp); w(k+b),k,z'); end if (subplot_j==2) title('E_z(V(coh,zp|z))'); end ylabel('Next Period Value'); xlabel({'Index of Cash-on-Hand Discrete Point'... 'Each Segment is a w=k+b; within segment increasing k'... 'EV and V identical if shock is fully persistent'}); grid on; grid minor; end % Share y axis if (~bl_graph_onebyones) linkaxes(hAxis,'y'); end % save file if (bl_img_save) mkdir(support_map('st_img_path')); st_file_name = [st_img_prefix st_img_name_main '_vev' st_img_suffix]; saveas(gcf, strcat(st_img_path, st_file_name)); end
Graph 2, max(EV)
if(~bl_graph_onebyones) figure('PaperPosition', [0 0 7 4]); end for sub_j=1:1:1 if(sub_j==1) mt_outcome = mt_ev_condi_z_max; st_y_label = 'max_{k''}(E(V(coh(k'',b''=w-k''),z''|z,w))'; end if(~bl_graph_onebyones) subplot(1,1,sub_j) else figure('PaperPosition', [0 0 7 4]); end hold on; ar_it_z_graph = ([1 round((it_z_n)/4) round(2*((it_z_n)/4)) round(3*((it_z_n)/4)) (it_z_n)]); clr = jet(length(ar_it_z_graph)); i_ctr = 0; for i = ar_it_z_graph i_ctr = i_ctr + 1; ar_x = ar_w_level; ar_y = mt_outcome(:, i); scatter(ar_x, ar_y, 5, ... 'MarkerEdgeColor', clr(i_ctr,:), ... 'MarkerFaceColor', clr(i_ctr,:)); end grid on; grid minor; title(['2nd Stage Exp Value at Optimal K given W=K''+B''']) ylabel(st_y_label) xlabel({'Aggregate Savings'}) legendCell = cellstr(num2str(ar_z', 'shock=%3.2f')); legendCell{length(legendCell) + 1} = 'max-agg-save'; legend(legendCell([ar_it_z_graph length(legendCell)]), 'Location','southeast'); xline0 = xline(0); xline0.HandleVisibility = 'off'; yline0 = yline(0); yline0.HandleVisibility = 'off'; end % save file if (bl_img_save) mkdir(support_map('st_img_path')); st_file_name = [st_img_prefix st_img_name_main '_maxev' st_img_suffix]; saveas(gcf, strcat(st_img_path, st_file_name)); end
Warning: Ignoring extra legend entries.
Graph 3, at max(EV) optimal choice category, color regions, borrow save
% Borrow Vs Save [ar_z_mw, ar_w_mz] = meshgrid(ar_z, ar_w_level); mt_it_borr_idx = (mt_ev_condi_z_max_bp < 0); mt_it_riskyhalf_idx = ((mt_ev_condi_z_max_kp./mt_ev_condi_z_max_bp) > 0.5); mt_it_kzero_idx = (mt_ev_condi_z_max_kp == 0); mt_it_isnan_idx = (isnan(mt_ev_condi_z_max_kp)); figure('PaperPosition', [0 0 7 4]); % States: ar_w, ar_z % Choices: mt_ev_condi_z_max_kp, mt_ev_condi_z_max_bp hold on; it_sca_size = 10; chart_br = scatter(ar_w_mz(mt_it_borr_idx),... ar_z_mw(mt_it_borr_idx),... it_sca_size, 'blue', 'filled'); % legend([chart_br], {'Borrow'}, 'Location','northeast'); chart_khalf = scatter(ar_w_mz(~mt_it_borr_idx & mt_it_riskyhalf_idx),... ar_z_mw(~mt_it_borr_idx & mt_it_riskyhalf_idx),... it_sca_size, 'black', 'filled'); % legend([chart_khalf], {'Save >0.5 K'}, 'Location','northeast'); chart_sv = scatter(ar_w_mz(~mt_it_borr_idx & ~mt_it_riskyhalf_idx),... ar_z_mw(~mt_it_borr_idx & ~mt_it_riskyhalf_idx),... it_sca_size, 'red', 'filled'); % legend([chart_sv], {'Save <0.5 K'}, 'Location','northeast'); chart_invalid = scatter(ar_w_mz(mt_it_kzero_idx | mt_it_isnan_idx),... ar_z_mw(mt_it_kzero_idx | mt_it_isnan_idx),... it_sca_size, 'yellow', 'filled'); legend([chart_br, chart_khalf, chart_sv, chart_invalid], ... {'Borrow','Save >0.5 K','Save <0.5 K', 'k=0 or k=nan'}, 'Location','northeast'); title('Borrow and Save Regions') ylabel('Shocks') xlabel({'Total Savings w=k+b'}) grid on; % save file if (bl_img_save) mkdir(support_map('st_img_path')); st_file_name = [st_img_prefix st_img_name_main '_maxbrsv' st_img_suffix]; saveas(gcf, strcat(st_img_path, st_file_name)); end
Graph 4, Optimal K' and B' Levels
[~, ar_w_mz] = meshgrid(ar_z, ar_w_level);
for sub_j=1:1:4
if (bl_graph_onebyones)
figure('PaperPosition', [0 0 7 4]);
end
if (sub_j==1)
if(~bl_graph_onebyones)
figure('PaperPosition', [0 0 14 4]);
subplot(1,2,sub_j);
end
mt_y = mt_ev_condi_z_max_bp;
end
if (sub_j==2)
if(~bl_graph_onebyones)
subplot(1,2,sub_j);
end
mt_y = mt_ev_condi_z_max_kp;
end
if (sub_j==3)
if(~bl_graph_onebyones)
figure('PaperPosition', [0 0 14 4]);
subplot(1,2,sub_j-2);
end
mt_y = zeros(size(mt_ev_condi_z_max_bp));
mt_it_borr_idx = (mt_ev_condi_z_max_bp < 0);
mt_y(mt_it_borr_idx) = -mt_ev_condi_z_max_bp(mt_it_borr_idx)/fl_b_bd;
mt_y(~mt_it_borr_idx) = mt_ev_condi_z_max_bp(~mt_it_borr_idx)./ar_w_mz(~mt_it_borr_idx);
end
if (sub_j==4)
if(~bl_graph_onebyones)
subplot(1,2,sub_j-2);
end
mt_y = mt_ev_condi_z_max_kp./(ar_w_level'-fl_b_bd);
end
hold on;
chart = plot(ar_w_level, mt_y);
clr = jet(numel(chart));
if (length(ar_w_level) <= 100)
scatter(ar_w_mz(:), mt_y(:), 3, 'filled', 'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'b');
end
for m = 1:numel(chart)
set(chart(m),'Color',clr(m,:))
end
legend2plot = fliplr([1 round(numel(chart)/3) round((2*numel(chart))/3) numel(chart)]);
legendCell = cellstr(num2str(ar_z', 'shock=%3.2f'));
xline0 = xline(0);
xline0.HandleVisibility = 'off';
yline0 = yline(0);
yline0.HandleVisibility = 'off';
grid on;
if (sub_j<=2)
hline = refline([1 0]);
hline.Color = 'k';
hline.LineStyle = ':';
hline.HandleVisibility = 'off';
end
if (sub_j==1)
title('B Choices of W');
ylabel('B Choices');
xlabel({'Total Savings w=k+b'});
legend(chart(legend2plot), legendCell(legend2plot), 'Location','northwest');
end
if (sub_j==2)
title('K Choices of W');
ylabel('K Choices');
xlabel({'Total Savings w=k+b'});
legend(chart(legend2plot), legendCell(legend2plot), 'Location','northwest');
end
if (sub_j==3)
title('B Fraction of Borrow Max and Save');
ylabel('B/bar(B) if br or B/W if sv');
xlabel({'Total Savings w=k+b'});
% set(gca, 'YScale', 'log');
ylim([-1.1 1.1]);
legend(chart(legend2plot), legendCell(legend2plot), 'Location','northwest');
end
if (sub_j==4)
title('K Fraction Choices of Total K Possible');
ylabel('K/(W-bar(b)) ');
xlabel({'Total Savings w=k+b'});
% set(gca, 'YScale', 'log');
ylim([0 1.1]);
legend(chart(legend2plot), legendCell(legend2plot), 'Location','northeast');
end
end
% save file
if (bl_img_save)
mkdir(support_map('st_img_path'));
st_file_name = [st_img_prefix st_img_name_main '_wkbopti' st_img_suffix];
saveas(gcf, strcat(st_img_path, st_file_name));
end
end
Display Various Containers
if (bl_display_evf)
Display 1 support_map
fft_container_map_display(support_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
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 = true
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 = true
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_ipwkbz_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 1
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 1
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
Display 2 armt_map
fft_container_map_display(armt_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: ARMT_MAP
----------------------------------------
Map with properties:
Count: 18
KeyType: char
ValueType: any
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = ar_a_meshk ;rown= 62250 ,coln= 1
ar_a_meshk :mu= -2.5301 ,sd= 15.4852 ,min= -20 ,max= 50
zi_1_c1
_______
zi_1_R1 -20
zi_2_R2 -20
zi_3_R3 -20
zi_31125_r31125 -2.5009
zi_62248_r62248 -19.438
zi_62249_r62249 -19.719
zi_62250_r62250 -20
pos = 2 ; key = ar_ak_perc ;rown= 1 ,coln= 250
ar_ak_perc :mu= 0.5 ,sd= 0.29041 ,min= 0 ,max= 1
zi_1_C1 zi_2_C2 zi_3_C3 zi_125_c125 zi_248_c248 zi_249_c249 zi_250_c250
_______ _________ _________ ___________ ___________ ___________ ___________
zi_1_r1 0 0.0040161 0.0080321 0.49799 0.99197 0.99598 1
pos = 3 ; key = ar_interp_c_grid ;rown= 1 ,coln= 772572
ar_interp_c_grid :mu= 38.6486 ,sd= 22.3023 ,min= 0.02 ,max= 77.2773
zi_1_C1 zi_2_C2 zi_3_C3 zi_386286_c386286 zi_772570_c772570 zi_772571_c772571 zi_772572_c772572
_______ _______ _______ _________________ _________________ _________________ _________________
zi_1_r1 0.02 0.0201 0.0202 38.649 77.277 77.277 77.277
pos = 4 ; key = ar_interp_coh_grid ;rown= 1 ,coln= 772
ar_interp_coh_grid :mu= 18.6145 ,sd= 22.347 ,min= -20 ,max= 57.2773
zi_1_C1 zi_2_C2 zi_3_C3 zi_386_c386 zi_770_c770 zi_771_c771 zi_772_c772
_______ _______ _______ ___________ ___________ ___________ ___________
zi_1_r1 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
pos = 5 ; key = ar_k_mesha ;rown= 62250 ,coln= 1
ar_k_mesha :mu= 17.4699 ,sd= 15.4852 ,min= 0 ,max= 70
zi_1_c1
_______
zi_1_R1 0
zi_2_R2 0
zi_3_R3 0
zi_31125_r31125 17.359
zi_62248_r62248 69.438
zi_62249_r62249 69.719
zi_62250_r62250 70
pos = 6 ; key = ar_stationary ;rown= 1 ,coln= 15
ar_stationary :mu= 0.066667 ,sd= 0.060897 ,min= 0.0027089 ,max= 0.16757
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
_________ _________ ________ _______ _________ _________ _________
zi_1_r1 0.0027089 0.0069499 0.018507 0.16757 0.018507 0.0069499 0.0027089
pos = 7 ; key = ar_w_level ;rown= 1 ,coln= 249
ar_w_level :mu= 14.9398 ,sd= 20.3112 ,min= -20 ,max= 50
zi_1_C1 zi_2_C2 zi_3_C3 zi_125_c125 zi_247_c247 zi_248_c248 zi_249_c249
_______ _______ _______ ___________ ___________ ___________ ___________
zi_1_r1 -20 -19.717 -19.433 14.858 49.433 49.717 50
pos = 8 ; key = ar_w_perc ;rown= 1 ,coln= 50
ar_w_perc :mu= 0.5 ,sd= 0.2975 ,min= 0 ,max= 1
zi_1_C1 zi_2_C2 zi_3_C3 zi_25_c25 zi_48_c48 zi_49_c49 zi_50_c50
_______ ________ ________ _________ _________ _________ _________
zi_1_r1 0 0.020408 0.040816 0.4898 0.95918 0.97959 1
pos = 9 ; key = ar_z ;rown= 1 ,coln= 15
ar_z :mu= 1.1347 ,sd= 0.69878 ,min= 0.34741 ,max= 2.567
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
_______ _______ _______ _______ _________ _________ _________
zi_1_r1 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
pos = 10 ; key = it_ameshk_n ; val = 62250
pos = 11 ; key = mt_coh_wkb ;rown= 62250 ,coln= 15
mt_coh_wkb :mu= 16.1912 ,sd= 20.8936 ,min= -21.4564 ,max= 57.2773
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
_______ _______ _______ _______ _________ _________ _________
zi_1_R1 -21.456 -21.456 -21.456 -21.456 -21.456 -21.456 -21.456
zi_2_R2 -21.456 -21.456 -21.456 -21.456 -21.456 -21.456 -21.456
zi_3_R3 -21.456 -21.456 -21.456 -21.456 -21.456 -21.456 -21.456
zi_31125_r31125 14.646 14.795 14.967 16.314 19.065 19.893 20.848
zi_62248_r62248 44.641 44.886 45.17 47.388 51.92 53.284 54.856
zi_62249_r62249 44.594 44.84 45.124 47.345 51.884 53.249 54.824
zi_62250_r62250 44.547 44.793 45.077 47.302 51.848 53.215 54.792
pos = 12 ; key = mt_interp_coh_grid_mesh_w_perc ;rown= 50 ,coln= 772
mt_interp_coh_grid_mesh_w_perc :mu= 18.6145 ,sd= 22.3329 ,min= -20 ,max= 57.2773
zi_1_C1 zi_2_C2 zi_3_C3 zi_386_c386 zi_770_c770 zi_771_c771 zi_772_c772
_______ _______ _______ ___________ ___________ ___________ ___________
zi_1_R1 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
zi_2_R2 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
zi_3_R3 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
zi_25_r25 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
zi_48_r48 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
zi_49_r49 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
zi_50_r50 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
pos = 13 ; key = mt_interp_coh_grid_mesh_z ;rown= 772 ,coln= 15
mt_interp_coh_grid_mesh_z :mu= 18.6145 ,sd= 22.3335 ,min= -20 ,max= 57.2773
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
_______ _______ _______ _______ _________ _________ _________
zi_1_R1 -20 -20 -20 -20 -20 -20 -20
zi_2_R2 -19.9 -19.9 -19.9 -19.9 -19.9 -19.9 -19.9
zi_3_R3 -19.799 -19.799 -19.799 -19.799 -19.799 -19.799 -19.799
zi_386_r386 18.538 18.538 18.538 18.538 18.538 18.538 18.538
zi_770_r770 57.077 57.077 57.077 57.077 57.077 57.077 57.077
zi_771_r771 57.177 57.177 57.177 57.177 57.177 57.177 57.177
zi_772_r772 57.277 57.277 57.277 57.277 57.277 57.277 57.277
pos = 14 ; key = mt_k ;rown= 250 ,coln= 249
mt_k :mu= 17.4699 ,sd= 15.4852 ,min= 0 ,max= 70
zi_1_C1 zi_2_C2 zi_3_C3 zi_125_c125 zi_247_c247 zi_248_c248 zi_249_c249
_______ _________ _________ ___________ ___________ ___________ ___________
zi_1_R1 0 0 0 0 0 0 0
zi_2_R2 0 0.0011382 0.0022763 0.13999 0.27885 0.27999 0.28112
zi_3_R3 0 0.0022763 0.0045526 0.27999 0.5577 0.55997 0.56225
zi_125_r125 0 0.14113 0.28226 17.359 34.577 34.718 34.859
zi_248_r248 0 0.28112 0.56225 34.578 68.876 69.157 69.438
zi_249_r249 0 0.28226 0.56453 34.718 69.154 69.437 69.719
zi_250_r250 0 0.2834 0.5668 34.858 69.433 69.717 70
pos = 15 ; key = mt_w_by_interp_coh_interp_grid ;rown= 50 ,coln= 772
mt_w_by_interp_coh_interp_grid :mu= -0.69276 ,sd= 17.2418 ,min= -20 ,max= 57.2773
zi_1_C1 zi_2_C2 zi_3_C3 zi_386_c386 zi_770_c770 zi_771_c771 zi_772_c772
_______ _______ _______ ___________ ___________ ___________ ___________
zi_1_R1 -20 -20 -20 -20 -20 -20 -20
zi_2_R2 -20 -19.998 -19.996 -19.214 -18.427 -18.425 -18.423
zi_3_R3 -20 -19.996 -19.992 -18.427 -16.854 -16.85 -16.846
zi_25_r25 -20 -19.951 -19.902 -1.1241 17.752 17.801 17.85
zi_48_r48 -20 -19.904 -19.807 16.965 53.931 54.027 54.123
zi_49_r49 -20 -19.902 -19.803 17.752 55.504 55.602 55.7
zi_50_r50 -20 -19.9 -19.799 18.538 57.077 57.177 57.277
pos = 16 ; key = mt_z_mesh_coh_interp_grid ;rown= 772 ,coln= 15
mt_z_mesh_coh_interp_grid :mu= 1.1347 ,sd= 0.67511 ,min= 0.34741 ,max= 2.567
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
_______ _______ _______ _______ _________ _________ _________
zi_1_R1 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_2_R2 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_3_R3 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_386_r386 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_770_r770 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_771_r771 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_772_r772 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
pos = 17 ; key = mt_z_mesh_coh_wkb ;rown= 62250 ,coln= 15
mt_z_mesh_coh_wkb :mu= 1.1347 ,sd= 0.67508 ,min= 0.34741 ,max= 2.567
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
_______ _______ _______ _______ _________ _________ _________
zi_1_R1 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_2_R2 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_3_R3 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_31125_r31125 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_62248_r62248 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_62249_r62249 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
zi_62250_r62250 0.34741 0.40076 0.4623 0.94436 1.9291 2.2253 2.567
pos = 18 ; key = mt_z_trans ;rown= 15 ,coln= 15
mt_z_trans :mu= 0.066667 ,sd= 0.095337 ,min= 0 ,max= 0.27902
zi_1_C1 zi_2_C2 zi_3_C3 zi_8_C8 zi_13_c13 zi_14_c14 zi_15_c15
__________ __________ __________ __________ __________ __________ __________
zi_1_R1 0.26016 0.26831 0.25551 0.00012823 2.7001e-13 1.1102e-15 0
zi_2_R2 0.11232 0.19622 0.2763 0.00098855 1.5289e-11 9.3592e-14 3.3307e-16
zi_3_R3 0.037073 0.10492 0.2185 0.0055558 6.2811e-10 5.7438e-12 3.1863e-14
zi_8_R8 1.7181e-06 4.1008e-05 0.00061112 0.27902 0.00061112 4.1008e-05 1.7181e-06
zi_13_r13 3.1909e-14 5.7438e-12 6.2811e-10 0.0055558 0.2185 0.10492 0.037073
zi_14_r14 3.474e-16 9.3597e-14 1.5289e-11 0.00098855 0.2763 0.19622 0.11232
zi_15_r15 2.7412e-18 1.1057e-15 2.6998e-13 0.00012823 0.25551 0.26831 0.26016
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Matrix in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx rowN colN mean std min max
__ ___ _____ __________ ________ ________ _________ _______
ar_a_meshk 1 1 62250 1 -2.5301 15.485 -20 50
ar_ak_perc 2 2 1 250 0.5 0.29041 0 1
ar_interp_c_grid 3 3 1 7.7257e+05 38.649 22.302 0.02 77.277
ar_interp_coh_grid 4 4 1 772 18.614 22.347 -20 57.277
ar_k_mesha 5 5 62250 1 17.47 15.485 0 70
ar_stationary 6 6 1 15 0.066667 0.060897 0.0027089 0.16757
ar_w_level 7 7 1 249 14.94 20.311 -20 50
ar_w_perc 8 8 1 50 0.5 0.2975 0 1
ar_z 9 9 1 15 1.1347 0.69878 0.34741 2.567
mt_coh_wkb 10 11 62250 15 16.191 20.894 -21.456 57.277
mt_interp_coh_grid_mesh_w_perc 11 12 50 772 18.614 22.333 -20 57.277
mt_interp_coh_grid_mesh_z 12 13 772 15 18.614 22.334 -20 57.277
mt_k 13 14 250 249 17.47 15.485 0 70
mt_w_by_interp_coh_interp_grid 14 15 50 772 -0.69276 17.242 -20 57.277
mt_z_mesh_coh_interp_grid 15 16 772 15 1.1347 0.67511 0.34741 2.567
mt_z_mesh_coh_wkb 16 17 62250 15 1.1347 0.67508 0.34741 2.567
mt_z_trans 17 18 15 15 0.066667 0.095337 0 0.27902
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx value
_ ___ _____
it_ameshk_n 1 10 62250
Display 3 param_map
fft_container_map_display(param_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: PARAM_MAP
----------------------------------------
Map with properties:
Count: 35
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_borr ; val = 0.095
pos = 15 ; key = fl_r_save ; val = 0.025
pos = 16 ; key = fl_tol_dist ; val = 1e-05
pos = 17 ; key = fl_tol_pol ; val = 1e-05
pos = 18 ; key = fl_tol_val ; val = 1e-05
pos = 19 ; key = fl_w ; val = 0.44365
pos = 20 ; key = fl_w_interp_grid_gap ; val = 0.28
pos = 21 ; key = fl_w_max ; val = 50
pos = 22 ; key = fl_w_min ; val = -20
pos = 23 ; key = fl_z_mu ; val = 0
pos = 24 ; key = fl_z_rho ; val = 0.8
pos = 25 ; key = fl_z_sig ; val = 0.2
pos = 26 ; key = it_ak_perc_n ; val = 250
pos = 27 ; key = it_c_interp_grid_gap ; val = 0.0001
pos = 28 ; key = it_maxiter_dist ; val = 1000
pos = 29 ; key = it_maxiter_val ; val = 250
pos = 30 ; key = it_tol_pol_nochange ; val = 25
pos = 31 ; key = it_w_perc_n ; val = 50
pos = 32 ; key = it_z_n ; val = 15
pos = 33 ; key = st_analytical_stationary_type ; val = eigenvector
pos = 34 ; key = st_model ; val = ipwkbz
pos = 35 ; key = st_v_coh_z_interp_method ; val = method_cell
----------------------------------------
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_borr 14 14 0.095
fl_r_save 15 15 0.025
fl_tol_dist 16 16 1e-05
fl_tol_pol 17 17 1e-05
fl_tol_val 18 18 1e-05
fl_w 19 19 0.44365
fl_w_interp_grid_gap 20 20 0.28
fl_w_max 21 21 50
fl_w_min 22 22 -20
fl_z_mu 23 23 0
fl_z_rho 24 24 0.8
fl_z_sig 25 25 0.2
it_ak_perc_n 26 26 250
it_c_interp_grid_gap 27 27 0.0001
it_maxiter_dist 28 28 1000
it_maxiter_val 29 29 250
it_tol_pol_nochange 30 30 25
it_w_perc_n 31 31 50
it_z_n 32 32 15
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx
_ ___
st_analytical_stationary_type 1 33
st_model 2 34
st_v_coh_z_interp_method 3 35
Display 4 func_map
fft_container_map_display(func_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: FUNC_MAP
----------------------------------------
Map with properties:
Count: 7
KeyType: char
ValueType: any
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = f_coh ; val = @(z,b,k)(f_prod(z,k)+k*(1-fl_delta)+fl_w+b.*(1+fl_r_save).*(b>0)+b.*(1+fl_r_borr).*(b<=0))
pos = 2 ; key = f_cons ; val = @(coh,bprime,kprime)(coh-kprime-bprime)
pos = 3 ; key = f_inc ; val = @(z,b,k)(f_prod(z,k)-(fl_delta)*k+fl_w+b.*(fl_r_save).*(b>0)+b.*(fl_r_borr).*(b<=0))
pos = 4 ; key = f_prod ; val = @(z,k)((fl_Amean.*(z)).*(k.^(fl_alpha)))
pos = 5 ; key = f_util_crra ; val = @(c)(((c).^(1-fl_crra)-1)./(1-fl_crra))
pos = 6 ; key = f_util_log ; val = @(c)log(c)
pos = 7 ; key = f_util_standin ; val = @(z,b,k)f_util_log((f_coh(z,b,k)-fl_b_bd).*((f_coh(z,b,k)-fl_b_bd)>fl_c_min)+fl_c_min.*((f_coh(z,b,k)-fl_b_bd)<=fl_c_min))
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx xFunction
_ ___ _________
f_coh 1 1 1
f_cons 2 2 2
f_inc 3 3 3
f_prod 4 4 4
f_util_crra 5 5 5
f_util_log 6 6 6
f_util_standin 7 7 7
end
end