Skip to content

Commit b675967

Browse files
authored
Merge pull request #2930 from martinholmer/senior-ded
Add new SeniorDed policy parameters and associated tax-calculation logic
2 parents 7530420 + 5829fdd commit b675967

File tree

9 files changed

+202
-49
lines changed

9 files changed

+202
-49
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
with open("README.md", "r", encoding="utf-8") as f:
88
longdesc = f.read()
99

10-
VERSION = "5.0.4"
10+
VERSION = "5.0.5"
1111

1212
config = {
1313
"description": "Tax-Calculator",

taxcalc.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.4
22
Name: taxcalc
3-
Version: 5.0.4
3+
Version: 5.0.5
44
Summary: Tax-Calculator
55
Home-page: https://github.com/PSLmodels/Tax-Calculator
66
Download-URL: https://github.com/PSLmodels/Tax-Calculator

taxcalc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
from taxcalc.utils import *
1515
from taxcalc.cli import *
1616

17-
__version__ = '5.0.4'
17+
__version__ = '5.0.5'
1818
__min_python3_version__ = 10
1919
__max_python3_version__ = 12

taxcalc/calcfunctions.py

Lines changed: 59 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -842,26 +842,39 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
842842

843843

844844
@iterate_jit(nopython=True)
845-
def AutoLoanInterestDed(auto_loan_interest, MARS, c00100, exact,
846-
AutoLoanInterestDed_c,
847-
AutoLoanInterestDed_ps,
848-
AutoLoanInterestDed_po_step_size,
849-
AutoLoanInterestDed_po_rate_per_step,
850-
auto_loan_interest_deduction):
851-
"""
852-
Calculates below-the-line deduction on qualified auto loan interest paid.
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.
853856
854857
Parameters
855858
----------
856-
auto_loan_interest: float
857-
Qualified auto loan interest paid
859+
age_head: int
860+
Age of tax unit head
861+
age_head: int
862+
Age of tax unit spouse
858863
MARS: int
859864
Filing marital status (1=single, 2=joint, 3=separate,
860865
4=household-head, 5=widow(er))
861866
c00100: float
862867
Adjusted gross income
863868
exact: int
864-
Whether or not to smooth the deduction phase out
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
865878
AutoLoanInterestDed_c: float
866879
Deduction cap
867880
AutoLoanInterestDed_ps: float
@@ -875,9 +888,28 @@ def AutoLoanInterestDed(auto_loan_interest, MARS, c00100, exact,
875888
876889
Returns
877890
-------
891+
senior_deduction: float
892+
Deduction available to both itemizers and nonitemizers
878893
auto_loan_interest_deduction: float
879894
Deduction available to both itemizers and nonitemizers
880895
"""
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
881913
auto_loan_interest_deduction = 0.
882914
if AutoLoanInterestDed_c > 0. and auto_loan_interest > 0.:
883915
# cap deduction
@@ -895,7 +927,7 @@ def AutoLoanInterestDed(auto_loan_interest, MARS, c00100, exact,
895927
po_amount = excess_agi * po_rate
896928
ded = max(0., ded - po_amount)
897929
auto_loan_interest_deduction = ded
898-
return auto_loan_interest_deduction
930+
return (senior_deduction, auto_loan_interest_deduction)
899931

900932

901933
@iterate_jit(nopython=True)
@@ -1245,12 +1277,14 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,
12451277

12461278
@iterate_jit(nopython=True)
12471279
def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
1248-
e02100, e27200, e00650, c01000, auto_loan_interest_deduction,
1280+
e02100, e27200, e00650, c01000,
1281+
senior_deduction, auto_loan_interest_deduction,
12491282
PT_SSTB_income, PT_binc_w2_wages, PT_ubia_property,
12501283
PT_qbid_rt, PT_qbid_limited,
12511284
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
1252-
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt, c04800,
1253-
PT_qbid_ps, PT_qbid_prt, qbided):
1285+
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt,
1286+
PT_qbid_ps, PT_qbid_prt,
1287+
c04800, qbided):
12541288
"""
12551289
Calculates taxable income, c04800, and
12561290
qualified business income deduction, qbided.
@@ -1282,6 +1316,8 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
12821316
Qualified dividends included in ordinary dividends
12831317
c01000: float
12841318
Limitation on capital losses
1319+
senior_deduction: float
1320+
Deduction for elderly head/spouse
12851321
auto_loan_interest_deduction: float
12861322
Deduction for qualified auto loan interest paid
12871323
PT_SSTB_income: int
@@ -1309,12 +1345,12 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
13091345
Alternative QBID cap rate on pass-through business W-2 wages paid
13101346
PT_qbid_alt_property_rt: float
13111347
Alternative QBID cap rate on pass-through business property owned
1312-
c04800: float
1313-
Regular taxable income
13141348
PT_qbid_ps: list
13151349
QBID phaseout taxable income start
13161350
PT_qbid_prt: float
13171351
QBID phaseout rate
1352+
c04800: float
1353+
Regular taxable income
13181354
qbided: float
13191355
Qualified Business Income (QBI) deduction
13201356
@@ -1325,8 +1361,10 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
13251361
qbided: float
13261362
Qualified Business Income (QBI) deduction
13271363
"""
1328-
# calculate taxable income before qualified business income deduction
1329-
pre_qbid_taxinc = max(0., c00100 - max(c04470, standard) - c04600)
1364+
# calculate taxable income before qualified business income deduction,
1365+
# which is assumed to be stacked last in the list of deductions
1366+
odeds = senior_deduction + auto_loan_interest_deduction
1367+
pre_qbid_taxinc = max(0., c00100 - max(c04470, standard) - c04600 - odeds)
13301368
# calculate qualified business income deduction
13311369
qbinc = max(0., e00900 - c03260 + e26270 + e02100 + e27200)
13321370
qbid_before_limits = qbinc * PT_qbid_rt
@@ -1372,8 +1410,8 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
13721410
else: # if PT_qbid_limited is false
13731411
qbided = qbid_before_limits
13741412

