From 186c4f7e9b4190401f80e4791c805d604a46d775 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Tue, 26 Mar 2024 17:37:17 -0400 Subject: [PATCH 1/4] Correct a few historical income tax bracket parameter values --- taxcalc/policy_current_law.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/taxcalc/policy_current_law.json b/taxcalc/policy_current_law.json index 549387d0b..78fedeca5 100644 --- a/taxcalc/policy_current_law.json +++ b/taxcalc/policy_current_law.json @@ -11061,7 +11061,7 @@ { "year": 2020, "MARS": "mseparate", - "value": 518400.0 + "value": 311025.0 }, { "year": 2020, @@ -11086,7 +11086,7 @@ { "year": 2021, "MARS": "mseparate", - "value": 329850.0 + "value": 314150.0 }, { "year": 2021, @@ -13280,27 +13280,27 @@ { "year": 2021, "MARS": "single", - "value": 215950.0 + "value": 209425.0 }, { "year": 2021, "MARS": "mjoint", - "value": 431900.0 + "value": 418850.0 }, { "year": 2021, "MARS": "mseparate", - "value": 215950.0 + "value": 209425.0 }, { "year": 2021, "MARS": "headhh", - "value": 215950.0 + "value": 209400.0 }, { "year": 2021, "MARS": "widow", - "value": 431900.0 + "value": 418850.0 }, { "year": 2022, @@ -13643,27 +13643,27 @@ { "year": 2021, "MARS": "single", - "value": 539900.0 + "value": 523600.0 }, { "year": 2021, "MARS": "mjoint", - "value": 647850.0 + "value": 628300.0 }, { "year": 2021, "MARS": "mseparate", - "value": 539900.0 + "value": 314150.0 }, { "year": 2021, "MARS": "headhh", - "value": 539900.0 + "value": 523600.0 }, { "year": 2021, "MARS": "widow", - "value": 647850.0 + "value": 628300.0 }, { "year": 2022, @@ -20692,4 +20692,4 @@ "cps": true } } -} \ No newline at end of file +} From 136b18e96d7e9b5a26a02d283e82eb04fd3875b4 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Wed, 27 Mar 2024 09:28:32 -0400 Subject: [PATCH 2/4] Add new test_policy.py test that checks II_brk? vs PT_brk? --- taxcalc/policy_current_law.json | 2 +- taxcalc/tests/test_policy.py | 24 +++++++++++++++++++++++- taxcalc/tests/test_reforms.py | 1 + 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/taxcalc/policy_current_law.json b/taxcalc/policy_current_law.json index 78fedeca5..b975c5b9f 100644 --- a/taxcalc/policy_current_law.json +++ b/taxcalc/policy_current_law.json @@ -13628,7 +13628,7 @@ { "year": 2020, "MARS": "mseparate", - "value": 518400.0 + "value": 311025.0 }, { "year": 2020, diff --git a/taxcalc/tests/test_policy.py b/taxcalc/tests/test_policy.py index 9b21fe1dd..8c7d7bae7 100644 --- a/taxcalc/tests/test_policy.py +++ b/taxcalc/tests/test_policy.py @@ -1542,4 +1542,26 @@ def test_cpi_offset_does_not_affect_wage_indexed_params(self): "SS_Earnings_c", year=list(range(2021, 2024 + 1)) ) - np.testing.assert_equal(act_before_2025, exp_before_2025) \ No newline at end of file + np.testing.assert_equal(act_before_2025, exp_before_2025) + + +def test_two_sets_of_tax_brackets(): + """ + Test that II_brk? and PT_brk? values are the same under current law. + """ + pol = Policy() + brackets = range(1, 7+1) + years = range(Policy.JSON_START_YEAR, Policy.LAST_KNOWN_YEAR+1) + emsg = '' + for year in years: + pol.set_year(year) + pdata = dict(pol.items()) + for bnum in brackets: + ii_val = pdata[f'II_brk{bnum}'] + pt_val = pdata[f'PT_brk{bnum}'] + if not np.allclose(ii_val, pt_val): + emsg += f'II_brk{bnum} != PT_brk{bnum} for year {year}\n' + emsg += f' II_brk{bnum} is {ii_val}\n' + emsg += f' PT_brk{bnum} is {pt_val}\n' + if emsg: + raise ValueError(emsg) diff --git a/taxcalc/tests/test_reforms.py b/taxcalc/tests/test_reforms.py index 51387180c..42dbaa1eb 100644 --- a/taxcalc/tests/test_reforms.py +++ b/taxcalc/tests/test_reforms.py @@ -72,6 +72,7 @@ def test_2017_law_reform(tests_path): assert act == exp, '{} a={} != e={}'.format(name, act, exp) +@pytest.mark.rtr @pytest.mark.parametrize('fyear', [2019, 2020, 2021, 2022, 2023]) def test_round_trip_reforms(fyear, tests_path): """ From 483f3f9404ed33e913f2560c60e427fa960d0358 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Wed, 27 Mar 2024 11:21:01 -0400 Subject: [PATCH 3/4] Fix reforms/rounding2022.json so that round-trip-reform test works --- taxcalc/reforms/rounding2022.json | 128 +++++++++++++++--------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/taxcalc/reforms/rounding2022.json b/taxcalc/reforms/rounding2022.json index 19bbf0ce8..dd4ecaac2 100644 --- a/taxcalc/reforms/rounding2022.json +++ b/taxcalc/reforms/rounding2022.json @@ -9,83 +9,83 @@ { "II_brk1": {"2019": [9700, 19400, 9700, 13850, 19400], - "2020": [9875, 19750, 9875, 14100, 19750], - "2021": [9950, 19900, 9950, 14200, 19900], - "2022": [10275, 20550, 10275, 14650, 20550]}, + "2020": [9875, 19750, 9875, 14100, 19750], + "2021": [9950, 19900, 9950, 14200, 19900], + "2022": [10275, 20550, 10275, 14650, 20550]}, "II_brk2": {"2019": [39475, 78950, 39475, 52850, 78950], - "2020": [40125, 80250, 40125, 53700, 80250], - "2021": [40525, 81050, 40525, 54200, 81050], - "2022": [41775, 83550, 41775, 55900, 83550]}, + "2020": [40125, 80250, 40125, 53700, 80250], + "2021": [40525, 81050, 40525, 54200, 81050], + "2022": [41775, 83550, 41775, 55900, 83550]}, "II_brk3": {"2019": [84200, 168400, 84200, 84200, 168400], - "2020": [85525, 171050, 85525, 85500, 171050], - "2021": [86375, 172750, 86375, 86350, 172750], - "2022": [89075, 178150, 89075, 89050, 178150]}, - "II_brk4": { "2019": [160725, 321450, 160725, 160700, 321450], - "2020": [163300, 326600, 163300, 163300, 326600], - "2021": [164925, 329850, 164925, 164900, 329850], - "2022": [170050, 340100, 170050, 170050, 340100]}, + "2020": [85525, 171050, 85525, 85500, 171050], + "2021": [86375, 172750, 86375, 86350, 172750], + "2022": [89075, 178150, 89075, 89050, 178150]}, + "II_brk4": {"2019": [160725, 321450, 160725, 160700, 321450], + "2020": [163300, 326600, 163300, 163300, 326600], + "2021": [164925, 329850, 164925, 164900, 329850], + "2022": [170050, 340100, 170050, 170050, 340100]}, "II_brk5": {"2019": [204100, 408200, 204100, 204100, 408200], - "2020": [207350, 414700, 207350, 207350, 414700], - "2021": [209425, 418850, 209425, 209400, 418850], - "2022": [215950, 431900, 215950, 215950, 431900]}, + "2020": [207350, 414700, 207350, 207350, 414700], + "2021": [209425, 418850, 209425, 209400, 418850], + "2022": [215950, 431900, 215950, 215950, 431900]}, "II_brk6": {"2019": [510300, 612350, 306175, 510300, 612350], - "2020": [518400, 622050, 518400, 518400, 622050], - "2021": [523600, 628300, 329850, 523600, 628300], - "2022": [539900, 647850, 323925, 539900, 647850]}, + "2020": [518400, 622050, 311025, 518400, 622050], + "2021": [523600, 628300, 314150, 523600, 628300], + "2022": [539900, 647850, 323925, 539900, 647850]}, "PT_brk1": {"2019": [9700, 19400, 9700, 13850, 19400], - "2020": [9875, 19750, 9875, 14100, 19750], - "2021": [9950, 19900, 9950, 14200, 19900], - "2022": [10275, 20550, 10275, 14650, 20550]}, + "2020": [9875, 19750, 9875, 14100, 19750], + "2021": [9950, 19900, 9950, 14200, 19900], + "2022": [10275, 20550, 10275, 14650, 20550]}, "PT_brk2": {"2019": [39475, 78950, 39475, 52850, 78950], - "2020": [40125, 80250, 40125, 53700, 80250], + "2020": [40125, 80250, 40125, 53700, 80250], "2021": [40525, 81050, 40525, 54200, 81050], "2022": [41775, 83550, 41775, 55900, 83550]}, "PT_brk3": {"2019": [84200, 168400, 84200, 84200, 168400], - "2020": [85525, 171050, 85525, 85500, 171050], + "2020": [85525, 171050, 85525, 85500, 171050], "2021": [86375, 172750, 86375, 86350, 172750], "2022": [89075, 178150, 89075, 89050, 178150]}, "PT_brk4": {"2019": [160725, 321450, 160725, 160700, 321450], - "2020": [163300, 326600, 163300, 163300, 326600], + "2020": [163300, 326600, 163300, 163300, 326600], "2021": [164925, 329850, 164925, 164900, 329850], "2022": [170050, 340100, 170050, 170050, 340100]}, "PT_brk5": {"2019": [204100, 408200, 204100, 204100, 408200], - "2020": [207350, 414700, 207350, 207350, 414700], - "2021": [215950, 431900, 215950, 215950, 431900], + "2020": [207350, 414700, 207350, 207350, 414700], + "2021": [209425, 418850, 209425, 209400, 418850], "2022": [215950, 431900, 215950, 215950, 431900]}, "PT_brk6": {"2019": [510300, 612350, 306175, 510300, 612350], - "2020": [518400, 622050, 518400, 518400, 622050], - "2021": [539900, 647850, 539900, 539900, 647850], + "2020": [518400, 622050, 311025, 518400, 622050], + "2021": [523600, 628300, 314150, 523600, 628300], "2022": [539900, 647850, 323925, 539900, 647850]}, "PT_qbid_taxinc_thd": {"2019": [160700, 321400, 160725, 160700, 321400], - "2020": [163300, 326600, 163300, 163300, 326600], - "2021": [164900, 329800, 164900, 164900, 329800], - "2022": [170050, 340100, 170050, 170050, 340100]}, + "2020": [163300, 326600, 163300, 163300, 326600], + "2021": [164900, 329800, 164900, 164900, 329800], + "2022": [170050, 340100, 170050, 170050, 340100]}, "STD": {"2019": [12200, 24400, 12200, 18350, 24400], "2020": [12400, 24800, 12400, 18650, 24800], "2021": [12550, 25100, 12550, 18800, 25100], "2022": [12950, 25900, 12950, 19400, 25900]}, "AMT_em": {"2019": [71700, 111700, 55850, 71700, 111700], - "2020": [72900, 113400, 56700, 72900, 113400], - "2021": [73600, 114600, 57300, 73600, 114600], - "2022": [75900, 118100, 59050, 75900, 118100]}, + "2020": [72900, 113400, 56700, 72900, 113400], + "2021": [73600, 114600, 57300, 73600, 114600], + "2022": [75900, 118100, 59050, 75900, 118100]}, "AMT_em_ps": {"2019": [510300, 1020600, 510300, 510300, 1020600], - "2020": [518400, 1036800, 518400, 518400, 1036800], - "2021": [523600, 1047200, 523600, 523600, 1047200], - "2022": [539900, 1079800, 539900, 539900, 1079800]}, + "2020": [518400, 1036800, 518400, 518400, 1036800], + "2021": [523600, 1047200, 523600, 523600, 1047200], + "2022": [539900, 1079800, 539900, 539900, 1079800]}, "AMT_em_pe": {"2019": 733700, - "2020": 745200, - "2021": 752800, - "2022": 776100}, + "2020": 745200, + "2021": 752800, + "2022": 776100}, "ALD_BusinessLosses_c": { "2019": [255000, 510000, 255000, 255000, 510000], "2020": [259000, 518000, 259000, 259000, 518000], - "2021": [262000, 524000, 262000, 262000, 524000], - "2022": [270000, 540000, 270000, 270000, 540000]}, + "2021": [262000, 524000, 262000, 262000, 524000], + "2022": [270000, 540000, 270000, 270000, 540000]}, "STD_Dep": {"2019": 1100, "2020": 1100, "2021": 1100, "2022": 1150}, "STD_Aged": {"2019": [1650, 1300, 1300, 1650, 1300], - "2020": [1650, 1300, 1300, 1650, 1300], - "2021": [1700, 1350, 1350, 1700, 1350], - "2022": [1750, 1400, 1400, 1750, 1750]}, + "2020": [1650, 1300, 1300, 1650, 1300], + "2021": [1700, 1350, 1350, 1700, 1350], + "2022": [1750, 1400, 1400, 1750, 1750]}, "CG_brk1": {"2019": [39375, 78750, 39375, 52750, 78750], "2020": [40000, 80000, 40000, 53600, 80000], "2021": [40400, 80800, 40400, 54100, 80800], @@ -103,41 +103,41 @@ "2021": [445850, 501600, 250800, 473750, 501600], "2022": [459750, 517200, 258600, 488500, 517200]}, "AMT_child_em": { "2019": 7750, - "2020": 7900, - "2021": 7950, - "2022": 8200}, + "2020": 7900, + "2021": 7950, + "2022": 8200}, "AMT_brk1": {"2019": 194800, - "2020": 197900, - "2021": 199900, - "2022": 206100}, + "2020": 197900, + "2021": 199900, + "2022": 206100}, "EITC_c": {"2019": [529, 3526, 5828, 6557], "2020": [538, 3584, 5920, 6660], "2021": [1502.0, 3618.0, 5980.0, 6728.0], "2022": [560, 3733, 6164, 6935]}, - "EITC_ps": { "2019": [8650, 19030, 19030, 19030], - "2020": [8790, 19330, 19330, 19330], + "EITC_ps": {"2019": [8650, 19030, 19030, 19030], + "2020": [8790, 19330, 19330, 19330], "2021": [11610, 19520, 19520, 19520], "2022": [9160, 20130, 20130, 20130]}, "EITC_ps_MarriedJ": {"2019": [5800, 5790, 5790, 5790], - "2020": [5890, 5890, 5890, 5890], - "2021": [5950, 5950, 5950, 5950], - "2022": [6130, 6130, 6130, 6130]}, + "2020": [5890, 5890, 5890, 5890], + "2021": [5950, 5950, 5950, 5950], + "2022": [6130, 6130, 6130, 6130]}, "EITC_InvestIncome_c": {"2019": 3600, "2020": 3650, "2021": 10000, "2022": 10300}, "ETC_pe_Single": {"2019": 68, - "2020": 69, - "2021": 90, - "2022": 80}, + "2020": 69, + "2021": 90, + "2022": 80}, "ETC_pe_Married": {"2019": 136, - "2020": 138, - "2021": 180, - "2022": 180}, + "2020": 138, + "2021": 180, + "2022": 180}, "ACTC_c": {"2023": 1600, "2024": 1600, "2025": 1600, "2026": 1000}, "FST_AGI_thd_lo": {"2019": [1000000, 1000000, 500000, 1000000, 1000000]}, "FST_AGI_thd_hi": {"2019": [2000000, 2000000, 1000000, 2000000, 2000000]} - } \ No newline at end of file + } From d9aab06f0463f438b2f769053565032e9ce8049c Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Wed, 27 Mar 2024 11:39:37 -0400 Subject: [PATCH 4/4] Update {cps,puf}csv_agg_expect.csv files --- taxcalc/tests/cpscsv_agg_expect.csv | 8 ++++---- taxcalc/tests/pufcsv_agg_expect.csv | 8 ++++---- taxcalc/tests/test_cpscsv.py | 2 ++ taxcalc/tests/test_pufcsv.py | 1 + 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/taxcalc/tests/cpscsv_agg_expect.csv b/taxcalc/tests/cpscsv_agg_expect.csv index 2029b0469..2807f8bfd 100644 --- a/taxcalc/tests/cpscsv_agg_expect.csv +++ b/taxcalc/tests/cpscsv_agg_expect.csv @@ -7,18 +7,18 @@ Standard Deduction Filers (#m),124.3,175.3,176.8,176.8,175.0,178.4,182.8,184.7,1 Standard Deduction ($b),1092.1,2949.5,3024.7,3075.5,3066.7,3229.8,3576.6,3750.4,3869.1,1607.9 Personal Exemption ($b),1383.6,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,2077.6 Taxable Income ($b),6230.6,7957.9,8321.4,8617.4,10058.6,10330.4,10934.4,11447.4,12016.4,11787.0 -Regular Tax ($b),1108.0,1379.8,1448.8,1505.3,1763.9,1837.0,1932.2,2025.3,2134.4,2341.9 +Regular Tax ($b),1108.0,1379.8,1448.8,1505.3,1764.0,1837.0,1932.2,2025.3,2134.4,2341.9 AMT Income ($b),8319.8,10262.0,10680.4,11012.7,12516.1,12879.8,13723.1,14366.8,15032.2,15073.4 AMT Liability ($b),8.1,0.8,0.7,0.6,1.9,1.1,1.1,1.0,1.0,17.4 AMT Filers (#m),2.6,0.2,0.2,0.1,0.3,0.2,0.2,0.2,0.2,4.1 -Tax before Credits ($b),1116.0,1380.6,1449.5,1505.8,1765.8,1838.1,1933.2,2026.3,2135.4,2359.2 +Tax before Credits ($b),1116.0,1380.6,1449.5,1505.9,1765.9,1838.1,1933.2,2026.3,2135.4,2359.2 Refundable Credits ($b),70.8,102.4,102.7,654.9,827.1,98.5,107.4,109.8,110.0,95.8 Nonrefundable Credits ($b),32.7,97.2,99.1,99.4,0.0,107.7,108.1,109.7,111.6,30.0 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),5.5,10.7,11.3,12.6,13.9,14.4,16.5,17.6,18.8,19.9 -Ind Income Tax ($b),1018.1,1191.6,1259.0,764.2,952.5,1646.2,1734.3,1824.5,1932.6,2253.3 +Ind Income Tax ($b),1018.1,1191.6,1259.0,764.2,952.6,1646.2,1734.3,1824.5,1932.6,2253.3 Payroll Taxes ($b),1040.8,1141.6,1194.9,1217.9,1318.7,1421.6,1506.7,1582.0,1656.7,1730.7 -Combined Liability ($b),2059.0,2333.2,2453.9,1982.1,2271.2,3067.8,3241.0,3406.4,3589.3,3984.1 +Combined Liability ($b),2059.0,2333.2,2453.9,1982.2,2271.3,3067.8,3241.0,3406.4,3589.3,3984.1 With Income Tax <= 0 (#m),88.1,96.2,97.0,135.2,127.7,96.1,98.1,98.8,99.2,97.2 With Combined Tax <= 0 (#m),62.8,65.4,66.4,98.2,97.7,67.9,69.4,70.3,71.1,70.6 UBI Benefits ($b),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 diff --git a/taxcalc/tests/pufcsv_agg_expect.csv b/taxcalc/tests/pufcsv_agg_expect.csv index 90d185dac..bca9c4dc4 100644 --- a/taxcalc/tests/pufcsv_agg_expect.csv +++ b/taxcalc/tests/pufcsv_agg_expect.csv @@ -7,18 +7,18 @@ Standard Deduction Filers (#m),145.2,174.7,177.1,178.9,179.5,182.7,186.9,189.6,1 Standard Deduction ($b),1239.3,2862.1,2951.5,3034.7,3071.8,3231.2,3571.5,3761.2,3905.1,1851.1 Personal Exemption ($b),1365.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1955.4 Taxable Income ($b),8112.4,9178.7,9519.8,9908.1,12011.8,11926.8,12679.3,13147.5,13725.9,13382.8 -Regular Tax ($b),1656.8,1712.3,1778.1,1862.1,2282.8,2282.6,2416.1,2498.4,2612.2,2795.2 +Regular Tax ($b),1656.8,1712.3,1778.1,1862.2,2283.3,2282.6,2416.1,2498.4,2612.2,2795.2 AMT Income ($b),10512.6,11427.4,11835.3,12265.7,14419.0,14452.6,15428.0,16043.9,16734.2,16933.8 AMT Liability ($b),51.3,23.2,24.1,25.1,29.0,28.6,30.0,31.5,33.1,85.4 AMT Filers (#m),5.7,0.6,0.6,0.3,0.7,0.6,0.6,0.6,0.6,7.4 -Tax before Credits ($b),1708.1,1735.5,1802.2,1887.2,2311.8,2311.2,2446.1,2529.9,2645.3,2880.6 +Tax before Credits ($b),1708.1,1735.5,1802.2,1887.3,2312.3,2311.2,2446.1,2529.9,2645.3,2880.6 Refundable Credits ($b),102.9,117.4,118.5,641.8,802.6,119.2,127.9,131.5,133.3,120.3 Nonrefundable Credits ($b),67.0,127.3,129.2,128.7,47.6,140.8,143.1,144.4,146.3,78.0 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),40.0,44.8,43.6,52.9,84.9,61.5,66.5,65.2,66.0,64.2 -Ind Income Tax ($b),1578.3,1535.5,1598.1,1169.6,1546.4,2112.7,2241.6,2319.3,2431.6,2746.5 +Ind Income Tax ($b),1578.3,1535.5,1598.1,1169.7,1546.9,2112.7,2241.6,2319.3,2431.6,2746.5 Payroll Taxes ($b),1083.8,1133.3,1185.4,1209.0,1306.0,1403.4,1489.3,1563.9,1637.9,1711.0 -Combined Liability ($b),2662.0,2668.8,2783.5,2378.5,2852.4,3516.2,3730.9,3883.3,4069.5,4457.5 +Combined Liability ($b),2662.0,2668.8,2783.5,2378.7,2852.8,3516.2,3730.9,3883.3,4069.5,4457.5 With Income Tax <= 0 (#m),92.8,98.6,99.7,131.4,124.9,100.3,102.1,103.2,104.0,100.8 With Combined Tax <= 0 (#m),63.4,65.6,66.8,102.0,94.5,68.9,70.3,71.4,72.4,72.2 UBI Benefits ($b),0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0 diff --git a/taxcalc/tests/test_cpscsv.py b/taxcalc/tests/test_cpscsv.py index bb4b85e6e..7517b6adb 100644 --- a/taxcalc/tests/test_cpscsv.py +++ b/taxcalc/tests/test_cpscsv.py @@ -14,6 +14,7 @@ import os import json +import pytest import numpy as np import pandas as pd # pylint: disable=import-error @@ -23,6 +24,7 @@ START_YEAR = 2017 +@pytest.mark.cpscsv_agg def test_agg(tests_path, cps_fullsample): """ Test current-law aggregate taxes using cps.csv file. diff --git a/taxcalc/tests/test_pufcsv.py b/taxcalc/tests/test_pufcsv.py index 4a40350e4..3a74d8395 100644 --- a/taxcalc/tests/test_pufcsv.py +++ b/taxcalc/tests/test_pufcsv.py @@ -27,6 +27,7 @@ START_YEAR = 2017 +@pytest.mark.pufcsv_agg @pytest.mark.requires_pufcsv def test_agg(tests_path, puf_fullsample): """