This is the example vignette for function: snw_evuvw19_jmky_allchecks from the PrjOptiSNW Package. 2019 integrated over VU and VW
The function snw_evuvw19_jmky_allchecks was initiall designed to handle the COVID problem, the revised version of the program handles both the 2007/8/9 Bush stimulus check problem, and the 2019/20/21 Trump and Biden stimulus check problems.
The key features of the Bush stimulus checks are: i) determined based on 2007 information; ii) checks received in 2008, when the great recession has not arrived yet, but all expect it to in 2009; iii) the Great Recession hits in 2009, putting some people, based on education and age, into unemployment state with a shared unemployment duration and lost income and also UI benefits (calibrated to match overall UI share of wages); iv) the economy returns to steady-state in 2010.
Save a result that is low in memory cost so that it can be loaded quickly for various allocation tests. Turn off Various Printing Controls. Call function with wide income bins to reduce memory storage and retrievel costs
clear all;
% Start mp contorls
mp_controls = snw_mp_control('default_test');
% Solve for Unemployment Values
mp_controls('bl_timer') = true;
mp_controls('bl_print_vfi') = false;
mp_controls('bl_print_vfi_verbose') = false;
mp_controls('bl_print_ds') = false;
mp_controls('bl_print_ds_verbose') = true;
mp_controls('bl_print_precompute') = false;
mp_controls('bl_print_precompute_verbose') = false;
mp_controls('bl_print_a4chk') = false;
mp_controls('bl_print_a4chk_verbose') = false;
mp_controls('bl_print_v08p08_jaeemk') = false;
mp_controls('bl_print_v08p08_jaeemk_verbose') = false;
mp_controls('bl_print_v08_jaeemk') = false;
mp_controls('bl_print_v08_jaeemk_verbose') = false;
mp_controls('bl_print_evuvw20_jaeemk') = false;
mp_controls('bl_print_evuvw20_jaeemk_verbose') = false;
mp_controls('bl_print_evuvw19_jaeemk') = false;
mp_controls('bl_print_evuvw19_jaeemk_verbose') = false;
mp_controls('bl_print_evuvw19_jmky') = false;
mp_controls('bl_print_evuvw19_jmky_verbose') = false;
Dense default, and unemployment parameters:
% default dense load
% 1. generate MP_PARAMS specific to 2008 stimulus
% Use non-default values for Bush Stimulus
mp_more_inputs = containers.Map('KeyType','char', 'ValueType','any');
mp_more_inputs('fl_ss_non_college') = 0.225;
mp_more_inputs('fl_ss_college') = 0.271;
fl_p50_hh_income_07 = 54831;
mp_more_inputs('fl_scaleconvertor') = fl_p50_hh_income_07;
% st_param_group = 'default_small';
% st_param_group = 'default_dense';
st_param_group = 'default_docdense';
mp_params = snw_mp_param(st_param_group, false, 'tauchen', false, 8, 8, mp_more_inputs);
% mp_params = snw_mp_param('default_docdense')
mp_params('beta') = 0.95;
fl_scaleconvertor = 62502;
mp_more_inputs('fl_scaleconvertor') = fl_scaleconvertor;
% Unemployment
mp_params('xi') = 0.532;
mp_params('b') = 0.37992;
mp_params('a2_covidyr') = mp_params('a2_greatrecession_2009');
mp_params('TR') = 100/fl_p50_hh_income_07;
% Check Count: 89 checks to allow for both the first and the second round
n_welfchecksgrid = 3;
mp_params('n_welfchecksgrid') = n_welfchecksgrid;
mp_params('a2_covidyr') = mp_params('a2_greatrecession_2009');
Income bins:
% Income Grid
% 4 refers to 4*58056=232224 dollars in 2012USD
% max 7 refers to 7*58056=406392 dollars in 2012USD
% all phase out = (4400/5)*100 + 150000 = 238000
% if 500 dollar interval, need 476 inc groups before 238000
% if have 85 percent of points betwen 238000,
fl_max_phaseout = 238000;
fl_multiple = fl_scaleconvertor;
it_bin_dollar_before_phaseout = 5000;
it_bin_dollar_after_phaseout = 25000;
fl_thres = fl_max_phaseout/fl_multiple;
inc_grid1 = linspace(0,fl_thres,(fl_max_phaseout)/it_bin_dollar_before_phaseout);
inc_grid2 = linspace(fl_thres, 7, (7*fl_multiple-fl_max_phaseout)/it_bin_dollar_after_phaseout);
inc_grid=sort(unique([inc_grid1 inc_grid2]'));
mp_params('n_incgrid') = length(inc_grid);
mp_params('inc_grid') = inc_grid;
The simulation here (dense) requires less than 10 GB of memory with 8 workers (8 threads needed), simulating over 88 checks takes with 8 workers
st_biden_or_trump = 'bushchck';
st_solu_type = 'bisec_vec';
bl_parfor = false;
it_workers = 1;
bl_export = false;
bl_load_mat = false;
snm_suffix = ['_test_ybin' num2str(it_bin_dollar_before_phaseout)];
[ev19_jmky_allchecks, ec19_jmky_allchecks, output] = ...
snw_evuvw19_jmky_allchecks(mp_params, mp_controls, ...
st_biden_or_trump, st_solu_type, ...
bl_parfor, it_workers, ...
bl_export, bl_load_mat, snm_suffix);
Completed SNW_VFI_MAIN_BISEC_VEC;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=330.7856
Completed SNW_VFI_MAIN_BISEC_VEC 1 Period Unemp Shock;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=320.2784
Completed SNW_VFI_MAIN_BISEC_VEC 1 Period Unemp Shock;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=518.3883
Completed SNW_V08P08_JAEEMK;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=524.1155
sum of Phi_adj:83
sum of Phi_true:45.7931
sum of Phiss:83
summ of diff of Phiss and Phi_adj:-3.4775e-12
summ of diff of Phiss and Phi_true:37.2069
Completed SNW_DS_MAIN_VEC;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=1254.4898
Trump Check, do not need to resolve distribution
Wage quintile cutoffs=0.4645 0.71528 1.0335 1.5632
Completed SNW_HH_PRECOMPUTE;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time cost=265.7184
SNW_EVUVW19_JMKY_MASS Start
Completed SNW_EVUVW19_JMKY_MASS;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=5.264
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_outcomes ND Array (Matrix etc)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx ndim numel rowN colN sum mean std coefvari min max
_ ___ ____ ________ ____ _________ ______ __________ __________ ________ ___ _________
Phi_true 1 1 6 4.37e+07 83 5.265e+05 45.793 1.0479e-06 1.5289e-05 14.59 0 0.0062366
Phi_true_jmky 2 2 4 43460 82 530 45.787 0.0010535 0.0031057 2.9479 0 0.073265
SNW_EVUVW19_JMKY_ALLCHECKS Start
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Completed SNW_A4CHK_WRK_BISEC_VEC;SNW_MP_PARAM=bushchck;welf_checks=0;TR=0.0018238;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time cost=78.1172
Completed SNW_V08_JAEEMK;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;timeEUEC=2.81e-05
Completed SNW_EVUVW19_JAEEMK_FOC;st_biden_or_trump=bushchck;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=15.4712
Completed SNW_EVUVW19_JMKY;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=10.3545
SNW_EVUVW19_JMKY_ALLCHECKS: Finished Check 0 of 2, time=106.2974
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Completed SNW_A4CHK_WRK_BISEC_VEC;SNW_MP_PARAM=bushchck;welf_checks=1;TR=0.0018238;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time cost=78.7545
Completed SNW_V08_JAEEMK;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;timeEUEC=2.94e-05
Completed SNW_EVUVW19_JAEEMK_FOC;st_biden_or_trump=bushchck;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=15.4582
Completed SNW_EVUVW19_JMKY;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=10.0897
SNW_EVUVW19_JMKY_ALLCHECKS: Finished Check 1 of 2, time=106.6849
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Completed SNW_A4CHK_WRK_BISEC_VEC;SNW_MP_PARAM=bushchck;welf_checks=2;TR=0.0018238;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time cost=78.7404
Completed SNW_V08_JAEEMK;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;timeEUEC=2.1e-05
Completed SNW_EVUVW19_JAEEMK_FOC;st_biden_or_trump=bushchck;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=15.4389
Completed SNW_EVUVW19_JMKY;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=10.1555
SNW_EVUVW19_JMKY_ALLCHECKS: Finished Check 2 of 2, time=106.7998
Completed SNW_EVUVW19_JMKY_ALLCHECKS;ST_BIDEN_OR_TRUMP=bushchck;SNW_MP_PARAM=default_docdense;SNW_MP_CONTROL=default_test;time=3088.2443
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
CONTAINER NAME: mp_outcomes ND Array (Matrix etc)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i idx ndim numel rowN colN sum mean std coefvari min max
_ ___ ____ __________ __________ _____ ___________ _______ _______ ________ _________ ______
Output 1 1 2 1.0483e+06 1.1648e+05 9 7.7619e+06 7.4042 18.458 2.493 -0.57722 99
ec19_jmky_allchecks 2 2 5 1.3038e+05 3 43460 2.737e+05 2.0992 2.0221 0.96328 0 14.597
ec19_jmky_allchecks_posmass 3 3 2 1.1648e+05 1.1648e+05 1 2.737e+05 2.3498 1.9971 0.8499 0.066614 14.597
ev19_jmky_allchecks 4 4 5 1.3038e+05 3 43460 -2.3148e+06 -17.754 22.215 -1.2512 -319.71 0
ev19_jmky_allchecks_posmass 5 5 2 1.1648e+05 1.1648e+05 1 17932 0.15395 0.24305 1.5787 0.0031279 4.8312
xxx TABLE:Output xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c6 c7 c8 c9
__ __ __ __ __________ ________ _________ ________
r1 18 0 0 0 2.1599e-05 -0.57722 0.0053606 0.066639
r2 18 0 0 1 2.1599e-05 -0.57722 0.0053744 0.067396
r3 18 0 0 2 2.1599e-05 -0.57722 0.0053882 0.068355
r4 19 0 0 0 1.9002e-05 0.42278 0.0055828 0.068128
r5 19 0 0 1 1.9002e-05 0.42278 0.0055969 0.069089
r116474 86 1 4 1 3.937e-49 4.2268 0.97866 13.912
r116475 86 1 4 2 3.937e-49 4.2268 0.97868 13.912
r116476 87 1 4 0 1.0014e-58 4.2413 1.0716 14.596
r116477 87 1 4 1 1.0014e-58 4.2413 1.0716 14.597
r116478 87 1 4 2 1.0014e-58 4.2413 1.0716 14.597
xxx TABLE:ec19_jmky_allchecks xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c43457 c43458 c43459 c43460
________ ________ ________ ________ ______ ______ ______ ______
r1 0.066639 0.068128 0.071766 0.071091 0 0 0 0
r2 0.067396 0.069089 0.072695 0.072031 0 0 0 0
r3 0.068355 0.069782 0.073378 0.07271 0 0 0 0
xxx TABLE:ec19_jmky_allchecks_posmass xxxxxxxxxxxxxxxxxx
c1
________
r1 0.066639
r2 0.067396
r3 0.068355
r4 0.068128
r5 0.069089
r116474 13.912
r116475 13.912
r116476 14.596
r116477 14.597
r116478 14.597
xxx TABLE:ev19_jmky_allchecks xxxxxxxxxxxxxxxxxx
c1 c2 c3 c4 c43457 c43458 c43459 c43460
_______ _______ _______ _______ ______ ______ ______ ______
r1 -186.55 -179.12 -171.74 -172.54 0 0 0 0
r2 -186.07 -178.67 -171.33 -172.13 0 0 0 0
r3 -185.59 -178.22 -170.92 -171.72 0 0 0 0
xxx TABLE:ev19_jmky_allchecks_posmass xxxxxxxxxxxxxxxxxx
c1
_________
r1 0.0053606
r2 0.0053744
r3 0.0053882
r4 0.0055828
r5 0.0055969
r116474 0.97866
r116475 0.97868
r116476 1.0716
r116477 1.0716
r116478 1.0716