1375-
# calculate taxable income after qualified business income deduction
1376-
c04800 = max(0., pre_qbid_taxinc - qbided - auto_loan_interest_deduction)
1413+
# calculate taxable income after qbided
1414+
c04800 = max(0., pre_qbid_taxinc - qbided)
13771415
return (c04800, qbided)
13781416

13791417

taxcalc/calculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from taxcalc.calcfunctions import (TaxInc, SchXYZTax, GainsTax, AGIsurtax,
1515
NetInvIncTax, AMT, EI_PayrollTax, Adj,
1616
DependentCare, ALD_InvInc_ec_base, CapGains,
17-
SSBenefits, UBI, AGI, AutoLoanInterestDed,
17+
SSBenefits, UBI, AGI, MiscDed,
1818
ItemDed, StdDed, AdditionalMedicareTax,
1919
F2441, EITC, RefundablePayrollTaxCredit,
2020
ChildDepTaxCredit, AdditionalCTC, CTC_new,
@@ -1391,7 +1391,7 @@ def _calc_one_year(self, zero_out_calc_vars=False):
13911391
CapGains(self.__policy, self.__records)
13921392
SSBenefits(self.__policy, self.__records)
13931393
AGI(self.__policy, self.__records)
1394-
AutoLoanInterestDed(self.__policy, self.__records)
1394+
MiscDed(self.__policy, self.__records)
13951395
ItemDed(self.__policy, self.__records)
13961396
AdditionalMedicareTax(self.__policy, self.__records)
13971397
StdDed(self.__policy, self.__records)

taxcalc/policy.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def number_of_years(last_budget_year=LAST_BUDGET_YEAR):
6161
# following parameters were renamed in PR 2918
6262
'SS_thd50': 'was renamed SS_thd1 in Tax-Calculator 5.0.0',
6363
'SS_thd85': 'was renamed SS_thd2 in Tax-Calculator 5.0.0',
64-
# following parameters were removed in PR 2619
64+
# following parameters were removed in PR 2919
6565
'PT_rt1': 'was removed in Tax-Calculator 5.0.0',
6666
'PT_rt2': 'was removed in Tax-Calculator 5.0.0',
6767
'PT_rt3': 'was removed in Tax-Calculator 5.0.0',
@@ -81,7 +81,7 @@ def number_of_years(last_budget_year=LAST_BUDGET_YEAR):
8181
'PT_EligibleRate_passive': 'was removed in Tax-Calculator 5.0.0',
8282
'PT_wages_active_income': 'was removed in Tax-Calculator 5.0.0',
8383
'PT_top_stacking': 'was removed in Tax-Calculator 5.0.0',
84-
# following parameters were removed in PR 2620
84+
# following parameters were removed in PR 2920
8585
'ID_AmountCap_Switch': 'was removed in Tax-Calculator 5.0.0',
8686
'ID_AmountCap_rt': 'was removed in Tax-Calculator 5.0.0',
8787
'ID_BenefitCap_Switch': 'was removed in Tax-Calculator 5.0.0',
@@ -90,14 +90,16 @@ def number_of_years(last_budget_year=LAST_BUDGET_YEAR):
9090
'ID_BenefitSurtax_crt': 'was removed in Tax-Calculator 5.0.0',
9191
'ID_BenefitSurtax_trt': 'was removed in Tax-Calculator 5.0.0',
9292
'ID_BenefitSurtax_em': 'was removed in Tax-Calculator 5.0.0',
93-
# following parameters were renamed in PR 2628
93+
# following parameters were renamed in PR 2928
9494
'CDCC_ps': 'was renamed CDCC_ps1 in Tax-Calculator 5.1.0',
9595
'CDCC_crt': 'was renamed CDCC_po1_rate_max in Tax-Calculator 5.1.0',
9696
'CDCC_frt': 'was renamed CDCC_po1_rate_min in Tax-Calculator 5.1.0',
9797
'CDCC_po_step_size': (
9898
'was renamed CDCC_po1_step_size'
9999
'in Tax-Calculator 5.1.0'
100100
),
101+
# following parameter was renamed in PR 2929
102+
'II_prt': 'was renamed II_em_prt in Tax-Calculator 5.1.0',
101103
}
102104
# (2) specify which Policy parameters have been redefined recently
103105
# where "recently" means in the last major release

