taxcalc 4.6.3__py3-none-any.whl → 5.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- taxcalc/__init__.py +1 -1
- taxcalc/calcfunctions.py +54 -459
- taxcalc/calculator.py +9 -7
- taxcalc/parameters.py +0 -3
- taxcalc/policy.py +37 -30
- taxcalc/policy_current_law.json +736 -4554
- taxcalc/records_variables.json +0 -40
- taxcalc/reforms/2017_law.json +1 -15
- taxcalc/reforms/Larson2019.json +3 -3
- taxcalc/reforms/TCJA.json +2 -30
- taxcalc/reforms/Trump2016.json +1 -16
- taxcalc/reforms/Trump2017.json +1 -10
- taxcalc/reforms/ext.json +1 -15
- taxcalc/tests/conftest.py +2 -2
- taxcalc/tests/pufcsv_agg_expect.csv +2 -2
- taxcalc/tests/reforms.json +36 -88
- taxcalc/tests/reforms_expect.csv +32 -35
- taxcalc/tests/test_calcfunctions.py +1 -1
- taxcalc/tests/test_calculator.py +9 -81
- taxcalc/tests/test_compatible_data.py +0 -6
- taxcalc/tests/test_parameters.py +4 -0
- taxcalc/tests/test_policy.py +4 -30
- taxcalc/tests/test_pufcsv.py +0 -56
- taxcalc/tests/test_reforms.py +2 -2
- taxcalc/tests/test_utils.py +59 -59
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/METADATA +1 -1
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/RECORD +31 -31
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/WHEEL +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/entry_points.txt +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/licenses/LICENSE +0 -0
- {taxcalc-4.6.3.dist-info → taxcalc-5.0.0.dist-info}/top_level.txt +0 -0
taxcalc/__init__.py
CHANGED
taxcalc/calcfunctions.py
CHANGED
@@ -606,7 +606,7 @@ def CapGains(p23250, p22250, sep, ALD_StudentLoan_hc,
|
|
606
606
|
|
607
607
|
|
608
608
|
@iterate_jit(nopython=True)
|
609
|
-
def SSBenefits(MARS, ymod, e02400, SS_all_in_agi,
|
609
|
+
def SSBenefits(MARS, ymod, e02400, SS_all_in_agi, SS_thd1, SS_thd2,
|
610
610
|
SS_percentage1, SS_percentage2, c02500):
|
611
611
|
"""
|
612
612
|
Calculates OASDI benefits included in AGI, c02500.
|
@@ -622,9 +622,9 @@ def SSBenefits(MARS, ymod, e02400, SS_all_in_agi, SS_thd50, SS_thd85,
|
|
622
622
|
Total social security (OASDI) benefits
|
623
623
|
SS_all_in_agi: bool
|
624
624
|
Whether all social security benefits are included in AGI
|
625
|
-
|
625
|
+
SS_thd1: list
|
626
626
|
Threshold for social security benefit taxability (1)
|
627
|
-
|
627
|
+
SS_thd2: list
|
628
628
|
Threshold for social security benefit taxability (2)
|
629
629
|
SS_percentage1: float
|
630
630
|
Social security taxable income decimal fraction (1)
|
@@ -638,15 +638,15 @@ def SSBenefits(MARS, ymod, e02400, SS_all_in_agi, SS_thd50, SS_thd85,
|
|
638
638
|
c02500: float
|
639
639
|
Social security (OASDI) benefits included in AGI
|
640
640
|
"""
|
641
|
-
if ymod <
|
641
|
+
if ymod < SS_thd1[MARS - 1]:
|
642
642
|
c02500 = 0.
|
643
|
-
elif ymod <
|
644
|
-
c02500 = SS_percentage1 * min(ymod -
|
643
|
+
elif ymod < SS_thd2[MARS - 1]:
|
644
|
+
c02500 = SS_percentage1 * min(ymod - SS_thd1[MARS - 1], e02400)
|
645
645
|
else:
|
646
|
-
c02500 = min(SS_percentage2 * (ymod -
|
646
|
+
c02500 = min(SS_percentage2 * (ymod - SS_thd2[MARS - 1]) +
|
647
647
|
SS_percentage1 *
|
648
|
-
min(e02400,
|
649
|
-
|
648
|
+
min(e02400, SS_thd2[MARS - 1] -
|
649
|
+
SS_thd1[MARS - 1]), SS_percentage2 * e02400)
|
650
650
|
if SS_all_in_agi:
|
651
651
|
c02500 = e02400
|
652
652
|
return c02500
|
@@ -787,145 +787,8 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
|
|
787
787
|
|
788
788
|
|
789
789
|
@iterate_jit(nopython=True)
|
790
|
-
def
|
791
|
-
|
792
|
-
e18400_capped, e18500_capped, e19200_capped, e19800_capped,
|
793
|
-
e20100_capped, e20400_capped, g20500_capped):
|
794
|
-
"""
|
795
|
-
Applies a cap to gross itemized deductions.
|
796
|
-
|
797
|
-
Parameters
|
798
|
-
----------
|
799
|
-
e17500: float
|
800
|
-
Itemizable medical and dental expenses
|
801
|
-
e18400: float
|
802
|
-
Itemizable state and local income/sales taxes
|
803
|
-
e18500: float
|
804
|
-
Itemizable real-estate taxes paid
|
805
|
-
e19200: float
|
806
|
-
Itemizable interest paid
|
807
|
-
e19800: float
|
808
|
-
Itemizable charitable giving: cash/check contributions
|
809
|
-
e20100: float
|
810
|
-
Itemizable charitable giving: other than cash/check contributions
|
811
|
-
e20400: float
|
812
|
-
Itemizable gross (before 10% AGI disregard) casualty or theft loss
|
813
|
-
g20500: float
|
814
|
-
Itemizable gross (before 10% AGI disregard) casualty or theft loss
|
815
|
-
c00100: float
|
816
|
-
Adjusted gross income (AGI)
|
817
|
-
ID_AmountCap_rt: float
|
818
|
-
Ceiling on the gross amount of itemized deductions allowed;
|
819
|
-
expressed as decimal fraction of AGI
|
820
|
-
ID_AmountCap_Switch: list
|
821
|
-
Deductions subject to the cap on itemized deduction benefits
|
822
|
-
e17500_capped: float
|
823
|
-
Schedule A: medical expenses, capped by
|
824
|
-
ItemDedCap as a decimal fraction of AGI
|
825
|
-
e18400_capped: float
|
826
|
-
Schedule A: state and local income taxes deductlbe, capped by
|
827
|
-
ItemDedCap as a decimal fraction of AGI
|
828
|
-
e18500_capped: float
|
829
|
-
Schedule A: state and local real estate taxes deductible, capped by
|
830
|
-
ItemDedCap as a decimal fraction of AGI
|
831
|
-
e19200_capped: float
|
832
|
-
Schedule A: interest deduction deductible, capped by
|
833
|
-
ItemDedCap as decimal fraction of AGI
|
834
|
-
e19800_capped: float
|
835
|
-
Schedule A: charity cash contributions deductible, capped by
|
836
|
-
ItemDedCap as a decimal fraction of AGI
|
837
|
-
e20100_capped: float
|
838
|
-
Schedule A: charity noncash contributions deductible, capped by
|
839
|
-
ItemDedCap s a decimal fraction of AGI
|
840
|
-
e20400_capped: float
|
841
|
-
Schedule A: gross miscellaneous deductions deductible, capped by
|
842
|
-
ItemDedCap as a decimal fraction of AGI
|
843
|
-
g20500_capped: float
|
844
|
-
Schedule A: gross casualty or theft loss deductible, capped by
|
845
|
-
ItemDedCap s a decimal fraction of AGI
|
846
|
-
|
847
|
-
Returns
|
848
|
-
-------
|
849
|
-
e17500_capped: float
|
850
|
-
Schedule A: medical expenses, capped by
|
851
|
-
ItemDedCap as a decimal fraction of AGI
|
852
|
-
e18400_capped: float
|
853
|
-
Schedule A: state and local income taxes deductlbe, capped by
|
854
|
-
ItemDedCap as a decimal fraction of AGI
|
855
|
-
e18500_capped: float
|
856
|
-
Schedule A: state and local real estate taxes deductible, capped by
|
857
|
-
ItemDedCap as a decimal fraction of AGI
|
858
|
-
e19200_capped: float
|
859
|
-
Schedule A: interest deduction deductible, capped by
|
860
|
-
ItemDedCap as decimal fraction of AGI
|
861
|
-
e19800_capped: float
|
862
|
-
Schedule A: charity cash contributions deductible, capped by
|
863
|
-
ItemDedCap as a decimal fraction of AGI
|
864
|
-
e20100_capped: float
|
865
|
-
Schedule A: charity noncash contributions deductible, capped by
|
866
|
-
ItemDedCap as a decimal fraction of AGI
|
867
|
-
e20400_capped: float
|
868
|
-
Schedule A: gross miscellaneous deductions deductible, capped by
|
869
|
-
ItemDedCap as a decimal fraction of AGI
|
870
|
-
g20500_capped: float
|
871
|
-
Schedule A: gross casualty or theft loss deductible, capped by
|
872
|
-
ItemDedCap as a decimal fraction of AGI
|
873
|
-
"""
|
874
|
-
# pylint: disable=too-many-branches
|
875
|
-
|
876
|
-
cap = max(0., ID_AmountCap_rt * c00100)
|
877
|
-
|
878
|
-
gross_ded_amt = 0
|
879
|
-
if ID_AmountCap_Switch[0]: # medical
|
880
|
-
gross_ded_amt += e17500
|
881
|
-
if ID_AmountCap_Switch[1]: # statelocal
|
882
|
-
gross_ded_amt += e18400
|
883
|
-
if ID_AmountCap_Switch[2]: # realestate
|
884
|
-
gross_ded_amt += e18500
|
885
|
-
if ID_AmountCap_Switch[3]: # casualty
|
886
|
-
gross_ded_amt += g20500
|
887
|
-
if ID_AmountCap_Switch[4]: # misc
|
888
|
-
gross_ded_amt += e20400
|
889
|
-
if ID_AmountCap_Switch[5]: # interest
|
890
|
-
gross_ded_amt += e19200
|
891
|
-
if ID_AmountCap_Switch[6]: # charity
|
892
|
-
gross_ded_amt += e19800 + e20100
|
893
|
-
|
894
|
-
overage = max(0., gross_ded_amt - cap)
|
895
|
-
|
896
|
-
e17500_capped = e17500
|
897
|
-
e18400_capped = e18400
|
898
|
-
e18500_capped = e18500
|
899
|
-
g20500_capped = g20500
|
900
|
-
e20400_capped = e20400
|
901
|
-
e19200_capped = e19200
|
902
|
-
e19800_capped = e19800
|
903
|
-
e20100_capped = e20100
|
904
|
-
|
905
|
-
if overage > 0. and c00100 > 0.:
|
906
|
-
if ID_AmountCap_Switch[0]: # medical
|
907
|
-
e17500_capped -= (e17500 / gross_ded_amt) * overage
|
908
|
-
if ID_AmountCap_Switch[1]: # statelocal
|
909
|
-
e18400_capped -= (e18400 / (gross_ded_amt) * overage)
|
910
|
-
if ID_AmountCap_Switch[2]: # realestate
|
911
|
-
e18500_capped -= (e18500 / gross_ded_amt) * overage
|
912
|
-
if ID_AmountCap_Switch[3]: # casualty
|
913
|
-
g20500_capped -= (g20500 / gross_ded_amt) * overage
|
914
|
-
if ID_AmountCap_Switch[4]: # misc
|
915
|
-
e20400_capped -= (e20400 / gross_ded_amt) * overage
|
916
|
-
if ID_AmountCap_Switch[5]: # interest
|
917
|
-
e19200_capped -= (e19200 / gross_ded_amt) * overage
|
918
|
-
if ID_AmountCap_Switch[6]: # charity
|
919
|
-
e19800_capped -= (e19800 / gross_ded_amt) * overage
|
920
|
-
e20100_capped -= (e20100 / gross_ded_amt) * overage
|
921
|
-
|
922
|
-
return (e17500_capped, e18400_capped, e18500_capped, g20500_capped,
|
923
|
-
e20400_capped, e19200_capped, e19800_capped, e20100_capped)
|
924
|
-
|
925
|
-
|
926
|
-
@iterate_jit(nopython=True)
|
927
|
-
def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
|
928
|
-
e19800_capped, e20100_capped, e20400_capped, g20500_capped,
|
790
|
+
def ItemDed(e17500, e18400, e18500, e19200,
|
791
|
+
e19800, e20100, e20400, g20500,
|
929
792
|
MARS, age_head, age_spouse, c00100, c04470, c21040, c21060,
|
930
793
|
c17000, c18300, c19200, c19700, c20500, c20800,
|
931
794
|
ID_ps, ID_Medical_frt, ID_Medical_frt_add4aged, ID_Medical_hc,
|
@@ -942,30 +805,22 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
|
|
942
805
|
|
943
806
|
Parameters
|
944
807
|
----------
|
945
|
-
|
946
|
-
Schedule A: medical expenses
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
Schedule A:
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
Schedule A:
|
959
|
-
|
960
|
-
|
961
|
-
Schedule A: charity noncash contributions deductible, capped by
|
962
|
-
ItemDedCap as a decimal fraction of AGI
|
963
|
-
e20400_capped: float
|
964
|
-
Schedule A: gross miscellaneous deductions deductible, capped by
|
965
|
-
ItemDedCap as a decimal fraction of AGI
|
966
|
-
g20500_capped: float
|
967
|
-
Schedule A: gross casualty or theft loss deductible, capped by
|
968
|
-
ItemDedCap as a decimal fraction of AGI
|
808
|
+
e17500: float
|
809
|
+
Schedule A: medical expenses
|
810
|
+
e18400: float
|
811
|
+
Schedule A: state and local income taxes deductlbe
|
812
|
+
e18500: float
|
813
|
+
Schedule A: state and local real estate taxes deductible
|
814
|
+
e19200: float
|
815
|
+
Schedule A: interest deduction deductible
|
816
|
+
e19800: float
|
817
|
+
Schedule A: charity cash contributions deductible
|
818
|
+
e20100: float
|
819
|
+
Schedule A: charity noncash contributions deductible
|
820
|
+
e20400: float
|
821
|
+
Schedule A: gross miscellaneous deductions deductible
|
822
|
+
g20500: float
|
823
|
+
Schedule A: gross casualty or theft loss deductible
|
969
824
|
MARS: int
|
970
825
|
Filing marital status (1=single, 2=joint, 3=separate,
|
971
826
|
4=household-head, 5=widow(er))
|
@@ -1093,12 +948,12 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
|
|
1093
948
|
if age_head >= 65 or (MARS == 2 and age_spouse >= 65):
|
1094
949
|
medical_frt += ID_Medical_frt_add4aged
|
1095
950
|
c17750 = medical_frt * posagi
|
1096
|
-
c17000 = max(0.,
|
951
|
+
c17000 = max(0., e17500 - c17750) * (1. - ID_Medical_hc)
|
1097
952
|
c17000 = min(c17000, ID_Medical_c[MARS - 1])
|
1098
953
|
# State and local taxes
|
1099
|
-
c18400 = min((1. - ID_StateLocalTax_hc) * max(
|
954
|
+
c18400 = min((1. - ID_StateLocalTax_hc) * max(e18400, 0.),
|
1100
955
|
ID_StateLocalTax_c[MARS - 1])
|
1101
|
-
c18500 = min((1. - ID_RealEstate_hc) *
|
956
|
+
c18500 = min((1. - ID_RealEstate_hc) * e18500,
|
1102
957
|
ID_RealEstate_c[MARS - 1])
|
1103
958
|
# following two statements implement a cap on c18400 and c18500 in a way
|
1104
959
|
# that those with negative AGI, c00100, are not capped under current law,
|
@@ -1108,22 +963,22 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
|
|
1108
963
|
c18300 = (c18400 + c18500) * (1. - ID_AllTaxes_hc)
|
1109
964
|
c18300 = min(c18300, ID_AllTaxes_c[MARS - 1])
|
1110
965
|
# Interest paid
|
1111
|
-
c19200 =
|
966
|
+
c19200 = e19200 * (1. - ID_InterestPaid_hc)
|
1112
967
|
c19200 = min(c19200, ID_InterestPaid_c[MARS - 1])
|
1113
968
|
# Charity
|
1114
|
-
charity_ded_cash = min(ID_Charity_crt_cash * posagi,
|
1115
|
-
charity_ded_noncash = min(ID_Charity_crt_noncash * posagi,
|
969
|
+
charity_ded_cash = min(ID_Charity_crt_cash * posagi, e19800)
|
970
|
+
charity_ded_noncash = min(ID_Charity_crt_noncash * posagi, e20100)
|
1116
971
|
c19700 = charity_ded_cash + charity_ded_noncash
|
1117
972
|
# charity floor is zero in present law
|
1118
973
|
charity_floor = max(ID_Charity_frt * posagi, ID_Charity_f[MARS - 1])
|
1119
974
|
c19700 = max(0., c19700 - charity_floor) * (1. - ID_Charity_hc)
|
1120
975
|
c19700 = min(c19700, ID_Charity_c[MARS - 1])
|
1121
976
|
# Casualty
|
1122
|
-
c20500 = (max(0.,
|
977
|
+
c20500 = (max(0., g20500 - ID_Casualty_frt * posagi) *
|
1123
978
|
(1. - ID_Casualty_hc))
|
1124
979
|
c20500 = min(c20500, ID_Casualty_c[MARS - 1])
|
1125
980
|
# Miscellaneous
|
1126
|
-
c20400 =
|
981
|
+
c20400 = e20400
|
1127
982
|
c20750 = ID_Miscellaneous_frt * posagi
|
1128
983
|
c20800 = max(0., c20400 - c20750) * (1. - ID_Miscellaneous_hc)
|
1129
984
|
c20800 = min(c20800, ID_Miscellaneous_c[MARS - 1])
|
@@ -1406,17 +1261,11 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
|
1406
1261
|
|
1407
1262
|
|
1408
1263
|
@JIT(nopython=True)
|
1409
|
-
def SchXYZ(taxable_income, MARS,
|
1410
|
-
PT_rt1, PT_rt2, PT_rt3, PT_rt4, PT_rt5,
|
1411
|
-
PT_rt6, PT_rt7, PT_rt8,
|
1412
|
-
PT_brk1, PT_brk2, PT_brk3, PT_brk4, PT_brk5,
|
1413
|
-
PT_brk6, PT_brk7,
|
1264
|
+
def SchXYZ(taxable_income, MARS,
|
1414
1265
|
II_rt1, II_rt2, II_rt3, II_rt4, II_rt5,
|
1415
1266
|
II_rt6, II_rt7, II_rt8,
|
1416
1267
|
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5,
|
1417
|
-
II_brk6, II_brk7
|
1418
|
-
PT_EligibleRate_passive, PT_wages_active_income,
|
1419
|
-
PT_top_stacking):
|
1268
|
+
II_brk6, II_brk7):
|
1420
1269
|
"""
|
1421
1270
|
Returns Schedule X, Y, Z tax amount for specified taxable_income.
|
1422
1271
|
|
@@ -1436,36 +1285,6 @@ def SchXYZ(taxable_income, MARS, e00900, e26270, e02000, e00200,
|
|
1436
1285
|
etc, income/loss
|
1437
1286
|
e00200: float
|
1438
1287
|
Wages, salaries, and tips for filing unit net of pension contributions
|
1439
|
-
PT_rt1: float
|
1440
|
-
Pass through income tax rate 1
|
1441
|
-
PT_rt2: float
|
1442
|
-
Pass through income tax rate 2
|
1443
|
-
PT_rt3: float
|
1444
|
-
Pass through income tax rate 3
|
1445
|
-
PT_rt4: float
|
1446
|
-
Pass through income tax rate 4
|
1447
|
-
PT_rt5: float
|
1448
|
-
Pass through income tax rate 5
|
1449
|
-
PT_rt6: float
|
1450
|
-
Pass through income tax rate 6
|
1451
|
-
PT_rt7: float
|
1452
|
-
Pass through income tax rate 7
|
1453
|
-
PT_rt8: float
|
1454
|
-
Pass through income tax rate 8
|
1455
|
-
PT_brk1: list
|
1456
|
-
Pass through income tax bracket (upper threshold) 1
|
1457
|
-
PT_brk2: list
|
1458
|
-
Pass through income tax bracket (upper threshold) 2
|
1459
|
-
PT_brk3: list
|
1460
|
-
Pass through income tax bracket (upper threshold) 3
|
1461
|
-
PT_brk4: list
|
1462
|
-
Pass through income tax bracket (upper threshold) 4
|
1463
|
-
PT_brk5: list
|
1464
|
-
Pass through income tax bracket (upper threshold) 5
|
1465
|
-
PT_brk6: list
|
1466
|
-
Pass through income tax bracket (upper threshold) 6
|
1467
|
-
PT_brk7: list
|
1468
|
-
Pass through income tax bracket (upper threshold) 7
|
1469
1288
|
II_rt1: float
|
1470
1289
|
Personal income (regular/non-AMT/non-pass-through) tax rate 1
|
1471
1290
|
II_rt2: float
|
@@ -1503,75 +1322,28 @@ def SchXYZ(taxable_income, MARS, e00900, e26270, e02000, e00200,
|
|
1503
1322
|
II_brk7: list
|
1504
1323
|
Personal income (regular/non-AMT/non-pass/through)
|
1505
1324
|
tax bracket (upper threshold) 7
|
1506
|
-
PT_EligibleRate_active: float
|
1507
|
-
Share of active business income eligible for PT rate schedule
|
1508
|
-
PT_EligibleRate_passive: float
|
1509
|
-
Share of passive business income eligible for PT rate schedule
|
1510
|
-
PT_wages_active_income: bool
|
1511
|
-
Wages included in (positive) active business eligible for PT rates
|
1512
|
-
PT_top_stacking: bool
|
1513
|
-
PT taxable income stacked on top of regular taxable income
|
1514
1325
|
|
1515
1326
|
Returns
|
1516
1327
|
-------
|
1517
1328
|
reg_tax: float
|
1518
|
-
Individual income tax liability on
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
# define pass-through income eligible for PT schedule
|
1525
|
-
pt_passive = PT_EligibleRate_passive * (e02000 - e26270)
|
1526
|
-
pt_active_gross = e00900 + e26270
|
1527
|
-
if (pt_active_gross > 0) and PT_wages_active_income:
|
1528
|
-
pt_active_gross = pt_active_gross + e00200
|
1529
|
-
pt_active = PT_EligibleRate_active * pt_active_gross
|
1530
|
-
pt_active = min(pt_active, e00900 + e26270)
|
1531
|
-
pt_taxinc = max(0., pt_passive + pt_active)
|
1532
|
-
if pt_taxinc >= taxable_income:
|
1533
|
-
pt_taxinc = taxable_income
|
1534
|
-
reg_taxinc = 0.
|
1535
|
-
else:
|
1536
|
-
# pt_taxinc is unchanged
|
1537
|
-
reg_taxinc = taxable_income - pt_taxinc
|
1538
|
-
# determine stacking order
|
1539
|
-
if PT_top_stacking:
|
1540
|
-
reg_tbase = 0.
|
1541
|
-
pt_tbase = reg_taxinc
|
1542
|
-
else:
|
1543
|
-
reg_tbase = pt_taxinc
|
1544
|
-
pt_tbase = 0.
|
1545
|
-
# compute Schedule X,Y,Z tax using the two components of taxable income
|
1546
|
-
if reg_taxinc > 0.:
|
1547
|
-
reg_tax = Taxes(reg_taxinc, MARS, reg_tbase,
|
1329
|
+
Individual income tax liability on all taxable income
|
1330
|
+
"""
|
1331
|
+
# compute Schedule X,Y,Z tax using taxable income
|
1332
|
+
reg_tax = 0.
|
1333
|
+
if taxable_income > 0.:
|
1334
|
+
reg_tax = Taxes(taxable_income, MARS, 0.0,
|
1548
1335
|
II_rt1, II_rt2, II_rt3, II_rt4,
|
1549
1336
|
II_rt5, II_rt6, II_rt7, II_rt8, II_brk1, II_brk2,
|
1550
1337
|
II_brk3, II_brk4, II_brk5, II_brk6, II_brk7)
|
1551
|
-
|
1552
|
-
reg_tax = 0.
|
1553
|
-
if pt_taxinc > 0.:
|
1554
|
-
pt_tax = Taxes(pt_taxinc, MARS, pt_tbase,
|
1555
|
-
PT_rt1, PT_rt2, PT_rt3, PT_rt4,
|
1556
|
-
PT_rt5, PT_rt6, PT_rt7, PT_rt8, PT_brk1, PT_brk2,
|
1557
|
-
PT_brk3, PT_brk4, PT_brk5, PT_brk6, PT_brk7)
|
1558
|
-
else:
|
1559
|
-
pt_tax = 0.
|
1560
|
-
return reg_tax + pt_tax
|
1338
|
+
return reg_tax
|
1561
1339
|
|
1562
1340
|
|
1563
1341
|
@iterate_jit(nopython=True)
|
1564
|
-
def SchXYZTax(c04800, MARS,
|
1565
|
-
PT_rt1, PT_rt2, PT_rt3, PT_rt4, PT_rt5,
|
1566
|
-
PT_rt6, PT_rt7, PT_rt8,
|
1567
|
-
PT_brk1, PT_brk2, PT_brk3, PT_brk4, PT_brk5,
|
1568
|
-
PT_brk6, PT_brk7,
|
1342
|
+
def SchXYZTax(c04800, MARS,
|
1569
1343
|
II_rt1, II_rt2, II_rt3, II_rt4, II_rt5,
|
1570
1344
|
II_rt6, II_rt7, II_rt8,
|
1571
1345
|
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5,
|
1572
|
-
II_brk6, II_brk7,
|
1573
|
-
PT_EligibleRate_passive, PT_wages_active_income,
|
1574
|
-
PT_top_stacking, c05200):
|
1346
|
+
II_brk6, II_brk7, c05200):
|
1575
1347
|
"""
|
1576
1348
|
SchXYZTax calls SchXYZ function and sets c05200 to returned amount.
|
1577
1349
|
|
@@ -1582,44 +1354,6 @@ def SchXYZTax(c04800, MARS, e00900, e26270, e02000, e00200,
|
|
1582
1354
|
MARS: int
|
1583
1355
|
Filing (marital) status. (1=single, 2=joint, 3=separate,
|
1584
1356
|
4=household-head, 5=widow(er))
|
1585
|
-
e00900: float
|
1586
|
-
Schedule C business net profit/loss for filing unit
|
1587
|
-
e26270: float
|
1588
|
-
Schedule E: combined partnership and S-corporation net income/loss
|
1589
|
-
e02000: float
|
1590
|
-
Farm net income/loss for filing unit from Schedule F
|
1591
|
-
e00200: float
|
1592
|
-
Farm net income/loss for filing unit from Schedule F
|
1593
|
-
PT_rt1: float
|
1594
|
-
Pass through income tax rate 1
|
1595
|
-
PT_rt2: float
|
1596
|
-
Pass through income tax rate 2
|
1597
|
-
PT_rt3: float
|
1598
|
-
Pass through income tax rate 3
|
1599
|
-
PT_rt4: float
|
1600
|
-
Pass through income tax rate 4
|
1601
|
-
PT_rt5: float
|
1602
|
-
Pass through income tax rate 5
|
1603
|
-
PT_rt6: float
|
1604
|
-
Pass through income tax rate 6
|
1605
|
-
PT_rt7: float
|
1606
|
-
Pass through income tax rate 7
|
1607
|
-
PT_rt8: float
|
1608
|
-
Pass through income tax rate 8
|
1609
|
-
PT_brk1: list
|
1610
|
-
Pass through income tax bracket (upper threshold) 1
|
1611
|
-
PT_brk2: list
|
1612
|
-
Pass through income tax bracket (upper threshold) 2
|
1613
|
-
PT_brk3: list
|
1614
|
-
Pass through income tax bracket (upper threshold) 3
|
1615
|
-
PT_brk4: list
|
1616
|
-
Pass through income tax bracket (upper threshold) 4
|
1617
|
-
PT_brk5: list
|
1618
|
-
Pass through income tax bracket (upper threshold) 5
|
1619
|
-
PT_brk6: list
|
1620
|
-
Pass through income tax bracket (upper threshold) 6
|
1621
|
-
PT_brk7: list
|
1622
|
-
Pass through income tax bracket (upper threshold) 7
|
1623
1357
|
II_rt1: float
|
1624
1358
|
Personal income (regular/non-AMT/non-pass-through) tax rate 1
|
1625
1359
|
II_rt2: float
|
@@ -1657,45 +1391,28 @@ def SchXYZTax(c04800, MARS, e00900, e26270, e02000, e00200,
|
|
1657
1391
|
II_brk7: list
|
1658
1392
|
Personal income (regular/non-AMT/non-pass/through)
|
1659
1393
|
tax bracket (upper threshold) 7
|
1660
|
-
PT_EligibleRate_active: float
|
1661
|
-
Share of active business income eligible for PT rate schedule
|
1662
|
-
PT_EligibleRate_passive: float
|
1663
|
-
Share of passive business income eligible for PT rate schedule
|
1664
|
-
PT_wages_active_income: bool
|
1665
|
-
Wages included in (positive) active business eligible for PT rates
|
1666
|
-
PT_top_stacking: bool
|
1667
|
-
PT taxable income stacked on top of regular taxable income
|
1668
1394
|
c05200: float
|
1669
1395
|
Tax amount from Schedule X,Y,Z tables
|
1670
1396
|
|
1671
1397
|
Returns
|
1672
1398
|
-------
|
1673
1399
|
c05200: float
|
1674
|
-
Tax
|
1400
|
+
Tax amount from Schedule X, Y, Z tables
|
1675
1401
|
"""
|
1676
|
-
c05200 = SchXYZ(c04800, MARS,
|
1677
|
-
PT_rt1, PT_rt2, PT_rt3, PT_rt4, PT_rt5,
|
1678
|
-
PT_rt6, PT_rt7, PT_rt8,
|
1679
|
-
PT_brk1, PT_brk2, PT_brk3, PT_brk4, PT_brk5,
|
1680
|
-
PT_brk6, PT_brk7,
|
1402
|
+
c05200 = SchXYZ(c04800, MARS,
|
1681
1403
|
II_rt1, II_rt2, II_rt3, II_rt4, II_rt5,
|
1682
1404
|
II_rt6, II_rt7, II_rt8,
|
1683
1405
|
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5,
|
1684
|
-
II_brk6, II_brk7
|
1685
|
-
PT_EligibleRate_passive, PT_wages_active_income,
|
1686
|
-
PT_top_stacking)
|
1406
|
+
II_brk6, II_brk7)
|
1687
1407
|
return c05200
|
1688
1408
|
|
1689
1409
|
|
1690
1410
|
@iterate_jit(nopython=True)
|
1691
|
-
def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
|
1692
|
-
e24515, e24518, MARS, c04800, c05200,
|
1411
|
+
def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
|
1412
|
+
e24515, e24518, MARS, c04800, c05200,
|
1693
1413
|
II_rt1, II_rt2, II_rt3, II_rt4, II_rt5, II_rt6, II_rt7, II_rt8,
|
1694
1414
|
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5, II_brk6, II_brk7,
|
1695
|
-
|
1696
|
-
PT_brk1, PT_brk2, PT_brk3, PT_brk4, PT_brk5, PT_brk6, PT_brk7,
|
1697
|
-
CG_nodiff, PT_EligibleRate_active, PT_EligibleRate_passive,
|
1698
|
-
PT_wages_active_income, PT_top_stacking,
|
1415
|
+
CG_nodiff,
|
1699
1416
|
CG_rt1, CG_rt2, CG_rt3, CG_rt4, CG_brk1, CG_brk2, CG_brk3,
|
1700
1417
|
dwks10, dwks13, dwks14, dwks19, dwks43, c05700, taxbc):
|
1701
1418
|
"""
|
@@ -1774,47 +1491,9 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
|
|
1774
1491
|
II_brk7: list
|
1775
1492
|
Personal income (regular/non-AMT/non-pass/through)
|
1776
1493
|
tax bracket (upper threshold) 7
|
1777
|
-
PT_rt1: float
|
1778
|
-
Pass through income tax rate 1
|
1779
|
-
PT_rt2: float
|
1780
|
-
Pass through income tax rate 2
|
1781
|
-
PT_rt3: float
|
1782
|
-
Pass through income tax rate 3
|
1783
|
-
PT_rt4: float
|
1784
|
-
Pass through income tax rate 4
|
1785
|
-
PT_rt5: float
|
1786
|
-
Pass through income tax rate 5
|
1787
|
-
PT_rt6: float
|
1788
|
-
Pass through income tax rate 6
|
1789
|
-
PT_rt7: float
|
1790
|
-
Pass through income tax rate 7
|
1791
|
-
PT_rt8: float
|
1792
|
-
Pass through income tax rate 8
|
1793
|
-
PT_brk1: list
|
1794
|
-
Pass through income tax bracket (upper threshold) 1
|
1795
|
-
PT_brk2: list
|
1796
|
-
Pass through income tax bracket (upper threshold) 2
|
1797
|
-
PT_brk3: list
|
1798
|
-
Pass through income tax bracket (upper threshold) 3
|
1799
|
-
PT_brk4: list
|
1800
|
-
Pass through income tax bracket (upper threshold) 4
|
1801
|
-
PT_brk5: list
|
1802
|
-
Pass through income tax bracket (upper threshold) 5
|
1803
|
-
PT_brk6: list
|
1804
|
-
Pass through income tax bracket (upper threshold) 6
|
1805
|
-
PT_brk7: list
|
1806
|
-
Pass through income tax bracket (upper threshold) 7
|
1807
1494
|
CG_nodiff: bool
|
1808
1495
|
Long term capital gains and qualified dividends taxed no differently
|
1809
1496
|
than regular taxable income
|
1810
|
-
PT_EligibleRate_active: float
|
1811
|
-
Share of active business income eligible for PT rate schedule
|
1812
|
-
PT_EligibleRate_passive: float
|
1813
|
-
Share of passive business income eligible for PT rate schedule
|
1814
|
-
PT_wages_active_income: bool
|
1815
|
-
Wages included in (positive) active business eligible for PT rates
|
1816
|
-
PT_top_stacking: bool
|
1817
|
-
PT taxable income stacked on top of regular taxable income
|
1818
1497
|
CG_rt1: float
|
1819
1498
|
Long term capital gain and qualified dividends (regular/non-AMT) rate 1
|
1820
1499
|
CG_rt2: float
|
@@ -1929,17 +1608,11 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
|
|
1929
1608
|
dwks39 = dwks19 + dwks20 + dwks28 + dwks31 + dwks37
|
1930
1609
|
dwks40 = dwks1 - dwks39
|
1931
1610
|
dwks41 = 0.28 * dwks40
|
1932
|
-
dwks42 = SchXYZ(dwks19, MARS,
|
1933
|
-
PT_rt1, PT_rt2, PT_rt3, PT_rt4, PT_rt5,
|
1934
|
-
PT_rt6, PT_rt7, PT_rt8,
|
1935
|
-
PT_brk1, PT_brk2, PT_brk3, PT_brk4, PT_brk5,
|
1936
|
-
PT_brk6, PT_brk7,
|
1611
|
+
dwks42 = SchXYZ(dwks19, MARS,
|
1937
1612
|
II_rt1, II_rt2, II_rt3, II_rt4, II_rt5,
|
1938
1613
|
II_rt6, II_rt7, II_rt8,
|
1939
1614
|
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5,
|
1940
|
-
II_brk6, II_brk7
|
1941
|
-
PT_EligibleRate_passive, PT_wages_active_income,
|
1942
|
-
PT_top_stacking)
|
1615
|
+
II_brk6, II_brk7)
|
1943
1616
|
dwks43 = (dwks29 + dwks32 + dwks38 + dwks41 + dwks42 +
|
1944
1617
|
lowest_rate_tax + highest_rate_incremental_tax)
|
1945
1618
|
dwks44 = c05200
|
@@ -3654,84 +3327,6 @@ def ComputeBenefit(calc, ID_switch):
|
|
3654
3327
|
return benefit
|
3655
3328
|
|
3656
3329
|
|
3657
|
-
def BenefitSurtax(calc):
|
3658
|
-
"""
|
3659
|
-
Computes itemized-deduction-benefit surtax and adds the surtax amount
|
3660
|
-
to income tax, combined tax, and surtax liabilities.
|
3661
|
-
|
3662
|
-
Parameters
|
3663
|
-
----------
|
3664
|
-
calc: Calculator object
|
3665
|
-
calc represents the reform while self represents the baseline
|
3666
|
-
|
3667
|
-
Returns
|
3668
|
-
-------
|
3669
|
-
None:
|
3670
|
-
The function modifies calc
|
3671
|
-
"""
|
3672
|
-
if calc.policy_param('ID_BenefitSurtax_crt') != 1.:
|
3673
|
-
ben = ComputeBenefit(calc,
|
3674
|
-
calc.policy_param('ID_BenefitSurtax_Switch'))
|
3675
|
-
agi = calc.array('c00100')
|
3676
|
-
ben_deduct = calc.policy_param('ID_BenefitSurtax_crt') * agi
|
3677
|
-
ben_exempt_array = calc.policy_param('ID_BenefitSurtax_em')
|
3678
|
-
ben_exempt = ben_exempt_array[calc.array('MARS') - 1]
|
3679
|
-
ben_dedem = ben_deduct + ben_exempt
|
3680
|
-
ben_surtax = (calc.policy_param('ID_BenefitSurtax_trt') *
|
3681
|
-
np.where(ben > ben_dedem, ben - ben_dedem, 0.))
|
3682
|
-
# add ben_surtax to income & combined taxes and to surtax subtotal
|
3683
|
-
calc.incarray('iitax', ben_surtax)
|
3684
|
-
calc.incarray('combined', ben_surtax)
|
3685
|
-
calc.incarray('surtax', ben_surtax)
|
3686
|
-
|
3687
|
-
|
3688
|
-
def BenefitLimitation(calc):
|
3689
|
-
"""
|
3690
|
-
Limits the benefits of select itemized deductions to a fraction of
|
3691
|
-
deductible expenses.
|
3692
|
-
|
3693
|
-
Parameters
|
3694
|
-
----------
|
3695
|
-
calc: Calculator object
|
3696
|
-
calc represents the reform while self represents the baseline
|
3697
|
-
|
3698
|
-
Returns
|
3699
|
-
-------
|
3700
|
-
None:
|
3701
|
-
The function modifies calc
|
3702
|
-
"""
|
3703
|
-
if calc.policy_param('ID_BenefitCap_rt') != 1.:
|
3704
|
-
benefit = ComputeBenefit(calc,
|
3705
|
-
calc.policy_param('ID_BenefitCap_Switch'))
|
3706
|
-
# Calculate total deductible expenses under the cap
|
3707
|
-
deduct_exps = 0.
|
3708
|
-
if calc.policy_param('ID_BenefitCap_Switch')[0]: # medical
|
3709
|
-
deduct_exps += calc.array('c17000')
|
3710
|
-
if calc.policy_param('ID_BenefitCap_Switch')[1]: # statelocal
|
3711
|
-
one_minus_hc = 1. - calc.policy_param('ID_StateLocalTax_hc')
|
3712
|
-
deduct_exps += (one_minus_hc *
|
3713
|
-
np.maximum(calc.array('e18400_capped'), 0.))
|
3714
|
-
if calc.policy_param('ID_BenefitCap_Switch')[2]: # realestate
|
3715
|
-
one_minus_hc = 1. - calc.policy_param('ID_RealEstate_hc')
|
3716
|
-
deduct_exps += one_minus_hc * calc.array('e18500_capped')
|
3717
|
-
if calc.policy_param('ID_BenefitCap_Switch')[3]: # casualty
|
3718
|
-
deduct_exps += calc.array('c20500')
|
3719
|
-
if calc.policy_param('ID_BenefitCap_Switch')[4]: # misc
|
3720
|
-
deduct_exps += calc.array('c20800')
|
3721
|
-
if calc.policy_param('ID_BenefitCap_Switch')[5]: # interest
|
3722
|
-
deduct_exps += calc.array('c19200')
|
3723
|
-
if calc.policy_param('ID_BenefitCap_Switch')[6]: # charity
|
3724
|
-
deduct_exps += calc.array('c19700')
|
3725
|
-
# Calculate cap value for itemized deductions
|
3726
|
-
benefit_limit = deduct_exps * calc.policy_param('ID_BenefitCap_rt')
|
3727
|
-
# Add the difference between the actual benefit and capped benefit
|
3728
|
-
# to income tax and combined tax liabilities.
|
3729
|
-
excess_benefit = np.maximum(benefit - benefit_limit, 0)
|
3730
|
-
calc.incarray('iitax', excess_benefit)
|
3731
|
-
calc.incarray('surtax', excess_benefit)
|
3732
|
-
calc.incarray('combined', excess_benefit)
|
3733
|
-
|
3734
|
-
|
3735
3330
|
@iterate_jit(nopython=True)
|
3736
3331
|
def FairShareTax(c00100, MARS, ptax_was, setax, ptax_amc,
|
3737
3332
|
FST_AGI_trt, FST_AGI_thd_lo, FST_AGI_thd_hi,
|