This is a static copy of a profile report

Home

Function details for ffs_ipwkbzr_set_default_paramThis is a static copy of a profile report

Home

ffs_ipwkbzr_set_default_param (Calls: 1, Time: 0.036 s)
Generated 27-Jul-2019 21:16:51 using performance time.
function in file C:\Users\fan\CodeDynaAsset\m_ipwkbzr\paramfunc\ffs_ipwkbzr_set_default_param.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
ff_ipwkbzr_vf_vecsvfunction1
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
177
[param_map_ipwkbz, support_map...
10.014 s38.8%
119
close all;
10.009 s25.5%
121
if (ismember(it_subset, [3]))
10.003 s9.7%
146
elseif (ismember(it_subset, [5...
10.003 s9.4%
102
[st_root_path] = preamble(fals...
10.001 s3.1%
All other lines  0.005 s13.6%
Totals  0.036 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
ffs_ipwkz_set_default_paramfunction10.013 s37.3%
closefunction10.009 s24.8%
ismemberfunction30.007 s18.6%
preamblefunction10.001 s2.2%
Self time (built-ins, overhead, etc.)  0.006 s17.2%
Totals  0.036 s100% 
Code Analyzer results
Line numberMessage
121Use of brackets [] is unnecessary. Use parentheses to group, if needed.
125Use of brackets [] is unnecessary. Use parentheses to group, if needed.
131Use of brackets [] is unnecessary. Use parentheses to group, if needed.
144Use of brackets [] is unnecessary. Use parentheses to group, if needed.
148Use of brackets [] is unnecessary. Use parentheses to group, if needed.
156Use of brackets [] is unnecessary. Use parentheses to group, if needed.
Coverage results
Show coverage for parent directory
Total lines in function209
Non-code lines (comments, blank lines)126
Code lines (lines that can run)83
Code lines that did run49
Code lines that did not run34
Coverage (did run/can run)59.04 %
Function listing
time 
Calls 
 line
   7 
function [param_map, support_map] = ffs_ipwkbzr_set_default_param(varargin)
   8 
%% FFS_IPKBZR_SET_DEFAULT_PARAM setting model default parameters
   9 
% Define model parameters, similar to
  10 
% <https://fanwangecon.github.io/CodeDynaAsset/m_akz/paramfunc/html/ffs_akz_set_default_param.html
  11 
% ffs_akz_set_default_param> see that file for descriptions.
  12 
%
  13 
% Several changes here: 1, inclusion of percentage based choice grids
  14 
%
  15 
% @param it_subset integer default parameter control subsetting. it_subset = 1 is
  16 
% basic invoke quick test. it_subset = 2 is main invoke. it_subset = 3 is
  17 
% profiling invoke. it_subset = 4 is matlab publish.
  18 
%
  19 
% @param bl_display_defparam boolean local printing
  20 
%
  21 
% @return param_map container parameters needed for solving the model
  22 
%
  23 
% @return support_map container programming control parameters like to graph to print etc
  24 
%
  25 
% @example
  26 
%
  27 
%   it_param_set = 1;
  28 
%   [param_map, support_map] = ffs_ipwkbzr_set_default_param(it_param_set);
  29 
%
  30 
% @include
  31 
%
  32 
% *<https://fanwangecon.github.io/CodeDynaAsset/m_ipwkz/paramfunc/html/ffs_ipwkz_set_default_param.html ffs_ipwkz_set_default_param>
  33 
%
  34 

  35 
%% Default
  36 

< 0.001 
      1 
  37
it_subset = 4; 
      1 
  38
if (isempty(varargin)) 
  39 
    bl_display_defparam = true;
      1 
  40
else 
< 0.001 
      1 
  41
    bl_display_defparam = false; 
      1 
  42
end 
< 0.001 
      1 
  43
default_params = {it_subset bl_display_defparam}; 
< 0.001 
      1 
  44
[default_params{1:length(varargin)}] = varargin{:}; 
< 0.001 
      1 
  45
[it_subset, bl_display_defparam] = default_params{:}; 
  46 

  47 
%% 1. Initiate Param_map
  48 

< 0.001 
      1 
  49
param_map = containers.Map('KeyType','char', 'ValueType','any'); 
  50 

  51 
% model name
< 0.001 
      1 
  52
param_map('st_model') = 'ipwkbzr'; 
  53 

  54 
% v(coh, z) interpolation method
< 0.001 
      1 
  55
param_map('st_v_coh_z_interp_method') = 'method_cell'; 
  56 

  57 
%% 2a. Borrowing Default Parameters
  58 

< 0.001 
      1 
  59
param_map('fl_b_bd') = -20; 
< 0.001 
      1 
  60
param_map('fl_w_min') = param_map('fl_b_bd'); 
< 0.001 
      1 
  61
param_map('fl_w_max') = 50; 
< 0.001 
      1 
  62
param_map('fl_k_max') = (param_map('fl_w_max') - param_map('fl_b_bd')); 
  63 

< 0.001 
      1 
  64
param_map('fl_c_min') = 0.02; 
< 0.001 
      1 
  65
param_map('fl_default_wprime') = 0; % wprime not a prime 
< 0.001 
      1 
  66
param_map('bl_default') = true; % if borrowing is default allowed 
  67 

  68 
%% 2b. Set Shock 1 Borrowing Interest Rate Parameters
  69 
% See
  70 
% <https://fanwangecon.github.io/CodeDynaAsset/tools/html/fft_gen_discrete_var.html
  71 
% fft_gen_discrete_var> for how these parameters will be used to generate a
  72 
% discrete random variable for the interest rate.
  73 

< 0.001 
      1 
  74
param_map('st_z_r_borr_drv_ele_type') = 'unif'; 
< 0.001 
      1 
  75
param_map('st_z_r_borr_drv_prb_type') = 'poiss'; 
< 0.001 
      1 
  76
param_map('fl_z_r_borr_poiss_mean') = 20; 
< 0.001 
      1 
  77
param_map('fl_z_r_borr_max') = 0.095; 
< 0.001 
      1 
  78
param_map('fl_z_r_borr_min') = 0.025; 
< 0.001 
      1 
  79
param_map('fl_z_r_borr_n') = 5; 
  80 
% param_map('fl_z_r_borr_max') = 0.095;
  81 
% param_map('fl_z_r_borr_min') = 0.095;
  82 
% param_map('fl_z_r_borr_n') = 1;
  83 

  84 
%% 2c. Set Shock 2 Productivity Shock Parameters
  85 

  86 
% Production Function
  87 
% Productivity Shock Parameters
< 0.001 
      1 
  88
param_map('it_z_wage_n') = 11; 
< 0.001 
      1 
  89
param_map('fl_z_wage_mu') = 0; 
< 0.001 
      1 
  90
param_map('fl_z_wage_rho') = 0.8; 
< 0.001 
      1 
  91
param_map('fl_z_wage_sig') = 0.2; 
  92 

  93 
%% 2d. Set Overall Shock Grid Count
  94 

< 0.001 
      1 
  95
param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n'); 
  96 

  97 
%% Setting support_map container
  98 

< 0.001 
      1 
  99
support_map = containers.Map('KeyType','char', 'ValueType','any'); 
 100 

 101 
% root directory
  0.001 
      1 
 102
[st_root_path] = preamble(false); 
< 0.001 
      1 
 103
st_matimg_path_root = [st_root_path '/m_ipwkbzr/']; 
< 0.001 
      1 
 104
support_map('st_matimg_path_root') = st_matimg_path_root; 
< 0.001 
      1 
 105
support_map('st_profile_path') = [st_matimg_path_root '/solve/profile/']; 
< 0.001 
      1 
 106
support_map('st_mat_path') = [st_matimg_path_root '/solve/mat/']; 
< 0.001 
      1 
 107
support_map('st_img_path') = [st_matimg_path_root '/solve/img/']; 
< 0.001 
      1 
 108
support_map('st_mat_test_path') = [st_matimg_path_root '/test/ff_ipwkbzr_ds_vecsv/mat/']; 
 109 

 110 
%% Subset Options
 111 
%
 112 
% # it_subset = 1 is basic invoke quick test
 113 
% # it_subset = 2 is main invoke
 114 
% # it_subset = 3 is profiling invoke
 115 
% # it_subset = 4 is matlab publish.
 116 
%
 117 

 118 
% close figures
  0.009 
      1 
 119
close all; 
 120 

  0.003 
      1 
 121
if (ismember(it_subset, [3])) 
 122 
    % Profile run
 123 
elseif (ismember(it_subset, [1,2,4]))
 124 
    % Main Run
 125 
    if (ismember(it_subset, [1]))
 126 
        % TEST quick
 127 
        param_map('it_z_wage_n') = 5;
 128 
        param_map('fl_z_r_borr_n') = 3;
 129 
        param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n');
 130 
    end
 131 
    if (ismember(it_subset, [4]))
 132 
    end
 133 
end
 134 

 135 
%% Subset Options for Distribution solutions
 136 
%
 137 
% # it_subset = 5 is basic invoke quick test
 138 
% # it_subset = 6 is invoke full test
 139 
% # it_subset = 7 is profiling invoke
 140 
% # it_subset = 8 is matlab publish
 141 
% # it_subset = 9 is invoke operational (only final stats) and coh graph
 142 
%
 143 

< 0.001 
      1 
 144
if (ismember(it_subset, [7])) 
 145 
    % Profile run
  0.003 
      1 
 146
elseif (ismember(it_subset, [5,6,8,9])) 
 147 
    % Main Run
 148 
    if (ismember(it_subset, [5]))
 149 
        % TEST quick (need to enough to have distribution)
 150 
        param_map('it_z_wage_n') = 5;
 151 
        param_map('fl_z_r_borr_n') = 3;
 152 
        param_map('it_z_n') = param_map('it_z_wage_n') * param_map('fl_z_r_borr_n');
 153 
    end
 154 

 155 
    if (ismember(it_subset, [8, 9]))
 156 
        if (ismember(it_subset, [9]))
 157 
            % quietly turn off all graphs, only tables
 158 
        end
 159 
    end
 160 
end
 161 

 162 
%% Display New Parameters
 163 

< 0.001 
      1 
 164
if (bl_display_defparam) 
 165 

 166 
    disp('----------------------------------------');
 167 
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 168 
    disp('Display Parameters Specific to IPWKBZR')
 169 
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 170 

 171 
    fft_container_map_display(param_map);
 172 
    fft_container_map_display(support_map);
 173 
end
 174 

 175 
%% 3. Merge Parameters Import
 176 

  0.014 
      1 
 177
[param_map_ipwkbz, support_map_ipwkbz] = ffs_ipwkz_set_default_param(it_subset); 
 178 

 179 
% Remove Keys not Relevant for the Interest Rate Shock Model
< 0.001 
      1 
 180
cl_st_ipwkbz_keysdrop = {'fl_z_rho', 'fl_z_mu', 'fl_z_sig', ... 
 181 
                         'fl_r_borr'};
< 0.001 
      1 
 182
remove(param_map_ipwkbz, cl_st_ipwkbz_keysdrop); 
 183 

 184 
% Merge
< 0.001 
      1 
 185
param_map = [param_map_ipwkbz; param_map]; 
< 0.001 
      1 
 186
support_map = [support_map_ipwkbz; support_map]; 
 187 

 188 
% if (bl_display_defparam)
 189 
%
 190 
%     disp('----------------------------------------');
 191 
%     disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 192 
%     disp('Display Parameters imported from IPWKBZ')
 193 
%     disp('Dropped Keys:')
 194 
%     disp(cl_st_ipwkbz_keysdrop)
 195 
%     disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 196 
%
 197 
%     fft_container_map_display(param_map_ipwkbz);
 198 
%     fft_container_map_display(support_map_ipwkbz);
 199 
% end
 200 

 201 

 202 
%% Display All Parameters
 203 

      1 
 204
if (bl_display_defparam) 
 205 

 206 
    disp('----------------------------------------');
 207 
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 208 
    disp('Display All Parameters with IPWKBZR overriding IPWKBZR')
 209 
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 210 

 211 
    fft_container_map_display(param_map);
 212 
    fft_container_map_display(support_map);
 213 
end
 214 

< 0.001 
      1 
 215
end 

Other subfunctions in this file are not included in this listing.