Generate Borrowing and Savings Grid

back to Fan's Dynamic Assets Repository Table of Content.

Contents

function [ar_a, fl_borr_yminbd, fl_borr_ymaxbd] = ffs_abz_gen_borrsave_grid(varargin)

FFS_ABZ_GEN_BORRSAVE_GRID get funcs, params, states choices shocks grids

Generate savings and borrowing states/choice grids. There are three types of grids: # savings choice/state grid # borrowing choice/state grid when default is not allowed # borrowing choice/state grid when default is allowed

The parameters for this function and the role of cmin, ymin, default, etc are discussed on this page: cmin ymin borr save.

@param fl_b_bd float exogenously set borrowing bound. If zero, borrowing is not allowed. If lower than zero, means borrowing is allowed. When borrowing is allowed fl_b_bd is only the actual bound on borrowing if it is tighter than the natural borrowing constraint based on minimum income in the case where defaults are not allowed. And if it is tighther than the defaults borrowing constraint based on maximium income in the case where defaults are allowed.

@param bl_default boolean if fl_b_bd is below zero, then is defaults allowed or not? What does default mean? No-default means households under all shocks, can always repay existing debts and interests with new debts. This means banks do not have to worry about non-repayment. Households always pay back what they are owed. Note that debt roll-over is allowed here. What does default mean, it means under some states of shocks, households face debt that they can not repay, so they go to minimum consumption, which is utility for default. Their optimal choice is savings = 0 for the next period.

@param ar_z array array of exogenous income shocks for the exogeous shocks to inelastic labor supply

@param fl_r_borr_max float the maximum borrowing interest rate, max because there might be multiple borrowing interest rates.

@return fl_w float wage

@return fl_a_max float maximum savings level

@return it_a_n integer number of save/borrow grid points

@example

ar_a = ffs_abz_gen_borrsave_grid(fl_b_bd, bl_default, ar_z, ...
                                 fl_w, fl_r_borr, fl_a_max, it_a_n);

@seealso

cl_params_len = length(varargin);

Default Folder Parameters

fl_b_bd = -100;
bl_default = 1;
ar_z = [0.3474 0.4008 0.4623 0.5333 0.6152 0.7097 0.8186 0.9444 1.0894 1.2567 1.4496 1.6723 1.9291 2.2253 2.5670];
fl_w = 1;
bl_b_is_principle = true; % if false, b = principle + interest rates
fl_r_borr_max = 0.05;
fl_a_min = 0;
fl_a_max = 50;
it_a_n = 100;

cl_params = {fl_b_bd bl_default ar_z fl_w ...
             bl_b_is_principle fl_r_borr_max fl_a_min fl_a_max it_a_n};

Parse Parameters

numvarargs is the number of varagin inputted

[cl_params{1:cl_params_len}] = varargin{:};
fl_b_bd = cl_params{1};
bl_default = cl_params{2};
ar_z = cl_params{3};
fl_w = cl_params{4};

bl_b_is_principle = cl_params{5};
fl_r_borr_max = cl_params{6};
fl_a_min = cl_params{7};
fl_a_max = cl_params{8};
it_a_n = cl_params{9};

Min and Max Income

With the discretized exogenous income process, there are minimum and maximum levels of income next period given the vector of shocks.

if (bl_b_is_principle)
    % If principle, have to worry about if can repay interest rate
    fl_ar_z_min = min(ar_z);
    fl_borr_yminbd = -(fl_ar_z_min*fl_w)/fl_r_borr_max;

    fl_ar_z_max = max(ar_z);
    fl_borr_ymaxbd = -(fl_ar_z_max*fl_w)/fl_r_borr_max;

else
    % B is principle + interest rate, next period repay, constraint is now
    % different: min_wage - b/(1+r) >= - b. If do not use these but use the
    % bounds from above, there will be households who are at the min
    % borrowing bound even though default is not allowed.

    fl_ar_z_min = min(ar_z);
    fl_borr_yminbd = -(fl_ar_z_min*fl_w)*((1+fl_r_borr_max)/fl_r_borr_max);

    fl_ar_z_max = max(ar_z);
    fl_borr_ymaxbd = -(fl_ar_z_max*fl_w)*((1+fl_r_borr_max)/fl_r_borr_max);

end

Savings Only

if (fl_b_bd >= 0)
    % interpret this as minimum savings level if 0 is not allowed
    fl_a_min = fl_a_min;
end

Borrowing

if (fl_b_bd < 0)

Borrowing not allowing for default

    if (~bl_default)
        fl_a_min = max(fl_b_bd, fl_borr_yminbd);
    end

Borrowing allowing for default

    if (bl_default)
        fl_a_min = max(fl_b_bd, fl_borr_ymaxbd);
    end
end

Grid

ar_a = linspace(fl_a_min, fl_a_max, it_a_n);

Add Zero

allow for not saving or borrowing, but if add zero, preserve ar_a length to be it_a_n still.

ar_a = fft_array_add_zero(ar_a, true);
end
ans =

  Columns 1 through 7

  -51.3400  -50.3059  -49.2718  -48.2378  -47.2037  -46.1696  -45.1355

  Columns 8 through 14

  -44.1014  -43.0673  -42.0333  -40.9992  -39.9651  -38.9310  -37.8969

  Columns 15 through 21

  -36.8629  -35.8288  -34.7947  -33.7606  -32.7265  -31.6924  -30.6584

  Columns 22 through 28

  -29.6243  -28.5902  -27.5561  -26.5220  -25.4880  -24.4539  -23.4198

  Columns 29 through 35

  -22.3857  -21.3516  -20.3176  -19.2835  -18.2494  -17.2153  -16.1812

  Columns 36 through 42

  -15.1471  -14.1131  -13.0790  -12.0449  -11.0108   -9.9767   -8.9427

  Columns 43 through 49

   -7.9086   -6.8745   -5.8404   -4.8063   -3.7722   -2.7382   -1.7041

  Columns 50 through 56

   -0.6700         0    0.3641    1.3982    2.4322    3.4663    4.5004

  Columns 57 through 63

    5.5345    6.5686    7.6027    8.6367    9.6708   10.7049   11.7390

  Columns 64 through 70

   12.7731   13.8071   14.8412   15.8753   16.9094   17.9435   18.9776

  Columns 71 through 77

   20.0116   21.0457   22.0798   23.1139   24.1480   25.1820   26.2161

  Columns 78 through 84

   27.2502   28.2843   29.3184   30.3524   31.3865   32.4206   33.4547

  Columns 85 through 91

   34.4888   35.5229   36.5569   37.5910   38.6251   39.6592   40.6933

  Columns 92 through 98

   41.7273   42.7614   43.7955   44.8296   45.8637   46.8978   47.9318

  Columns 99 through 100

   48.9659   50.0000