From 26936fcb6b6ec1dc04ffd0faf1e538efee53cb57 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Thu, 8 Mar 2018 13:35:58 -0500 Subject: [PATCH] Fix agi concept used in EITC phase-out logic --- taxcalc/functions.py | 9 ++--- taxcalc/tests/cpscsv_agg_expect.txt | 8 ++-- taxcalc/tests/pufcsv_mtr_expect.txt | 2 +- taxcalc/tests/test_utils.py | 58 ++++++++++++++--------------- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/taxcalc/functions.py b/taxcalc/functions.py index 0464b0816..131ee4f62 100644 --- a/taxcalc/functions.py +++ b/taxcalc/functions.py @@ -1123,14 +1123,14 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800, @jit(nopython=True) def EITCamount(phasein_rate, earnings, max_amount, - phaseout_start, eitc_agi, phaseout_rate): + phaseout_start, agi, phaseout_rate): """ Return EITC amount given specified parameters """ eitc = min(phasein_rate * earnings, max_amount) - if earnings > phaseout_start or eitc_agi > phaseout_start: + if earnings > phaseout_start or agi > phaseout_start: eitcx = max(0., (max_amount - phaseout_rate * - max(0., max(earnings, eitc_agi) - phaseout_start))) + max(0., max(earnings, agi) - phaseout_start))) eitc = min(eitc, eitcx) return eitc @@ -1155,9 +1155,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000, po_start = EITC_ps[EIC] if MARS == 2: po_start += EITC_ps_MarriedJ[EIC] - eitc_agi = c00100 + e00400 eitc = EITCamount(EITC_rt[EIC], earned, EITC_c[EIC], - po_start, eitc_agi, EITC_prt[EIC]) + po_start, c00100, EITC_prt[EIC]) if EIC == 0: # enforce age eligibility rule for those with no EITC-eligible # kids assuming that an unknown age_* value implies EITC age diff --git a/taxcalc/tests/cpscsv_agg_expect.txt b/taxcalc/tests/cpscsv_agg_expect.txt index f4ce7d73a..e56e772e0 100644 --- a/taxcalc/tests/cpscsv_agg_expect.txt +++ b/taxcalc/tests/cpscsv_agg_expect.txt @@ -12,12 +12,12 @@ AMT Income ($b) 7,786.3 8,041.5 8,270.4 8,681.6 9,144.9 9,5 AMT Liability ($b) 9.9 12.2 13.4 15.0 15.5 15.9 16.4 17.2 18.0 19.1 AMT Filers (#m) 2.7 3.0 3.2 3.5 3.7 3.8 3.9 4.0 4.1 4.3 Tax before Credits ($b) 1,085.2 1,098.8 1,133.0 1,205.1 1,285.4 1,357.0 1,426.3 1,501.2 1,579.9 1,660.7 -Refundable Credits ($b) 80.3 79.4 78.8 78.0 79.5 81.4 83.5 85.7 87.9 89.9 +Refundable Credits ($b) 80.4 79.4 78.9 78.1 79.5 81.4 83.5 85.7 87.9 90.0 Nonrefundable Credits ($b) 32.4 32.2 32.6 33.0 33.0 33.0 33.0 32.9 32.8 32.7 Reform Surtaxes ($b) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 Other Taxes ($b) 6.1 7.1 7.1 7.5 8.0 8.6 9.2 9.8 10.4 11.0 -Ind Income Tax ($b) 978.7 994.3 1,028.7 1,101.5 1,180.9 1,251.3 1,319.0 1,392.3 1,469.6 1,549.0 +Ind Income Tax ($b) 978.6 994.3 1,028.7 1,101.5 1,180.9 1,251.2 1,319.0 1,392.3 1,469.6 1,549.0 Payroll Taxes ($b) 999.4 1,031.5 1,074.0 1,133.9 1,192.6 1,247.6 1,300.3 1,356.4 1,417.5 1,482.5 -Combined Liability ($b) 1,978.1 2,025.8 2,102.8 2,235.5 2,373.6 2,498.9 2,619.3 2,748.7 2,887.1 3,031.5 -With Income Tax <= 0 (#m) 73.5 72.5 72.8 72.7 73.2 73.6 74.2 74.8 75.4 75.9 +Combined Liability ($b) 1,978.0 2,025.8 2,102.7 2,235.4 2,373.5 2,498.8 2,619.2 2,748.6 2,887.1 3,031.4 +With Income Tax <= 0 (#m) 73.5 72.5 72.8 72.7 73.2 73.7 74.3 74.8 75.4 75.9 With Combined Tax <= 0 (#m) 48.8 48.3 48.6 48.7 49.1 49.5 49.9 50.3 50.8 51.2 diff --git a/taxcalc/tests/pufcsv_mtr_expect.txt b/taxcalc/tests/pufcsv_mtr_expect.txt index b2749ce4a..9ce3703aa 100644 --- a/taxcalc/tests/pufcsv_mtr_expect.txt +++ b/taxcalc/tests/pufcsv_mtr_expect.txt @@ -18,7 +18,7 @@ PTAX and ITAX mtr histogram bin counts for e00300: 249087 : 0 0 0 0 59706 78469 48350 32495 29225 842 PTAX and ITAX mtr histogram bin counts for e00400: 249087 : 249087 0 0 0 0 0 0 0 0 0 -249087 : 0 0 0 0 233663 8606 6684 106 27 1 +249087 : 0 0 0 0 244717 4073 293 4 0 0 PTAX and ITAX mtr histogram bin counts for e00600: 249087 : 249087 0 0 0 0 0 0 0 0 0 249087 : 0 0 0 0 59706 78469 48350 32495 29225 842 diff --git a/taxcalc/tests/test_utils.py b/taxcalc/tests/test_utils.py index ef57441e3..bb3bc5d01 100644 --- a/taxcalc/tests/test_utils.py +++ b/taxcalc/tests/test_utils.py @@ -269,17 +269,17 @@ def test_create_tables(cps_subsample): result_type='weighted_sum') assert isinstance(dist, pd.DataFrame) expected = [0, - -58122959, - -69644449, - -67116585, - 47133880, - 186484505, - 300964154, - 525599694, - 853149215, - 1490980322, + -58123243, + -69694267, + -67181494, + 47113612, + 186460706, + 300606405, + 525592811, + 853135573, + 1490980249, 6751954525, - 9961382302, + 9960844878, 1541661847, 2070553973, 3139738705] @@ -335,17 +335,17 @@ def test_create_tables(cps_subsample): for val in dist[tabcol].values: print('{:.0f},'.format(val)) expected = [0, - 782122416, - 2478134056, - 3682019346, - 4789142820, - 6179678305, - 7842560545, - 10063413839, - 12700737393, - 16714200777, + 782122701, + 2478183874, + 3682084255, + 4789163087, + 6179702104, + 7842918294, + 10063420722, + 12700751035, + 16714200850, 34582837753, - 99814847249, + 99815384674, 11476106014, 13555463283, 9551268456] @@ -363,18 +363,18 @@ def test_create_tables(cps_subsample): result_type='weighted_sum') assert isinstance(dist, pd.DataFrame) expected = [0, - -46738401, - -83257646, - -56815812, - 32360096, - 201111211, - 710727824, - 914390328, - 2944626799, + -46738685, + -83307439, + -56890405, + 32347721, + 201050742, + 710401700, + 914376616, + 2944626727, 2600275783, 919111563, 1825590555, - 9961382302] + 9960844878] tabcol = 'iitax' if not np.allclose(dist[tabcol], expected, atol=0.5, rtol=0.0):