taxcalc/policy_current_law.json

Lines changed: 112 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15963,7 +15963,7 @@
1596315963
"validators": {
1596415964
"range": {
1596515965
"min": 0,
15966-
"max": 9e+99
15966+
"max": 1
1596715967
}
1596815968
},
1596915969
"compatible_data": {
@@ -18928,7 +18928,7 @@
1892818928
"validators": {
1892918929
"range": {
1893018930
"min": 0,
18931-
"max": 9e+99
18931+
"max": 1
1893218932
}
1893318933
},
1893418934
"compatible_data": {
@@ -20623,7 +20623,7 @@
2062320623
"validators": {
2062420624
"range": {
2062520625
"min": 0,
20626-
"max": 9e+99
20626+
"max": 1
2062720627
}
2062820628
},
2062920629
"compatible_data": {
@@ -22435,6 +22435,113 @@
2243522435
"cps": true
2243622436
}
2243722437
},
22438+
"SeniorDed_c": {
22439+
"title": "Senior deduction amount per elderly head/spouse",
22440+
"description": "Senior deduction is capped at this level per elderly head/spouse.",
22441+
"notes": "",
22442+
"section_1": "",
22443+
"section_2": "",
22444+
"indexable": true,
22445+
"indexed": false,
22446+
"type": "float",
22447+
"value": [
22448+
{
22449+
"year": 2013,
22450+
"value": 0.0
22451+
},
22452+
{
22453+
"year": 2025,
22454+
"value": 0.0
22455+
},
22456+
{
22457+
"year": 2029,
22458+
"value": 0.0
22459+
}
22460+
],
22461+
"validators": {
22462+
"range": {
22463+
"min": 0,
22464+
"max": 9e+99
22465+
}
22466+
},
22467+
"compatible_data": {
22468+
"puf": true,
22469+
"cps": true
22470+
}
22471+
},
22472+
"SeniorDed_ps": {
22473+
"title": "Senior deduction phase-out start AGI level",
22474+
"description": "Senior deduction is phased-out if AGI exceeds this amount.",
22475+
"notes": "",
22476+
"section_1": "",
22477+
"section_2": "",
22478+
"indexable": true,
22479+
"indexed": false,
22480+
"type": "float",
22481+
"value": [
22482+
{
22483+
"year": 2013,
22484+
"MARS": "single",
22485+
"value": 75000.0
22486+
},
22487+
{
22488+
"year": 2013,
22489+
"MARS": "mjoint",
22490+
"value": 150000.0
22491+
},
22492+
{
22493+
"year": 2013,
22494+
"MARS": "mseparate",
22495+
"value": 75000.0
22496+
},
22497+
{
22498+
"year": 2013,
22499+
"MARS": "headhh",
22500+
"value": 75000.0
22501+
},
22502+
{
22503+
"year": 2013,
22504+
"MARS": "widow",
22505+
"value": 75000.0
22506+
}
22507+
],
22508+
"validators": {
22509+
"range": {
22510+
"min": 0,
22511+
"max": 9e+99
22512+
}
22513+
},
22514+
"compatible_data": {
22515+
"puf": true,
22516+
"cps": true
22517+
}
22518+
},
22519+
"SeniorDed_prt": {
22520+
"title": "Senior deduction phase-out rate",
22521+
"description": "Senior deduction is phased-out at this rate on AGI exceeding SeniorDed_ps.",
22522+
"notes": "",
22523+
"section_1": "",
22524+
"section_2": "",
22525+
"indexable": false,
22526+
"indexed": false,
22527+
"type": "float",
22528+
"value": [
22529+
{
22530+
"year": 2013,
22531+
"value": 0.06
22532+
}
22533+
],
22534+
"validators": {
22535+
"range": {
22536+
"min": 0,
22537+
"max": 1
22538+
}
22539+
},
22540+
"compatible_data": {
22541+
"puf": true,
22542+
"cps": true
22543+
}
22544+
},
2243822545
"AutoLoanInterestDed_c": {
2243922546
"title": "Maximum amount of auto loan interest that is deductible",
2244022547
"description": "Auto loan interest in excess of this amount may not be deducted from AGI.",
@@ -22722,7 +22829,7 @@
2272222829
"validators": {
2272322830
"range": {
2272422831
"min": 0,
22725-
"max": 9e+99
22832+
"max": 1
2272622833
}
2272722834
},
2272822835
"compatible_data": {
@@ -22880,7 +22987,7 @@
2288022987
"validators": {
2288122988
"range": {
2288222989
"min": 0,
22883-
"max": 9e+99
22990+
"max": 1
2288422991
}
2288522992
},
2288622993
"compatible_data": {

0 commit comments

Comments
 (0)