@@ -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 )
12471279def 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
0 commit comments