taxcalc 5.0.0__py3-none-any.whl → 5.1.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 +364 -276
- taxcalc/calculator.py +4 -3
- taxcalc/consumption.json +0 -16
- taxcalc/growdiff.json +2 -18
- taxcalc/parameters.py +1 -1
- taxcalc/policy.py +15 -2
- taxcalc/policy_current_law.json +1011 -85
- taxcalc/records.py +3 -0
- taxcalc/records_variables.json +40 -1
- taxcalc/reforms/2017_law.json +1 -1
- taxcalc/reforms/ARPA.json +6 -6
- taxcalc/reforms/CARES.json +2 -2
- taxcalc/reforms/TCJA.json +1 -1
- taxcalc/reforms/ext.json +1 -1
- taxcalc/tests/cpscsv_agg_expect.csv +6 -6
- taxcalc/tests/puf_var_correl_coeffs_2016.csv +10 -10
- taxcalc/tests/puf_var_wght_means_by_year.csv +5 -5
- taxcalc/tests/pufcsv_agg_expect.csv +8 -8
- taxcalc/tests/pufcsv_mtr_expect.txt +18 -18
- taxcalc/tests/reforms.json +1 -1
- taxcalc/tests/test_calcfunctions.py +113 -29
- taxcalc/tests/test_parameters.py +27 -19
- taxcalc/tests/test_policy.py +1 -1
- taxcalc/tests/test_reforms.py +1 -1
- {taxcalc-5.0.0.dist-info → taxcalc-5.1.0.dist-info}/METADATA +1 -1
- {taxcalc-5.0.0.dist-info → taxcalc-5.1.0.dist-info}/RECORD +31 -31
- {taxcalc-5.0.0.dist-info → taxcalc-5.1.0.dist-info}/WHEEL +0 -0
- {taxcalc-5.0.0.dist-info → taxcalc-5.1.0.dist-info}/entry_points.txt +0 -0
- {taxcalc-5.0.0.dist-info → taxcalc-5.1.0.dist-info}/licenses/LICENSE +0 -0
- {taxcalc-5.0.0.dist-info → taxcalc-5.1.0.dist-info}/top_level.txt +0 -0
taxcalc/calcfunctions.py
CHANGED
@@ -16,7 +16,6 @@ Note: the parameter_indexing_CPI_offset parameter is no longer used.
|
|
16
16
|
# pylint: disable=too-many-locals
|
17
17
|
|
18
18
|
import math
|
19
|
-
import copy
|
20
19
|
import numpy as np
|
21
20
|
from taxcalc.decorators import iterate_jit, JIT
|
22
21
|
|
@@ -349,7 +348,12 @@ def Adj(e03150, e03210, c03260,
|
|
349
348
|
ALD_EarlyWithdraw_hc, ALD_AlimonyPaid_hc, ALD_AlimonyReceived_hc,
|
350
349
|
ALD_EducatorExpenses_hc, ALD_HSADeduction_hc, ALD_IRAContributions_hc,
|
351
350
|
ALD_DomesticProduction_hc, ALD_Tuition_hc,
|
352
|
-
|
351
|
+
MARS, earned,
|
352
|
+
overtime_income, ALD_OvertimeIncome_hc, ALD_OvertimeIncome_c,
|
353
|
+
ALD_OvertimeIncome_ps, ALD_OvertimeIncome_prt,
|
354
|
+
tip_income, ALD_TipIncome_hc, ALD_TipIncome_c,
|
355
|
+
ALD_TipIncome_ps, ALD_TipIncome_prt,
|
356
|
+
c02900, ALD_OvertimeIncome, ALD_TipIncome):
|
353
357
|
"""
|
354
358
|
Adj calculates Form 1040 AGI adjustments (i.e., Above-the-Line Deductions).
|
355
359
|
|
@@ -403,11 +407,40 @@ def Adj(e03150, e03210, c03260,
|
|
403
407
|
Domestic production haircut
|
404
408
|
ALD_Tuition_hc: float
|
405
409
|
Tuition and fees haircut
|
410
|
+
MARS: int
|
411
|
+
Filing marital status (1=single, 2=joint, 3=separate,
|
412
|
+
4=household-head, 5=widow(er))
|
413
|
+
earned: float
|
414
|
+
Earned income used to phase-out ALD_OvertimeIncome and ALD_TipIncome
|
415
|
+
overtime_income: float
|
416
|
+
Overtime income qualified for an above-the-line deduction
|
417
|
+
ALD_OvertimeIncome_hc: float
|
418
|
+
ALD_OvertimeIncome haircut
|
419
|
+
ALD_OvertimeIncome_c: list[float]
|
420
|
+
ALD_OvertimeIncome cap
|
421
|
+
ALD_OvertimeIncome_ps: list[float]
|
422
|
+
ALD_OvertimeIncome phase-out earned income start
|
423
|
+
ALD_OvertimeIncome_prt: float
|
424
|
+
ALD_OvertimeIncome phase-out rate
|
425
|
+
tip_income: float
|
426
|
+
Tip income qualified for an above-the-line deduction
|
427
|
+
ALD_TipIncome_hc: float
|
428
|
+
ALD_TipIncome haircut
|
429
|
+
ALD_TipIncome_c: list[float]
|
430
|
+
ALD_TipIncome cap
|
431
|
+
ALD_TipIncome_ps: list[float]
|
432
|
+
ALD_TipIncome phase-out earned income start
|
433
|
+
ALD_TipIncome_prt: float
|
434
|
+
ALD_TipIncome phase-out rate
|
406
435
|
|
407
436
|
Returns
|
408
437
|
-------
|
409
438
|
c02900: float
|
410
439
|
Total of all "above the line" income adjustments to get AGI
|
440
|
+
ALD_OvertimeIncome: float
|
441
|
+
Overtime ALD amount included in c02900
|
442
|
+
ALD_TipIncome: float
|
443
|
+
Tip ALD amount included in c02900
|
411
444
|
"""
|
412
445
|
# Form 2555 foreign earned income exclusion is assumed to be zero
|
413
446
|
# Form 1040 adjustments that are included in expanded income:
|
@@ -424,7 +457,29 @@ def Adj(e03150, e03210, c03260,
|
|
424
457
|
(1. - ALD_IRAContributions_hc) * e03150 +
|
425
458
|
(1. - ALD_KEOGH_SEP_hc) * e03300 +
|
426
459
|
care_deduction)
|
427
|
-
|
460
|
+
# calculate ALD_OvertimeIncome
|
461
|
+
ALD_OvertimeIncome = 0.
|
462
|
+
if overtime_income > 0. and ALD_OvertimeIncome_hc < 1.0:
|
463
|
+
ded = min(overtime_income, ALD_OvertimeIncome_c[MARS - 1])
|
464
|
+
po_start = ALD_OvertimeIncome_ps[MARS - 1]
|
465
|
+
if earned > po_start:
|
466
|
+
excess = earned - po_start
|
467
|
+
po_amount = excess * ALD_OvertimeIncome_prt
|
468
|
+
ded = max(0., ded - po_amount)
|
469
|
+
ALD_OvertimeIncome = ded
|
470
|
+
# calculate ALD_TipIncome
|
471
|
+
ALD_TipIncome = 0.
|
472
|
+
if tip_income > 0. and ALD_TipIncome_hc < 1.0:
|
473
|
+
ded = min(tip_income, ALD_TipIncome_c[MARS - 1])
|
474
|
+
po_start = ALD_TipIncome_ps[MARS - 1]
|
475
|
+
if earned > po_start:
|
476
|
+
excess = earned - po_start
|
477
|
+
po_amount = excess * ALD_TipIncome_prt
|
478
|
+
ded = max(0., ded - po_amount)
|
479
|
+
ALD_TipIncome = ded
|
480
|
+
# return results
|
481
|
+
c02900 += ALD_OvertimeIncome + ALD_TipIncome
|
482
|
+
return (c02900, ALD_OvertimeIncome, ALD_TipIncome)
|
428
483
|
|
429
484
|
|
430
485
|
@iterate_jit(nopython=True)
|
@@ -698,7 +753,7 @@ def UBI(nu18, n1820, n21, UBI_u18, UBI_1820, UBI_21, UBI_ecrt,
|
|
698
753
|
|
699
754
|
@iterate_jit(nopython=True)
|
700
755
|
def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
|
701
|
-
II_em, II_em_ps,
|
756
|
+
II_em, II_em_ps, II_em_prt, II_no_em_nu18,
|
702
757
|
e02300, UI_thd, UI_em, c00100, pre_c04600, c04600):
|
703
758
|
"""
|
704
759
|
Computes Adjusted Gross Income (AGI), c00100, and
|
@@ -731,7 +786,7 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
|
|
731
786
|
Personal and dependent exemption amount
|
732
787
|
II_em_ps: list
|
733
788
|
Personal exemption phaseout starting income
|
734
|
-
|
789
|
+
II_em_prt: float
|
735
790
|
Personal exemption phaseout rate
|
736
791
|
II_no_em_nu18: float
|
737
792
|
Repeal personal exemptions for dependents under age 18
|
@@ -776,30 +831,120 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
|
|
776
831
|
if exact == 1: # exact calculation as on tax forms
|
777
832
|
line5 = max(0., c00100 - II_em_ps[MARS - 1])
|
778
833
|
line6 = math.ceil(line5 / (2500. / sep))
|
779
|
-
line7 =
|
834
|
+
line7 = II_em_prt * line6
|
780
835
|
c04600 = max(0., pre_c04600 * (1. - line7))
|
781
836
|
else: # smoothed calculation needed for sensible mtr calculation
|
782
|
-
dispc_numer =
|
837
|
+
dispc_numer = II_em_prt * (c00100 - II_em_ps[MARS - 1])
|
783
838
|
dispc_denom = 2500. / sep
|
784
839
|
dispc = min(1., max(0., dispc_numer / dispc_denom))
|
785
840
|
c04600 = pre_c04600 * (1. - dispc)
|
786
841
|
return (c00100, pre_c04600, c04600)
|
787
842
|
|
788
843
|
|
844
|
+
@iterate_jit(nopython=True)
|
845
|
+
def MiscDed(age_head, age_spouse, MARS, c00100, exact,
|
846
|
+
SeniorDed_c, SeniorDed_ps, SeniorDed_prt,
|
847
|
+
auto_loan_interest,
|
848
|
+
AutoLoanInterestDed_c,
|
849
|
+
AutoLoanInterestDed_ps,
|
850
|
+
AutoLoanInterestDed_po_step_size,
|
851
|
+
AutoLoanInterestDed_po_rate_per_step,
|
852
|
+
senior_deduction, auto_loan_interest_deduction):
|
853
|
+
"""
|
854
|
+
Calculates below-the-line deduction for elderly head/spouse and
|
855
|
+
deduction on qualified auto loan interest paid.
|
856
|
+
|
857
|
+
Parameters
|
858
|
+
----------
|
859
|
+
age_head: int
|
860
|
+
Age of tax unit head
|
861
|
+
age_head: int
|
862
|
+
Age of tax unit spouse
|
863
|
+
MARS: int
|
864
|
+
Filing marital status (1=single, 2=joint, 3=separate,
|
865
|
+
4=household-head, 5=widow(er))
|
866
|
+
c00100: float
|
867
|
+
Adjusted gross income
|
868
|
+
exact: int
|
869
|
+
Whether or not to smooth deduction phase out
|
870
|
+
SeniorDed_c: float
|
871
|
+
Maximum amount of senior deduction per head/spouse aged 65+
|
872
|
+
SeniorDed_ps: list[float]
|
873
|
+
Senior deduction AGI phase-out start level
|
874
|
+
SeniorDed_prt: float
|
875
|
+
Senior deduction phase-out rate
|
876
|
+
auto_loan_interest: float
|
877
|
+
Qualified auto loan interest paid
|
878
|
+
AutoLoanInterestDed_c: float
|
879
|
+
Deduction cap
|
880
|
+
AutoLoanInterestDed_ps: float
|
881
|
+
Deduction phase-out starts above this AGI
|
882
|
+
AutoLoanInterestDed_po_step_size: float
|
883
|
+
Deduction phase-out AGI step size
|
884
|
+
AutoLoanInterestDed_po_rate_per_step: float
|
885
|
+
Deduction phase-out rate per AGI step
|
886
|
+
auto_loan_interest_deduction: float
|
887
|
+
Deduction available to both itemizers and nonitemizers
|
888
|
+
|
889
|
+
Returns
|
890
|
+
-------
|
891
|
+
senior_deduction: float
|
892
|
+
Deduction available to both itemizers and nonitemizers
|
893
|
+
auto_loan_interest_deduction: float
|
894
|
+
Deduction available to both itemizers and nonitemizers
|
895
|
+
"""
|
896
|
+
# calculate senior deduction
|
897
|
+
senior_deduction = 0.
|
898
|
+
if SeniorDed_c > 0.:
|
899
|
+
seniors = 0
|
900
|
+
if age_head >= 65:
|
901
|
+
seniors += 1
|
902
|
+
if MARS == 2 and age_spouse >= 65:
|
903
|
+
seniors += 1
|
904
|
+
if seniors > 0:
|
905
|
+
ded = seniors * SeniorDed_c
|
906
|
+
po_start = SeniorDed_ps[MARS - 1]
|
907
|
+
if c00100 > po_start:
|
908
|
+
excess_agi = c00100 - po_start
|
909
|
+
po_amount = excess_agi * SeniorDed_prt
|
910
|
+
ded = max(0., ded - po_amount)
|
911
|
+
senior_deduction = ded
|
912
|
+
# calculate auto loan interest deduction
|
913
|
+
auto_loan_interest_deduction = 0.
|
914
|
+
if AutoLoanInterestDed_c > 0. and auto_loan_interest > 0.:
|
915
|
+
# cap deduction
|
916
|
+
ded = min(auto_loan_interest, AutoLoanInterestDed_c)
|
917
|
+
po_start = AutoLoanInterestDed_ps[MARS - 1]
|
918
|
+
if c00100 > po_start:
|
919
|
+
# phase out deduction
|
920
|
+
excess_agi = c00100 - po_start
|
921
|
+
po_rate = AutoLoanInterestDed_po_rate_per_step
|
922
|
+
if exact == 1: # exact calculation as on tax forms
|
923
|
+
step_size = AutoLoanInterestDed_po_step_size
|
924
|
+
steps = math.ceil(excess_agi / step_size)
|
925
|
+
po_amount = steps * step_size * po_rate
|
926
|
+
else: # smoothed calculation needed for sensible mtr calculation
|
927
|
+
po_amount = excess_agi * po_rate
|
928
|
+
ded = max(0., ded - po_amount)
|
929
|
+
auto_loan_interest_deduction = ded
|
930
|
+
return (senior_deduction, auto_loan_interest_deduction)
|
931
|
+
|
932
|
+
|
789
933
|
@iterate_jit(nopython=True)
|
790
934
|
def ItemDed(e17500, e18400, e18500, e19200,
|
791
935
|
e19800, e20100, e20400, g20500,
|
792
|
-
MARS, age_head, age_spouse, c00100, c04470, c21040, c21060,
|
793
|
-
c17000, c18300, c19200, c19700, c20500, c20800,
|
936
|
+
MARS, age_head, age_spouse, c00100, c04600, c04470, c21040, c21060,
|
937
|
+
c17000, c18300, c19200, c19700, c20500, c20800, II_brk6,
|
794
938
|
ID_ps, ID_Medical_frt, ID_Medical_frt_add4aged, ID_Medical_hc,
|
795
939
|
ID_Casualty_frt, ID_Casualty_hc, ID_Miscellaneous_frt,
|
796
|
-
ID_Miscellaneous_hc,
|
940
|
+
ID_Miscellaneous_hc, ID_Charity_crt_all, ID_Charity_crt_noncash,
|
797
941
|
ID_prt, ID_crt, ID_c, ID_StateLocalTax_hc, ID_Charity_frt,
|
798
942
|
ID_Charity_hc, ID_InterestPaid_hc, ID_RealEstate_hc,
|
799
943
|
ID_Medical_c, ID_StateLocalTax_c, ID_RealEstate_c,
|
800
944
|
ID_InterestPaid_c, ID_Charity_c, ID_Casualty_c,
|
801
945
|
ID_Miscellaneous_c, ID_AllTaxes_c, ID_AllTaxes_hc,
|
802
|
-
ID_StateLocalTax_crt, ID_RealEstate_crt, ID_Charity_f
|
946
|
+
ID_StateLocalTax_crt, ID_RealEstate_crt, ID_Charity_f,
|
947
|
+
ID_reduction_salt_rate, ID_reduction_other_rate):
|
803
948
|
"""
|
804
949
|
Calculates itemized deductions, Form 1040, Schedule A.
|
805
950
|
|
@@ -830,12 +975,14 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
830
975
|
Age in years of spouse
|
831
976
|
c00100: float
|
832
977
|
Adjusted gross income (AGI)
|
978
|
+
c04600: float
|
979
|
+
Personal exemptions after phase out
|
833
980
|
c04470: float
|
834
|
-
Itemized deductions after
|
981
|
+
Itemized deductions after all limitations (0 for non-itemizers)
|
835
982
|
c21040: float
|
836
|
-
Itemized deductions that are
|
983
|
+
Itemized deductions that are limited under the Pease limitations
|
837
984
|
c21060: float
|
838
|
-
Itemized deductions before
|
985
|
+
Itemized deductions before limitation (0 for non-itemizers)
|
839
986
|
c17000: float
|
840
987
|
Schedule A: medical expenses deducted
|
841
988
|
c18300: float
|
@@ -848,6 +995,8 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
848
995
|
Schedule A: net casualty or theft loss deducted
|
849
996
|
c20800: float
|
850
997
|
Schedule A: net limited miscellaneous deductions deducted
|
998
|
+
II_brk6: list
|
999
|
+
Bottom of top income tax rate bracket
|
851
1000
|
ID_ps: list
|
852
1001
|
Itemized deduction phaseout AGI start (Pease)
|
853
1002
|
ID_Medical_frt: float
|
@@ -866,8 +1015,8 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
866
1015
|
miscellaneous expenses
|
867
1016
|
ID_Miscellaneous_hc: float
|
868
1017
|
Miscellaneous expense deduction haircut
|
869
|
-
|
870
|
-
Ceiling (as decimal fraction of AGI) for
|
1018
|
+
ID_Charity_crt_all: float
|
1019
|
+
Ceiling (as decimal fraction of AGI) for all charitable
|
871
1020
|
contribution deductions
|
872
1021
|
ID_Charity_crt_noncash: float
|
873
1022
|
Ceiling (as decimal fraction of AGI) for noncash charitable
|
@@ -920,6 +1069,10 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
920
1069
|
state, local, and foreign real estate tax deductions
|
921
1070
|
ID_Charity_f: list
|
922
1071
|
Floor on the amount of charity expense deduction allowed (dollars)
|
1072
|
+
ID_reduction_salt_rate: float
|
1073
|
+
OBBBA reduction rate for SALT deductions
|
1074
|
+
ID_reduction_other_rate: float
|
1075
|
+
OBBBA reduction rate for other deductions
|
923
1076
|
|
924
1077
|
Returns
|
925
1078
|
-------
|
@@ -936,12 +1089,13 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
936
1089
|
c20800: float
|
937
1090
|
Schedule A: net limited miscellaneous deductions deducted
|
938
1091
|
c21040: float
|
939
|
-
Itemized deductions that are phased out
|
1092
|
+
Itemized deductions that are phased out under Pease limitation
|
940
1093
|
c21060: float
|
941
|
-
Itemized deductions before
|
1094
|
+
Itemized deductions before any limitation (0 for non-itemizers)
|
942
1095
|
c04470: float
|
943
|
-
Itemized deductions after
|
1096
|
+
Itemized deductions after all limitations (0 for non-itemizers)
|
944
1097
|
"""
|
1098
|
+
# pylint: disable=too-many-statements
|
945
1099
|
posagi = max(c00100, 0.)
|
946
1100
|
# Medical
|
947
1101
|
medical_frt = ID_Medical_frt
|
@@ -966,12 +1120,13 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
966
1120
|
c19200 = e19200 * (1. - ID_InterestPaid_hc)
|
967
1121
|
c19200 = min(c19200, ID_InterestPaid_c[MARS - 1])
|
968
1122
|
# Charity
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
c19700 =
|
1123
|
+
floor = max(ID_Charity_frt * posagi, ID_Charity_f[MARS - 1])
|
1124
|
+
noncash_ded = max(0., e20100 - floor)
|
1125
|
+
charity_ded_noncash = min(ID_Charity_crt_noncash * posagi, noncash_ded)
|
1126
|
+
remaining_floor = max(0., floor - e20100)
|
1127
|
+
charity_ded_cash = max(0., e19800 - remaining_floor)
|
1128
|
+
c19700 = charity_ded_noncash + charity_ded_cash
|
1129
|
+
c19700 = min(c19700, ID_Charity_crt_all * posagi) * (1. - ID_Charity_hc)
|
975
1130
|
c19700 = min(c19700, ID_Charity_c[MARS - 1])
|
976
1131
|
# Casualty
|
977
1132
|
c20500 = (max(0., g20500 - ID_Casualty_frt * posagi) *
|
@@ -984,8 +1139,8 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
984
1139
|
c20800 = min(c20800, ID_Miscellaneous_c[MARS - 1])
|
985
1140
|
# Gross total itemized deductions
|
986
1141
|
c21060 = c17000 + c18300 + c19200 + c19700 + c20500 + c20800
|
987
|
-
#
|
988
|
-
# (no attempt to adjust c04470 components for
|
1142
|
+
# Pease limitation on total itemized deductions
|
1143
|
+
# (no attempt to adjust c04470 components for limitation)
|
989
1144
|
nonlimited = c17000 + c20500
|
990
1145
|
limitstart = ID_ps[MARS - 1]
|
991
1146
|
if c21060 > nonlimited and c00100 > limitstart:
|
@@ -996,8 +1151,24 @@ def ItemDed(e17500, e18400, e18500, e19200,
|
|
996
1151
|
else:
|
997
1152
|
c21040 = 0.
|
998
1153
|
c04470 = c21060
|
1154
|
+
# OBBBA limitation on total itemized deductions
|
1155
|
+
# (no attempt to adjust c04470 components for limitation)
|
1156
|
+
reduction = 0.
|
1157
|
+
if ID_reduction_salt_rate > 0. or ID_reduction_other_rate > 0.:
|
1158
|
+
assert c21040 <= 0.0, "Pease and OBBBA cannot both be in effect"
|
1159
|
+
tincome = max(0., c00100 - c04600)
|
1160
|
+
texcess = max(0., tincome - II_brk6[MARS - 1])
|
1161
|
+
smaller_salt = min(c18300, texcess)
|
1162
|
+
salt_reduction = ID_reduction_salt_rate * smaller_salt
|
1163
|
+
other_deds = max(0, c04470 - c18300)
|
1164
|
+
smaller_other = min(other_deds, texcess)
|
1165
|
+
other_reduction = ID_reduction_other_rate * smaller_other
|
1166
|
+
reduction = salt_reduction + other_reduction
|
1167
|
+
c04470 = max(0., c04470 - reduction)
|
1168
|
+
# Cap total itemized deductions
|
1169
|
+
# (no attempt to adjust c04470 components for limitation)
|
999
1170
|
c04470 = min(c04470, ID_c[MARS - 1])
|
1000
|
-
# Return total itemized deduction amounts and components
|
1171
|
+
# Return total itemized deduction amounts and pre-limitation components
|
1001
1172
|
return (c17000, c18300, c19200, c19700, c20500, c20800,
|
1002
1173
|
c21040, c21060, c04470)
|
1003
1174
|
|
@@ -1053,7 +1224,7 @@ def AdditionalMedicareTax(e00200, MARS,
|
|
1053
1224
|
@iterate_jit(nopython=True)
|
1054
1225
|
def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,
|
1055
1226
|
MARS, MIDR, blind_head, blind_spouse, standard,
|
1056
|
-
STD_allow_charity_ded_nonitemizers, e19800,
|
1227
|
+
STD_allow_charity_ded_nonitemizers, e19800, ID_Charity_crt_all,
|
1057
1228
|
c00100, STD_charity_ded_nonitemizers_max):
|
1058
1229
|
"""
|
1059
1230
|
Calculates standard deduction, including standard deduction for
|
@@ -1091,8 +1262,8 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,
|
|
1091
1262
|
deduction
|
1092
1263
|
e19800: float
|
1093
1264
|
Schedule A: cash charitable contributions
|
1094
|
-
|
1095
|
-
Fraction of AGI cap on
|
1265
|
+
ID_Charity_crt_all: float
|
1266
|
+
Fraction of AGI cap on all charitable deductions
|
1096
1267
|
c00100: float
|
1097
1268
|
Federal AGI
|
1098
1269
|
STD_charity_ded_nonitemizers_max: float
|
@@ -1126,18 +1297,21 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,
|
|
1126
1297
|
standard = 0.
|
1127
1298
|
# calculate CARES cash charity deduction for nonitemizers
|
1128
1299
|
if STD_allow_charity_ded_nonitemizers:
|
1129
|
-
capped_ded = min(e19800,
|
1300
|
+
capped_ded = min(e19800, ID_Charity_crt_all * c00100)
|
1130
1301
|
standard += min(capped_ded, STD_charity_ded_nonitemizers_max[MARS - 1])
|
1131
1302
|
return standard
|
1132
1303
|
|
1133
1304
|
|
1134
1305
|
@iterate_jit(nopython=True)
|
1135
1306
|
def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
1136
|
-
e02100, e27200, e00650, c01000,
|
1137
|
-
|
1307
|
+
e02100, e27200, e00650, c01000,
|
1308
|
+
senior_deduction, auto_loan_interest_deduction,
|
1309
|
+
PT_SSTB_income, PT_binc_w2_wages, PT_ubia_property,
|
1310
|
+
PT_qbid_rt, PT_qbid_limited,
|
1138
1311
|
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
|
1139
|
-
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt,
|
1140
|
-
PT_qbid_ps, PT_qbid_prt,
|
1312
|
+
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt,
|
1313
|
+
PT_qbid_ps, PT_qbid_prt, PT_qbid_min_ded, PT_qbid_min_qbi,
|
1314
|
+
c04800, qbided):
|
1141
1315
|
"""
|
1142
1316
|
Calculates taxable income, c04800, and
|
1143
1317
|
qualified business income deduction, qbided.
|
@@ -1169,6 +1343,10 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
|
1169
1343
|
Qualified dividends included in ordinary dividends
|
1170
1344
|
c01000: float
|
1171
1345
|
Limitation on capital losses
|
1346
|
+
senior_deduction: float
|
1347
|
+
Deduction for elderly head/spouse
|
1348
|
+
auto_loan_interest_deduction: float
|
1349
|
+
Deduction for qualified auto loan interest paid
|
1172
1350
|
PT_SSTB_income: int
|
1173
1351
|
Value of one implies business income is from a specified service
|
1174
1352
|
trade or business (SSTB)
|
@@ -1182,6 +1360,8 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
|
1182
1360
|
pass-through business
|
1183
1361
|
PT_qbid_rt: float
|
1184
1362
|
Pass-through qualified business income deduction rate
|
1363
|
+
PT_qbid_limited: bool
|
1364
|
+
Whether or not TCJA QBID limits are active
|
1185
1365
|
PT_qbid_taxinc_thd: list
|
1186
1366
|
Lower threshold of pre-QBID taxable income
|
1187
1367
|
PT_qbid_taxinc_gap: list
|
@@ -1192,12 +1372,16 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
|
1192
1372
|
Alternative QBID cap rate on pass-through business W-2 wages paid
|
1193
1373
|
PT_qbid_alt_property_rt: float
|
1194
1374
|
Alternative QBID cap rate on pass-through business property owned
|
1195
|
-
c04800: float
|
1196
|
-
Regular taxable income
|
1197
1375
|
PT_qbid_ps: list
|
1198
1376
|
QBID phaseout taxable income start
|
1199
1377
|
PT_qbid_prt: float
|
1200
1378
|
QBID phaseout rate
|
1379
|
+
PT_qbid_min_ded: float
|
1380
|
+
Minimum QBID amount
|
1381
|
+
PT_qbid_min_qbi: float
|
1382
|
+
Minimum QBI necessary to get QBID no less than PT_qbid_min_ded
|
1383
|
+
c04800: float
|
1384
|
+
Regular taxable income
|
1201
1385
|
qbided: float
|
1202
1386
|
Qualified Business Income (QBI) deduction
|
1203
1387
|
|
@@ -1208,13 +1392,14 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
|
1208
1392
|
qbided: float
|
1209
1393
|
Qualified Business Income (QBI) deduction
|
1210
1394
|
"""
|
1211
|
-
# calculate taxable income before qualified business income deduction
|
1212
|
-
|
1395
|
+
# calculate taxable income before qualified business income deduction,
|
1396
|
+
# which is assumed to be stacked last in the list of deductions
|
1397
|
+
odeds = senior_deduction + auto_loan_interest_deduction
|
1398
|
+
pre_qbid_taxinc = max(0., c00100 - max(c04470, standard) - c04600 - odeds)
|
1213
1399
|
# calculate qualified business income deduction
|
1214
|
-
qbided = 0.
|
1215
1400
|
qbinc = max(0., e00900 - c03260 + e26270 + e02100 + e27200)
|
1216
|
-
|
1217
|
-
|
1401
|
+
qbid_before_limits = qbinc * PT_qbid_rt
|
1402
|
+
if PT_qbid_limited:
|
1218
1403
|
lower_thd = PT_qbid_taxinc_thd[MARS - 1]
|
1219
1404
|
if pre_qbid_taxinc <= lower_thd:
|
1220
1405
|
qbided = qbid_before_limits
|
@@ -1244,18 +1429,22 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
|
|
1244
1429
|
prt = (pre_qbid_taxinc - lower_thd) / pre_qbid_taxinc_gap
|
1245
1430
|
adj = prt * (qbid_adjusted - cap_adjusted)
|
1246
1431
|
qbided = qbid_adjusted - adj
|
1247
|
-
|
1248
1432
|
# apply taxinc cap (assuming cap rate is equal to PT_qbid_rt)
|
1249
|
-
net_cg
|
1433
|
+
# net_cg is defined on line 34 of 2018 Pub 535 Worksheet 12-A
|
1434
|
+
net_cg = e00650 + c01000
|
1250
1435
|
taxinc_cap = PT_qbid_rt * max(0., pre_qbid_taxinc - net_cg)
|
1251
1436
|
qbided = min(qbided, taxinc_cap)
|
1252
|
-
|
1253
1437
|
# apply qbid phaseout
|
1254
1438
|
if qbided > 0. and pre_qbid_taxinc > PT_qbid_ps[MARS - 1]:
|
1255
1439
|
excess = pre_qbid_taxinc - PT_qbid_ps[MARS - 1]
|
1256
1440
|
qbided = max(0., qbided - PT_qbid_prt * excess)
|
1441
|
+
else: # if PT_qbid_limited is false
|
1442
|
+
qbided = qbid_before_limits
|
1443
|
+
# apply minimum QBID logic
|
1444
|
+
if qbinc >= PT_qbid_min_qbi and qbided < PT_qbid_min_ded:
|
1445
|
+
qbided = PT_qbid_min_ded
|
1257
1446
|
|
1258
|
-
# calculate taxable income after
|
1447
|
+
# calculate taxable income after qbided
|
1259
1448
|
c04800 = max(0., pre_qbid_taxinc - qbided)
|
1260
1449
|
return (c04800, qbided)
|
1261
1450
|
|
@@ -1267,75 +1456,85 @@ def SchXYZ(taxable_income, MARS,
|
|
1267
1456
|
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5,
|
1268
1457
|
II_brk6, II_brk7):
|
1269
1458
|
"""
|
1270
|
-
|
1459
|
+
Taxes function returns tax amount given the progressive tax rate
|
1460
|
+
schedule specified by the II_rt? and (upper) II_brk? parameters and
|
1461
|
+
given taxable income and filing status (MARS).
|
1271
1462
|
|
1272
1463
|
Parameters
|
1273
1464
|
----------
|
1274
1465
|
taxable_income: float
|
1275
|
-
|
1466
|
+
Regular taxable income
|
1276
1467
|
MARS: int
|
1277
1468
|
Filing (marital) status. (1=single, 2=joint, 3=separate,
|
1278
1469
|
4=household-head, 5=widow(er))
|
1279
|
-
e00900: float
|
1280
|
-
Schedule C business net profit/loss for filing unit
|
1281
|
-
e26270: float
|
1282
|
-
Schedule E: combined partnership and S-corporation net income/loss
|
1283
|
-
e02000: float
|
1284
|
-
Schedule E total rental, royalty, parternship, S-corporation,
|
1285
|
-
etc, income/loss
|
1286
|
-
e00200: float
|
1287
|
-
Wages, salaries, and tips for filing unit net of pension contributions
|
1288
1470
|
II_rt1: float
|
1289
|
-
Personal income (regular/non-AMT
|
1471
|
+
Personal income (regular/non-AMT) tax rate 1
|
1290
1472
|
II_rt2: float
|
1291
|
-
Personal income (regular/non-AMT
|
1473
|
+
Personal income (regular/non-AMT) tax rate 2
|
1292
1474
|
II_rt3: float
|
1293
|
-
Personal income (regular/non-AMT
|
1475
|
+
Personal income (regular/non-AMT) tax rate 3
|
1294
1476
|
II_rt4: float
|
1295
|
-
Personal income (regular/non-AMT
|
1477
|
+
Personal income (regular/non-AMT) tax rate 4
|
1296
1478
|
II_rt5: float
|
1297
|
-
Personal income (regular/non-AMT
|
1479
|
+
Personal income (regular/non-AMT) tax rate 5
|
1298
1480
|
II_rt6: float
|
1299
|
-
Personal income (regular/non-AMT
|
1481
|
+
Personal income (regular/non-AMT) tax rate 6
|
1300
1482
|
II_rt7: float
|
1301
|
-
Personal income (regular/non-AMT
|
1483
|
+
Personal income (regular/non-AMT) tax rate 7
|
1302
1484
|
II_rt8: float
|
1303
|
-
Personal income (regular/non-AMT
|
1485
|
+
Personal income (regular/non-AMT) tax rate 8
|
1304
1486
|
II_brk1: list
|
1305
|
-
Personal income (regular/non-AMT
|
1306
|
-
tax bracket (upper threshold) 1
|
1487
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 1
|
1307
1488
|
II_brk2: list
|
1308
|
-
Personal income (regular/non-AMT
|
1309
|
-
tax bracket (upper threshold) 2
|
1489
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 2
|
1310
1490
|
II_brk3: list
|
1311
|
-
Personal income (regular/non-AMT
|
1312
|
-
tax bracket (upper threshold) 3
|
1491
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 3
|
1313
1492
|
II_brk4: list
|
1314
|
-
Personal income (regular/non-AMT
|
1315
|
-
tax bracket (upper threshold) 4
|
1493
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 4
|
1316
1494
|
II_brk5: list
|
1317
|
-
Personal income (regular/non-AMT
|
1318
|
-
tax bracket (upper threshold) 5
|
1495
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 5
|
1319
1496
|
II_brk6: list
|
1320
|
-
Personal income (regular/non-AMT
|
1321
|
-
tax bracket (upper threshold) 6
|
1497
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 6
|
1322
1498
|
II_brk7: list
|
1323
|
-
Personal income (regular/non-AMT
|
1324
|
-
tax bracket (upper threshold) 7
|
1499
|
+
Personal income (regular/non-AMT) tax bracket (upper threshold) 7
|
1325
1500
|
|
1326
1501
|
Returns
|
1327
1502
|
-------
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1503
|
+
Regular individual income tax liability on all taxable income
|
1504
|
+
"""
|
1505
|
+
# pylint: disable=too-many-return-statements
|
1506
|
+
if taxable_income <= 0.:
|
1507
|
+
return 0.
|
1508
|
+
tax = 0.
|
1509
|
+
brk0 = 0.
|
1510
|
+
brk1 = II_brk1[MARS - 1]
|
1511
|
+
if taxable_income <= brk1:
|
1512
|
+
return tax + II_rt1 * (taxable_income - brk0)
|
1513
|
+
tax = tax + II_rt1 * (brk1 - brk0)
|
1514
|
+
brk2 = II_brk2[MARS - 1]
|
1515
|
+
if taxable_income <= brk2:
|
1516
|
+
return tax + II_rt2 * (taxable_income - brk1)
|
1517
|
+
tax = tax + II_rt2 * (brk2 - brk1)
|
1518
|
+
brk3 = II_brk3[MARS - 1]
|
1519
|
+
if taxable_income <= brk3:
|
1520
|
+
return tax + II_rt3 * (taxable_income - brk2)
|
1521
|
+
tax = tax + II_rt3 * (brk3 - brk2)
|
1522
|
+
brk4 = II_brk4[MARS - 1]
|
1523
|
+
if taxable_income <= brk4:
|
1524
|
+
return tax + II_rt4 * (taxable_income - brk3)
|
1525
|
+
tax = tax + II_rt4 * (brk4 - brk3)
|
1526
|
+
brk5 = II_brk5[MARS - 1]
|
1527
|
+
if taxable_income <= brk5:
|
1528
|
+
return tax + II_rt5 * (taxable_income - brk4)
|
1529
|
+
tax = tax + II_rt5 * (brk5 - brk4)
|
1530
|
+
brk6 = II_brk6[MARS - 1]
|
1531
|
+
if taxable_income <= brk6:
|
1532
|
+
return tax + II_rt6 * (taxable_income - brk5)
|
1533
|
+
tax = tax + II_rt6 * (brk6 - brk5)
|
1534
|
+
brk7 = II_brk7[MARS - 1]
|
1535
|
+
if taxable_income <= brk7:
|
1536
|
+
return tax + II_rt7 * (taxable_income - brk6)
|
1537
|
+
return tax + II_rt8 * (taxable_income - brk7)
|
1339
1538
|
|
1340
1539
|
|
1341
1540
|
@iterate_jit(nopython=True)
|
@@ -1355,41 +1554,41 @@ def SchXYZTax(c04800, MARS,
|
|
1355
1554
|
Filing (marital) status. (1=single, 2=joint, 3=separate,
|
1356
1555
|
4=household-head, 5=widow(er))
|
1357
1556
|
II_rt1: float
|
1358
|
-
Personal income (regular/non-AMT
|
1557
|
+
Personal income (regular/non-AMT) tax rate 1
|
1359
1558
|
II_rt2: float
|
1360
|
-
Personal income (regular/non-AMT
|
1559
|
+
Personal income (regular/non-AMT) tax rate 2
|
1361
1560
|
II_rt3: float
|
1362
|
-
Personal income (regular/non-AMT
|
1561
|
+
Personal income (regular/non-AMT) tax rate 3
|
1363
1562
|
II_rt4: float
|
1364
|
-
Personal income (regular/non-AMT
|
1563
|
+
Personal income (regular/non-AMT) tax rate 4
|
1365
1564
|
II_rt5: float
|
1366
|
-
Personal income (regular/non-AMT
|
1565
|
+
Personal income (regular/non-AMT) tax rate 5
|
1367
1566
|
II_rt6: float
|
1368
|
-
Personal income (regular/non-AMT
|
1567
|
+
Personal income (regular/non-AMT) tax rate 6
|
1369
1568
|
II_rt7: float
|
1370
|
-
Personal income (regular/non-AMT
|
1569
|
+
Personal income (regular/non-AMT) tax rate 7
|
1371
1570
|
II_rt8: float
|
1372
|
-
Personal income (regular/non-AMT
|
1571
|
+
Personal income (regular/non-AMT) tax rate 8
|
1373
1572
|
II_brk1: list
|
1374
|
-
Personal income (regular/non-AMT
|
1573
|
+
Personal income (regular/non-AMT)
|
1375
1574
|
tax bracket (upper threshold) 1
|
1376
1575
|
II_brk2: list
|
1377
|
-
Personal income (regular/non-AMT
|
1576
|
+
Personal income (regular/non-AMT)
|
1378
1577
|
tax bracket (upper threshold) 2
|
1379
1578
|
II_brk3: list
|
1380
|
-
Personal income (regular/non-AMT
|
1579
|
+
Personal income (regular/non-AMT)
|
1381
1580
|
tax bracket (upper threshold) 3
|
1382
1581
|
II_brk4: list
|
1383
|
-
Personal income (regular/non-AMT
|
1582
|
+
Personal income (regular/non-AMT)
|
1384
1583
|
tax bracket (upper threshold) 4
|
1385
1584
|
II_brk5: list
|
1386
|
-
Personal income (regular/non-AMT
|
1585
|
+
Personal income (regular/non-AMT)
|
1387
1586
|
tax bracket (upper threshold) 5
|
1388
1587
|
II_brk6: list
|
1389
|
-
Personal income (regular/non-AMT
|
1588
|
+
Personal income (regular/non-AMT)
|
1390
1589
|
tax bracket (upper threshold) 6
|
1391
1590
|
II_brk7: list
|
1392
|
-
Personal income (regular/non-AMT
|
1591
|
+
Personal income (regular/non-AMT)
|
1393
1592
|
tax bracket (upper threshold) 7
|
1394
1593
|
c05200: float
|
1395
1594
|
Tax amount from Schedule X,Y,Z tables
|
@@ -1399,11 +1598,11 @@ def SchXYZTax(c04800, MARS,
|
|
1399
1598
|
c05200: float
|
1400
1599
|
Tax amount from Schedule X, Y, Z tables
|
1401
1600
|
"""
|
1402
|
-
c05200 = SchXYZ(
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1601
|
+
c05200 = SchXYZ(
|
1602
|
+
c04800, MARS,
|
1603
|
+
II_rt1, II_rt2, II_rt3, II_rt4, II_rt5, II_rt6, II_rt7, II_rt8,
|
1604
|
+
II_brk1, II_brk2, II_brk3, II_brk4, II_brk5, II_brk6, II_brk7
|
1605
|
+
)
|
1407
1606
|
return c05200
|
1408
1607
|
|
1409
1608
|
|
@@ -1434,8 +1633,6 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
|
|
1434
1633
|
Capital gains distributions not reported on Schedule D
|
1435
1634
|
e58990: float
|
1436
1635
|
Investment income elected amount from Form 4952
|
1437
|
-
e00200: float
|
1438
|
-
Wages, salaries, and tips for filing unit net of pension contributions
|
1439
1636
|
e24515: float
|
1440
1637
|
Schedule D: un-recaptured section 1250 Gain
|
1441
1638
|
e24518: float
|
@@ -1447,49 +1644,42 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
|
|
1447
1644
|
Regular taxable income
|
1448
1645
|
c05200: float
|
1449
1646
|
Tax amount from Schedule X,Y,Z tables
|
1450
|
-
e00900: float
|
1451
|
-
Schedule C business net profit/loss for filing unit
|
1452
|
-
e26270: float
|
1453
|
-
Schedule E: combined partnership and S-corporation net income/loss
|
1454
|
-
e02000: float
|
1455
|
-
Schedule E total rental, royalty, partnership, S-corporation,
|
1456
|
-
etc, income/loss
|
1457
1647
|
II_rt1: float
|
1458
|
-
Personal income (regular/non-AMT
|
1648
|
+
Personal income (regular/non-AMT) tax rate 1
|
1459
1649
|
II_rt2: float
|
1460
|
-
Personal income (regular/non-AMT
|
1650
|
+
Personal income (regular/non-AMT) tax rate 2
|
1461
1651
|
II_rt3: float
|
1462
|
-
Personal income (regular/non-AMT
|
1652
|
+
Personal income (regular/non-AMT) tax rate 3
|
1463
1653
|
II_rt4: float
|
1464
|
-
Personal income (regular/non-AMT
|
1654
|
+
Personal income (regular/non-AMT) tax rate 4
|
1465
1655
|
II_rt5: float
|
1466
|
-
Personal income (regular/non-AMT
|
1656
|
+
Personal income (regular/non-AMT) tax rate 5
|
1467
1657
|
II_rt6: float
|
1468
|
-
Personal income (regular/non-AMT
|
1658
|
+
Personal income (regular/non-AMT) tax rate 6
|
1469
1659
|
II_rt7: float
|
1470
|
-
Personal income (regular/non-AMT
|
1660
|
+
Personal income (regular/non-AMT) tax rate 7
|
1471
1661
|
II_rt8: float
|
1472
|
-
Personal income (regular/non-AMT
|
1662
|
+
Personal income (regular/non-AMT) tax rate 8
|
1473
1663
|
II_brk1: list
|
1474
|
-
Personal income (regular/non-AMT
|
1664
|
+
Personal income (regular/non-AMT)
|
1475
1665
|
tax bracket (upper threshold) 1
|
1476
1666
|
II_brk2: list
|
1477
|
-
Personal income (regular/non-AMT
|
1667
|
+
Personal income (regular/non-AMT)
|
1478
1668
|
tax bracket (upper threshold) 2
|
1479
1669
|
II_brk3: list
|
1480
|
-
Personal income (regular/non-AMT
|
1670
|
+
Personal income (regular/non-AMT)
|
1481
1671
|
tax bracket (upper threshold) 3
|
1482
1672
|
II_brk4: list
|
1483
|
-
Personal income (regular/non-AMT
|
1673
|
+
Personal income (regular/non-AMT)
|
1484
1674
|
tax bracket (upper threshold) 4
|
1485
1675
|
II_brk5: list
|
1486
|
-
Personal income (regular/non-AMT
|
1676
|
+
Personal income (regular/non-AMT)
|
1487
1677
|
tax bracket (upper threshold) 5
|
1488
1678
|
II_brk6: list
|
1489
|
-
Personal income (regular/non-AMT
|
1679
|
+
Personal income (regular/non-AMT)
|
1490
1680
|
tax bracket (upper threshold) 6
|
1491
1681
|
II_brk7: list
|
1492
|
-
Personal income (regular/non-AMT
|
1682
|
+
Personal income (regular/non-AMT)
|
1493
1683
|
tax bracket (upper threshold) 7
|
1494
1684
|
CG_nodiff: bool
|
1495
1685
|
Long term capital gains and qualified dividends taxed no differently
|
@@ -1705,7 +1895,7 @@ def AMT(e07300, dwks13, standard, f6251, c00100, c18300, taxbc,
|
|
1705
1895
|
taxbc: float
|
1706
1896
|
Regular tax on regular taxable income before credits
|
1707
1897
|
c04470: float
|
1708
|
-
Itemized deductions after phase-out (zero for non
|
1898
|
+
Itemized deductions after phase-out (zero for non-itemizers)
|
1709
1899
|
c17000: float
|
1710
1900
|
Schedule A: Medical expenses deducted
|
1711
1901
|
c20800: float
|
@@ -1918,9 +2108,10 @@ def NetInvIncTax(e00300, e00600, e02000, e26270, c01000,
|
|
1918
2108
|
|
1919
2109
|
|
1920
2110
|
@iterate_jit(nopython=True)
|
1921
|
-
def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
|
1922
|
-
|
1923
|
-
|
2111
|
+
def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800, exact, c00100,
|
2112
|
+
CDCC_ps1, CDCC_ps2, CDCC_po1_rate_max, CDCC_po1_rate_min,
|
2113
|
+
CDCC_po2_rate_min, CDCC_po1_step_size, CDCC_po2_step_size,
|
2114
|
+
CDCC_po_rate_per_step, CDCC_refundable,
|
1924
2115
|
c05800, e07300, c32800, c07180, CDCC_refund):
|
1925
2116
|
"""
|
1926
2117
|
Calculates Form 2441 child and dependent care expense credit, c07180.
|
@@ -1944,16 +2135,20 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
|
|
1944
2135
|
Whether or not to do rounding of phaseout fraction
|
1945
2136
|
c00100: float
|
1946
2137
|
Adjusted Gross Income (AGI)
|
1947
|
-
|
2138
|
+
CDCC_ps1: float
|
1948
2139
|
Child/dependent care credit first phaseout start
|
1949
|
-
CDCC_ps2: float
|
2140
|
+
CDCC_ps2: list[float]
|
1950
2141
|
Child/dependent care credit second phaseout start
|
1951
|
-
|
1952
|
-
Child/dependent care credit phaseout rate
|
1953
|
-
|
1954
|
-
Child/dependent care credit phaseout rate
|
1955
|
-
|
1956
|
-
Child/dependent care credit phaseout
|
2142
|
+
CDCC_po1_rate_max: float
|
2143
|
+
Child/dependent care credit first phaseout rate maximum
|
2144
|
+
CDCC_po1_rate_min: float
|
2145
|
+
Child/dependent care credit first phaseout rate minimum
|
2146
|
+
CDCC_po2_rate_min: float
|
2147
|
+
Child/dependent care credit second phaseout rate minimum
|
2148
|
+
CDCC_po1_step_size: float
|
2149
|
+
Child/dependent care credit first phaseout AGI step size
|
2150
|
+
CDCC_po2_step_size: float
|
2151
|
+
Child/dependent care credit second phaseout AGI step size
|
1957
2152
|
CDCC_po_rate_per_step: float
|
1958
2153
|
Child/dependent care credit phaseout rate per step size
|
1959
2154
|
CDCC_refundable: bool
|
@@ -1987,21 +2182,32 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
|
|
1987
2182
|
c32890 = earned_p
|
1988
2183
|
c33000 = max(0., min(c32800, c32880, c32890))
|
1989
2184
|
# credit rate is limited at high AGI
|
1990
|
-
|
1991
|
-
|
1992
|
-
if
|
1993
|
-
|
1994
|
-
|
1995
|
-
steps = steps_fractional
|
1996
|
-
crate = max(CDCC_frt, CDCC_crt - steps * CDCC_po_rate_per_step)
|
1997
|
-
# ... second phase-down from CDCC_frt to zero
|
1998
|
-
if c00100 > CDCC_ps2:
|
1999
|
-
steps_fractional = (c00100 - CDCC_ps2) / CDCC_po_step_size
|
2185
|
+
crate = CDCC_po1_rate_max
|
2186
|
+
ps1 = CDCC_ps1
|
2187
|
+
if c00100 > ps1:
|
2188
|
+
# ... first phase-down from CDCC_po1_rate_max to CDCC_po1_rate_min
|
2189
|
+
steps_fractional = (c00100 - ps1) / CDCC_po1_step_size
|
2000
2190
|
if exact == 1: # exact calculation as on tax forms
|
2001
2191
|
steps = math.ceil(steps_fractional)
|
2002
2192
|
else:
|
2003
2193
|
steps = steps_fractional
|
2004
|
-
crate = max(
|
2194
|
+
crate = max(
|
2195
|
+
CDCC_po1_rate_min,
|
2196
|
+
CDCC_po1_rate_max - steps * CDCC_po_rate_per_step
|
2197
|
+
)
|
2198
|
+
# ... second phase-down from CDCC_po1_rate_min to CDCC_po2_rate_min
|
2199
|
+
ps2 = CDCC_ps2[MARS - 1]
|
2200
|
+
assert ps2 >= ps1, "CDCC_ps2 must be no less than CDCC_ps1"
|
2201
|
+
if c00100 > ps2:
|
2202
|
+
steps_fractional = (c00100 - ps2) / CDCC_po2_step_size[MARS - 1]
|
2203
|
+
if exact == 1: # exact calculation as on tax forms
|
2204
|
+
steps = math.ceil(steps_fractional)
|
2205
|
+
else:
|
2206
|
+
steps = steps_fractional
|
2207
|
+
crate = max(
|
2208
|
+
CDCC_po2_rate_min,
|
2209
|
+
CDCC_po1_rate_min - steps * CDCC_po_rate_per_step
|
2210
|
+
)
|
2005
2211
|
c33200 = c33000 * crate
|
2006
2212
|
# credit is limited by tax liability if not refundable
|
2007
2213
|
if CDCC_refundable:
|
@@ -3209,124 +3415,6 @@ def IITAX(c59660, c11070, c10960, personal_refundable_credit, ctc_new, rptc,
|
|
3209
3415
|
iitax, combined)
|
3210
3416
|
|
3211
3417
|
|
3212
|
-
@JIT(nopython=True)
|
3213
|
-
def Taxes(income, MARS, tbrk_base,
|
3214
|
-
rate1, rate2, rate3, rate4, rate5, rate6, rate7, rate8,
|
3215
|
-
tbrk1, tbrk2, tbrk3, tbrk4, tbrk5, tbrk6, tbrk7):
|
3216
|
-
"""
|
3217
|
-
Taxes function returns tax amount given the progressive tax rate
|
3218
|
-
schedule specified by the rate* and (upper) tbrk* parameters and
|
3219
|
-
given income, filing status (MARS), and tax bracket base (tbrk_base).
|
3220
|
-
|
3221
|
-
Parameters
|
3222
|
-
----------
|
3223
|
-
income: float
|
3224
|
-
Taxable income
|
3225
|
-
MARS: int
|
3226
|
-
Filing (marital) status. (1=single, 2=joint, 3=separate,
|
3227
|
-
4=household-head, 5=widow(er))
|
3228
|
-
tbrk_base: float
|
3229
|
-
Amount of income used to determine the braket the filer is in
|
3230
|
-
rate1: list
|
3231
|
-
Income tax rate 1
|
3232
|
-
rate2: list
|
3233
|
-
Income tax rate 2
|
3234
|
-
rate3: list
|
3235
|
-
Income tax rate 3
|
3236
|
-
rate4: list
|
3237
|
-
Income tax rate 4
|
3238
|
-
rate5: list
|
3239
|
-
Income tax rate 5
|
3240
|
-
rate6: list
|
3241
|
-
Income tax rate 6
|
3242
|
-
rate7: list
|
3243
|
-
Income tax rate 7
|
3244
|
-
rate8: list
|
3245
|
-
Income tax rate 8
|
3246
|
-
tbrk1: list
|
3247
|
-
Income tax bracket (upper threshold) 1
|
3248
|
-
tbrk2: list
|
3249
|
-
Income tax bracket (upper threshold) 2
|
3250
|
-
tbrk3: list
|
3251
|
-
Income tax bracket (upper threshold) 3
|
3252
|
-
tbrk4: list
|
3253
|
-
Income tax bracket (upper threshold) 4
|
3254
|
-
tbrk5: list
|
3255
|
-
Income tax bracket (upper threshold) 5
|
3256
|
-
tbrk6: list
|
3257
|
-
Income tax bracket (upper threshold) 6
|
3258
|
-
tbrk7: list
|
3259
|
-
Income tax bracket (upper threshold) 7
|
3260
|
-
|
3261
|
-
Returns
|
3262
|
-
-------
|
3263
|
-
None
|
3264
|
-
"""
|
3265
|
-
if tbrk_base > 0.:
|
3266
|
-
brk1 = max(tbrk1[MARS - 1] - tbrk_base, 0.)
|
3267
|
-
brk2 = max(tbrk2[MARS - 1] - tbrk_base, 0.)
|
3268
|
-
brk3 = max(tbrk3[MARS - 1] - tbrk_base, 0.)
|
3269
|
-
brk4 = max(tbrk4[MARS - 1] - tbrk_base, 0.)
|
3270
|
-
brk5 = max(tbrk5[MARS - 1] - tbrk_base, 0.)
|
3271
|
-
brk6 = max(tbrk6[MARS - 1] - tbrk_base, 0.)
|
3272
|
-
brk7 = max(tbrk7[MARS - 1] - tbrk_base, 0.)
|
3273
|
-
else:
|
3274
|
-
brk1 = tbrk1[MARS - 1]
|
3275
|
-
brk2 = tbrk2[MARS - 1]
|
3276
|
-
brk3 = tbrk3[MARS - 1]
|
3277
|
-
brk4 = tbrk4[MARS - 1]
|
3278
|
-
brk5 = tbrk5[MARS - 1]
|
3279
|
-
brk6 = tbrk6[MARS - 1]
|
3280
|
-
brk7 = tbrk7[MARS - 1]
|
3281
|
-
return (rate1 * min(income, brk1) +
|
3282
|
-
rate2 * min(brk2 - brk1, max(0., income - brk1)) +
|
3283
|
-
rate3 * min(brk3 - brk2, max(0., income - brk2)) +
|
3284
|
-
rate4 * min(brk4 - brk3, max(0., income - brk3)) +
|
3285
|
-
rate5 * min(brk5 - brk4, max(0., income - brk4)) +
|
3286
|
-
rate6 * min(brk6 - brk5, max(0., income - brk5)) +
|
3287
|
-
rate7 * min(brk7 - brk6, max(0., income - brk6)) +
|
3288
|
-
rate8 * max(0., income - brk7))
|
3289
|
-
|
3290
|
-
|
3291
|
-
def ComputeBenefit(calc, ID_switch):
|
3292
|
-
"""
|
3293
|
-
Calculates the value of the benefits accrued from itemizing.
|
3294
|
-
|
3295
|
-
Parameters
|
3296
|
-
----------
|
3297
|
-
calc: Calculator object
|
3298
|
-
calc represents the reform while self represents the baseline
|
3299
|
-
ID_switch: list
|
3300
|
-
Deductions subject to the surtax on itemized deduction benefits
|
3301
|
-
|
3302
|
-
Returns
|
3303
|
-
-------
|
3304
|
-
benefit: float
|
3305
|
-
Imputed benefits from itemizing deductions
|
3306
|
-
"""
|
3307
|
-
# compute income tax liability with no itemized deductions allowed for
|
3308
|
-
# the types of itemized deductions covered under the BenefitSurtax
|
3309
|
-
no_ID_calc = copy.deepcopy(calc)
|
3310
|
-
if ID_switch[0]:
|
3311
|
-
no_ID_calc.policy_param('ID_Medical_hc', [1.])
|
3312
|
-
if ID_switch[1]:
|
3313
|
-
no_ID_calc.policy_param('ID_StateLocalTax_hc', [1.])
|
3314
|
-
if ID_switch[2]:
|
3315
|
-
no_ID_calc.policy_param('ID_RealEstate_hc', [1.])
|
3316
|
-
if ID_switch[3]:
|
3317
|
-
no_ID_calc.policy_param('ID_Casualty_hc', [1.])
|
3318
|
-
if ID_switch[4]:
|
3319
|
-
no_ID_calc.policy_param('ID_Miscellaneous_hc', [1.])
|
3320
|
-
if ID_switch[5]:
|
3321
|
-
no_ID_calc.policy_param('ID_InterestPaid_hc', [1.])
|
3322
|
-
if ID_switch[6]:
|
3323
|
-
no_ID_calc.policy_param('ID_Charity_hc', [1.])
|
3324
|
-
no_ID_calc._calc_one_year() # pylint: disable=protected-access
|
3325
|
-
diff_iitax = no_ID_calc.array('iitax') - calc.array('iitax')
|
3326
|
-
benefit = np.where(diff_iitax > 0., diff_iitax, 0.)
|
3327
|
-
return benefit
|
3328
|
-
|
3329
|
-
|
3330
3418
|
@iterate_jit(nopython=True)
|
3331
3419
|
def FairShareTax(c00100, MARS, ptax_was, setax, ptax_amc,
|
3332
3420
|
FST_AGI_trt, FST_AGI_thd_lo, FST_AGI_thd_hi,
|