Assign parameter values
Function defines and assigns values to model parameter and support variabes. Stores these variables in containers called params_map and support_map respectively. Displays parameters with their values in table form.
Back to full code page https://kritikhanna.github.io/BKS-modified/
Function Inputs : it_model_param
- it_model_param : type of model no - 1 for Aiyagari, 2 for BKS simplified, 3 for 3 OC model - 2 shocks, Yona assumptions
Function Outputs : Container maps params_map and support_map containing model parameters
Contents
function [params_map, support_map] = ff_params_set(varargin)
Function default parameters setting
if ~isempty(varargin) [it_model_param] = varargin{:} bl_display_param = true; else it_model_param = 2; bl_display_param = true; end
Aiyagari Parameters
if (it_model_param == 1)
% Preferences fl_beta = 0.96; % Discount factor fl_risk = 3; % coefficient of relative risk aversion % Productivity shock parameters fl_mu = 0.8; % mean of AR(1) productivity process fl_rho = 0.6; % persistence parameter of the AR(1) productivity process fl_sig = 0.2; % standard deviation of shock of productivity process fl_lambda = 3; % parameter determining bounds of productivity process % Production function and other main model parameters fl_A = 1; % TFP fl_alpha = 0.36; % Elasticity of output with respect to capital fl_delta = 0.08; % Depreciation of capital fl_N = 1; % Population size % Asset and productivity grid parameters it_lgridno = 7; % No of points on productivity Grid it_agridno = 100; % No of points on asset Grid fl_alo = 0; % lower limit of asset grid fl_ahi = 50; % Upper limit of asset grid % Interest rate parameters fl_r = 0.0286; % Guess of interest rate fl_r1 = -fl_delta; % Lower bound for interest rate fl_r2 = (1-fl_beta)/fl_beta; % Upper bound for interest rate fl_R = fl_r + fl_delta; % Rental rate % Convergence criterion parameters fl_tolvfi = 10^-6; % tolerance level for convergence of value function fl_toldis = 10^-5; % tolerance level for convergence of stationary distribution fl_toleq = 10^-6; % tolerance for solving equilibrium r % Variables for storing path and image names for different outputs st_img_path ='/Users/sidhantkhanna/Desktop/Research/Matlab Code/My codes/Model'; % Path for Storing images st_img_name ='saveoutput'; % File name of output file to be stored % Adding parameters in container params_map params_map = containers.Map('KeyType', 'char', 'ValueType', 'any'); params_map('fl_beta') = fl_beta; params_map('fl_risk') = fl_risk; params_map('fl_mu') = fl_mu; params_map('fl_rho') = fl_rho; params_map('fl_sig') = fl_sig; params_map('fl_lambda') = fl_lambda; params_map('fl_alpha') = fl_alpha; params_map('fl_delta') = fl_delta; params_map('fl_A') = fl_A; params_map('fl_N') = fl_N; params_map('it_lgridno') = it_lgridno; params_map('it_agridno') = it_agridno; params_map('fl_alo') = fl_alo; params_map('fl_ahi') = fl_ahi; params_map('fl_r') = fl_r; params_map('fl_R') = fl_R; params_map('fl_r1') = fl_r1; params_map('fl_r2') = fl_r2; params_map('fl_tolvfi') = fl_tolvfi; params_map('fl_toldis') = fl_toldis; params_map('fl_toleq') = fl_toleq; % Adding parameters in container support_map support_map = containers.Map('KeyType', 'char', 'ValueType', 'any'); support_map('st_img_path') = st_img_path; support_map('st_img_name') = st_img_name; ar_params_names = keys(params_map); % Variables defined in params_map ar_params_values = values(params_map); % Values of variables defined in params_map
Displaying Aiyagari parameters in a table
if (bl_display_param == true) tb_params_map = table(ar_params_names' , ar_params_values'); tb_params_map.Properties.VariableNames = {'Parameter_name', 'Value'}; disp(tb_params_map) end
BKS (2 OC) Parameters
elseif (it_model_param == 2) % BKS
% Preferences fl_beta = 0.92; % Discount factor fl_risk = 1.5; % coefficient of relative risk aversion % Entrepreneurship productivity shock parameters fl_mu = 0; % mean of AR(1) entrepeneurial productivity process fl_rho = 0.9; % persistence parameter of the AR(1) entrepreneurial productivity process fl_sig = 0.2; % standard deviation of shock of entrepreneurial productivity process fl_lambda = 3; % parameter determining bounds of entrepreneurial productivity process % Production function parameters fl_alpha = 0.36; % Elasticity of output with respect to capital fl_theta = 0.79-fl_alpha; % Elasticity of output with respect to labor fl_kappa = 0; % Sunk cost involved in production % Other main model parameters fl_delta = 0.06; % Depreciation of capital fl_N = 1; % Population size % Asset, capital, productivity grid parameters it_zgridno = 10; % No of Points on Income Grid it_agridno = 100; % No of Points on Asset Grid it_k_n = 10000; % No of Points on Capital Grid fl_alo = 0; % Lower limit of asset grid fl_ahi = 50; % Upper limit of asset grid % Convergence Criterion parameters fl_tolvfi = 10^-12; % Tolerance level for convergence of value function fl_toldis = 10^-12; % Tolerance level for convergence stationary distribution % Variables for storing path and image names for different outputs st_img_path = '/Users/sidhantkhanna/Desktop/Research/Matlab Code/My codes/Model'; % Path for Storing images st_img_name = 'saveoutput'; % File name of output file to be stored % Solving PE/GE related parameters fl_r = 0.0467; % interest rate fl_w = 1.0667; % wages fl_phi = 1; % institutional efficiency fl_R = fl_r + fl_delta; % rental rate it_r_gridpoints = 10; % No of points on interest rate grid it_w_gridpoints = 10; % No of points on wages grid ar_r = linspace(0.04,0.09,it_r_gridpoints); % array for interest rate guesses to solve GE price ar_w = linspace(1.5,2.5,it_w_gridpoints); % array for wage rate guesses to solve GE prices ar_R = ar_r +fl_delta*ones(1,it_r_gridpoints); % array for rental rate guesses to solve GE prices % Adding parameters in container params_map params_map = containers.Map('KeyType', 'char', 'ValueType', 'any'); params_map('fl_beta') = fl_beta; params_map('fl_risk') = fl_risk; params_map('fl_mu') = fl_mu; params_map('fl_rho') = fl_rho; params_map('fl_sig') = fl_sig; params_map('fl_lambda') = fl_lambda; params_map('fl_alpha') = fl_alpha; params_map('fl_theta') = fl_theta; params_map('fl_kappa') = fl_kappa; params_map('fl_delta') = fl_delta; params_map('fl_N') = fl_N; params_map('it_agridno') = it_agridno; params_map('it_zgridno') = it_zgridno; params_map('fl_alo') = fl_alo; params_map('fl_ahi') = fl_ahi; params_map('fl_tolvfi') = fl_tolvfi; params_map('fl_toldis') = fl_toldis; params_map('fl_r') = fl_r; params_map('fl_w') = fl_w; params_map('fl_phi') = fl_phi; params_map('fl_R') = fl_R; params_map('ar_r') = ar_r; params_map('ar_w') = ar_w; params_map('ar_R') = ar_R; % Adding parameters in container support_map support_map = containers.Map('KeyType', 'char', 'ValueType', 'any'); support_map('st_img_path') = st_img_path; support_map('st_img_name') = st_img_name; ar_params_names = keys(params_map); % Variables defined in params_map ar_params_values = values(params_map); % Values of variables defined in params_map
Displaying BKS (2 OC) parameters in a table
if (bl_display_param == true) tb_params_map = table(ar_params_names' , ar_params_values'); tb_params_map.Properties.VariableNames = {'Parameter_name', 'Value'}; disp(tb_params_map) end
Parameter_name Value ______________ _____________ 'ar_R' [1×10 double] 'ar_r' [1×10 double] 'ar_w' [1×10 double] 'fl_N' [ 1] 'fl_R' [ 0.1067] 'fl_ahi' [ 50] 'fl_alo' [ 0] 'fl_alpha' [ 0.3600] 'fl_beta' [ 0.9200] 'fl_delta' [ 0.0600] 'fl_kappa' [ 0] 'fl_lambda' [ 3] 'fl_mu' [ 0] 'fl_phi' [ 1] 'fl_r' [ 0.0467] 'fl_rho' [ 0.9000] 'fl_risk' [ 1.5000] 'fl_sig' [ 0.2000] 'fl_theta' [ 0.4300] 'fl_toldis' [ 1.0000e-12] 'fl_tolvfi' [ 1.0000e-12] 'fl_w' [ 1.0667] 'it_agridno' [ 100] 'it_zgridno' [ 10]
BKS (3 OC) Parameters - 2 shocks - Yona
elseif (it_model_param == 3) % BKS 3 OC - 2 shocks
% Preferences fl_beta = 0.92; % Discount factor fl_risk = 1.5; % coefficient of relative risk aversion % Entrepreneurship productivity shock parameters fl_mu_z = 0; % mean of AR(1) entrepeneurial productivity process fl_rho_z = 0.9; % persistence parameter of the AR(1) entrepreneurial productivity process fl_sig_z = 0.2; % standard deviation of shock of entrepreneurial productivity process fl_lambda_z = 3; % parameter determining bounds of entrepreneurial productivity process % Labor productivity shock parameters fl_mu_l = 0; % mean of AR(1) labor productivity process fl_rho_l = 0.9; % persistence parameter of the AR(1) labor productivity process fl_sig_l = 0.2; % standard deviation of shock of labor productivity process fl_lambda_l = 3; % parameter determining bounds of labor productivity process % Production function parameters for both entrepreneur and self-employed fl_alpha_e = 0.36; % Elasticity of output with respect to capital for entrepreneur fl_theta = 0.79-fl_alpha_e; % Elasticity of output with respect to labor for entrepreneur fl_kappa = 0; % Sunk cost involved in production for entrepreneur fl_alpha_se = 0.36; % Elasticity of output with respect to capital for self-employed % Other main model parameters fl_delta = 0.06; % Depreciation of capital fl_N = 1; % Population size % Asset, capital, productivity grid parameters it_zgridno = 10; % No of Points on Income Grid it_agridno = 100; % No of Points on Asset Grid it_k_n = 10000; % No of Points on Capital Grid fl_alo = 0; % Lower limit of asset grid fl_ahi = 50; % Upper limit of asset grid % Convergence Criterion parameters fl_tolvfi = 10^-12; % Tolerance level for convergence of value function fl_toldis = 10^-12; % Tolerance level for convergence stationary distribution % Variables for storing path and image names for different outputs st_img_path = '/Users/sidhantkhanna/Desktop/Research/Matlab Code/My codes/Model'; % Path for Storing images st_img_name = 'saveoutput'; % File name of output file to be stored % Solving PE/GE related parameters fl_r = 0.0467; % interest rate fl_w = 1.0667; % wages fl_phi = 1; % institutional efficiency fl_R = fl_r + fl_delta; % rental rate it_r_gridpoints = 10; % No of points on interest rate grid it_w_gridpoints = 10; % No of points on wages grid ar_r = linspace(0.04,0.09,it_r_gridpoints); % array for interest rate guesses to solve GE price ar_w = linspace(1.5,2.5,it_w_gridpoints); % array for wage rate guesses to solve GE prices ar_R = ar_r +fl_delta*ones(1,it_r_gridpoints); % array for rental rate guesses to solve GE prices % Adding parameters in container params_map params_map = containers.Map('KeyType', 'char', 'ValueType', 'any'); params_map('fl_beta') = fl_beta; params_map('fl_risk') = fl_risk; params_map('fl_mu') = fl_mu; params_map('fl_rho') = fl_rho; params_map('fl_sig') = fl_sig; params_map('fl_lambda') = fl_lambda; params_map('fl_alpha') = fl_alpha; params_map('fl_theta') = fl_theta; params_map('fl_kappa') = fl_kappa; params_map('fl_delta') = fl_delta; params_map('fl_N') = fl_N; params_map('it_agridno') = it_agridno; params_map('it_zgridno') = it_zgridno; params_map('fl_alo') = fl_alo; params_map('fl_ahi') = fl_ahi; params_map('fl_tolvfi') = fl_tolvfi; params_map('fl_toldis') = fl_toldis; params_map('fl_r') = fl_r; params_map('fl_w') = fl_w; params_map('fl_phi') = fl_phi; params_map('fl_R') = fl_R; params_map('ar_r') = ar_r; params_map('ar_w') = ar_w; params_map('ar_R') = ar_R; % Adding parameters in container support_map support_map = containers.Map('KeyType', 'char', 'ValueType', 'any'); support_map('st_img_path') = st_img_path; support_map('st_img_name') = st_img_name; ar_params_names = keys(params_map); % Variables defined in params_map ar_params_values = values(params_map); % Values of variables defined in params_map
Displaying BKS (3 OC) - 2 shocks parameters in a table
if (bl_display_param == true) tb_params_map = table(ar_params_names' , ar_params_values'); tb_params_map.Properties.VariableNames = {'Parameter_name', 'Value'}; disp(tb_params_map) end
end
end