Skip to content

Commit

Permalink
Merge pull request #46 from bodiyang/v4_development
Browse files Browse the repository at this point in the history
V4 development
  • Loading branch information
bodiyang authored Jun 4, 2024
2 parents 802e20e + dcdf068 commit 2794aa4
Show file tree
Hide file tree
Showing 11 changed files with 393 additions and 270 deletions.
401 changes: 216 additions & 185 deletions docs/guide/policy_params.md

Large diffs are not rendered by default.

73 changes: 46 additions & 27 deletions taxcalc/calcfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ def BenefitPrograms(calc):

@iterate_jit(nopython=True)
def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
FICA_ss_trt, FICA_mc_trt, ALD_SelfEmploymentTax_hc,
SS_Earnings_thd, SECA_Earnings_thd,
FICA_ss_trt_employer, FICA_ss_trt_employee,
FICA_mc_trt_employer, FICA_mc_trt_employee,
ALD_SelfEmploymentTax_hc, SS_Earnings_thd, SECA_Earnings_thd,
e00900p, e00900s, e02100p, e02100s, k1bx14p,
k1bx14s, payrolltax, ptax_was, setax, c03260, ptax_oasdi,
sey, earned, earned_p, earned_s,
Expand All @@ -123,10 +124,14 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
Contributions to defined-contribution pension plans for taxpayer
pencon_s: float
Contributions to defined-contribution pension plans for spouse
FICA_ss_trt: float
Social security payroll tax rate, including both employer and employee
FICA_mc_trt: float
Medicare payroll tax rate, including both employer and employee
FICA_ss_trt_employer: float
Employer side social security payroll tax rate
FICA_ss_trt_employee: float
Employee side social security payroll tax rate
FICA_mc_trt_employer: float
Employer side medicare payroll tax rate
FICA_mc_trt_employee: float
Employee side medicare payroll tax rate
ALD_SelfEmploymentTax_hc: float
Adjustment for self-employment tax haircut
If greater than zero, reduces the employer equivalent portion of self-employment adjustment
Expand Down Expand Up @@ -218,22 +223,22 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
txearn_was_s = min(SS_Earnings_c, gross_was_s)

# compute OASDI and HI payroll taxes on wage-and-salary income, FICA
ptax_ss_was_p = FICA_ss_trt * txearn_was_p
ptax_ss_was_s = FICA_ss_trt * txearn_was_s
ptax_mc_was_p = FICA_mc_trt * gross_was_p
ptax_mc_was_s = FICA_mc_trt * gross_was_s
ptax_ss_was_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_p
ptax_ss_was_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_s
ptax_mc_was_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_was_p
ptax_mc_was_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_was_s
ptax_was = ptax_ss_was_p + ptax_ss_was_s + ptax_mc_was_p + ptax_mc_was_s

# compute taxable self-employment income for OASDI SECA
sey_frac = 1.0 - 0.5 * (FICA_ss_trt + FICA_mc_trt)
sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee + FICA_mc_trt_employer + FICA_mc_trt_employee)
txearn_sey_p = min(max(0., sey_p * sey_frac), SS_Earnings_c - txearn_was_p)
txearn_sey_s = min(max(0., sey_s * sey_frac), SS_Earnings_c - txearn_was_s)

# compute self-employment tax on taxable self-employment income, SECA
setax_ss_p = FICA_ss_trt * txearn_sey_p
setax_ss_s = FICA_ss_trt * txearn_sey_s
setax_mc_p = FICA_mc_trt * max(0., sey_p * sey_frac)
setax_mc_s = FICA_mc_trt * max(0., sey_s * sey_frac)
setax_ss_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_sey_p
setax_ss_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_sey_s
setax_mc_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * max(0., sey_p * sey_frac)
setax_mc_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * max(0., sey_s * sey_frac)
setax_p = setax_ss_p + setax_mc_p
setax_s = setax_ss_s + setax_mc_s
setax = setax_p + setax_s
Expand All @@ -246,13 +251,13 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
# compute extra OASDI payroll taxes on the portion of the sum
# of wage-and-salary income and taxable self employment income
# that exceeds SS_Earnings_thd
sey_frac = 1.0 - 0.5 * FICA_ss_trt
sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee)
was_plus_sey_p = gross_was_p + max(0., sey_p * sey_frac)
was_plus_sey_s = gross_was_s + max(0., sey_s * sey_frac)
extra_ss_income_p = max(0., was_plus_sey_p - SS_Earnings_thd)
extra_ss_income_s = max(0., was_plus_sey_s - SS_Earnings_thd)
extra_payrolltax = (extra_ss_income_p * FICA_ss_trt +
extra_ss_income_s * FICA_ss_trt)
extra_payrolltax = (extra_ss_income_p * (FICA_ss_trt_employer + FICA_ss_trt_employee) +
extra_ss_income_s * (FICA_ss_trt_employer + FICA_ss_trt_employee))

# compute part of total payroll taxes for filing unit
# (the ptax_amc part of total payroll taxes for the filing unit is
Expand Down Expand Up @@ -1080,7 +1085,8 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
@iterate_jit(nopython=True)
def AdditionalMedicareTax(e00200, MARS,
AMEDT_ec, sey, AMEDT_rt,
FICA_mc_trt, FICA_ss_trt,
FICA_mc_trt_employer, FICA_mc_trt_employee,
FICA_ss_trt_employer, FICA_ss_trt_employee,
ptax_amc, payrolltax):
"""
Computes Additional Medicare Tax (Form 8959) included in payroll taxes.
Expand All @@ -1093,10 +1099,14 @@ def AdditionalMedicareTax(e00200, MARS,
Additional Medicare Tax earnings exclusion
AMEDT_rt: float
Additional Medicare Tax rate
FICA_ss_trt: float
FICA Social Security tax rate
FICA_mc_trt: float
FICA Medicare tax rate
FICA_ss_trt_employer: float
Employer side FICA Social Security tax rate
FICA_ss_trt_employee: float
Employee side FICA Social Security tax rate
FICA_mc_trt_employer: float
Employer side FICA Medicare tax rate
FICA_mc_trt_employee: float
Employee side FICA Medicare tax rate
e00200: float
Wages and salaries
sey: float
Expand All @@ -1113,7 +1123,7 @@ def AdditionalMedicareTax(e00200, MARS,
payrolltax: float
payroll tax augmented by Additional Medicare Tax
"""
line8 = max(0., sey) * (1. - 0.5 * (FICA_mc_trt + FICA_ss_trt))
line8 = max(0., sey) * (1. - 0.5 * (FICA_mc_trt_employer + FICA_mc_trt_employee + FICA_ss_trt_employer + FICA_ss_trt_employee))
line11 = max(0., AMEDT_ec[MARS - 1] - e00200)
ptax_amc = AMEDT_rt * (max(0., e00200 - AMEDT_ec[MARS - 1]) +
max(0., line8 - line11))
Expand Down Expand Up @@ -2149,15 +2159,23 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
c00100: float
Adjusted Gross Income (AGI)
CDCC_ps: float
Child/dependent care credit phaseout start
Child/dependent care credit first phaseout start
CDCC_ps2: float
Child/dependent care credit second phaseout start
CDCC_crt: float
Child/dependent care credit phaseout percentage rate ceiling
Child/dependent care credit phaseout rate ceiling
CDCC_frt: float
Child/dependent care credit phaseout rate floor
CDCC_prt: float
Child/dependent care credit phaseout rate
c05800: float
Total (regular + AMT) income tax liability before credits
e07300: float
Foreign tax credit from Form 1116
c07180: float
Credit for child and dependent care expenses from Form 2441
CDCC_refund: bool
Indicator for whether CDCC is refundable
Returns
-------
Expand Down Expand Up @@ -2189,7 +2207,8 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
if c00100 > CDCC_ps2:
crate = max(0., CDCC_frt -
max(((c00100 - CDCC_ps2) * CDCC_prt), 0.))
c33200 = c33000 * 0.01 * crate

c33200 = c33000 * crate
# credit is limited by tax liability if not refundable
if CDCC_refundable:
c07180 = 0.
Expand Down
8 changes: 5 additions & 3 deletions taxcalc/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,11 @@ def mtr(self, variable_str='e00200p',
variable >= self.policy_param('SS_Earnings_thd')
)
adj = np.where(oasdi_taxed,
0.5 * (self.policy_param('FICA_ss_trt') +
self.policy_param('FICA_mc_trt')),
0.5 * self.policy_param('FICA_mc_trt'))
0.5 * (self.policy_param('FICA_ss_trt_employer') +
self.policy_param('FICA_ss_trt_employee') +
self.policy_param('FICA_mc_trt_employer') +
self.policy_param('FICA_mc_trt_employee')),
0.5 * (self.policy_param('FICA_mc_trt_employer') + self.policy_param('FICA_mc_trt_employee')))
else:
adj = 0.0
# compute marginal tax rates
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Parameters(pt.Parameters):
print(name, value)
# parameter_indexing_CPI_offset [0.]
# FICA_ss_trt [0.124]
# FICA_ss_trt_employer [0.062]
# SS_Earnings_c [113700.]
Check out the ParamTools
Expand Down
100 changes: 76 additions & 24 deletions taxcalc/policy_current_law.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
"cps": true
}
},
"FICA_ss_trt": {
"title": "Social Security payroll tax rate",
"description": "Social Security FICA rate, including both employer and employee.",
"FICA_ss_trt_employer": {
"title": "Employer side Social Security payroll tax rate",
"description": "Employer side Social Security FICA rate, including both employer and employee.",
"notes": "",
"section_1": "Payroll Taxes",
"section_2": "Social Security FICA",
Expand All @@ -129,13 +129,39 @@
"value": [
{
"year": 2013,
"value": 0.124
"value": 0.062
}
],
"validators": {
"range": {
"min": 0,
"max": 1
"max": 0.5
}
},
"compatible_data": {
"puf": true,
"cps": true
}
},
"FICA_ss_trt_employee": {
"title": "Employee side Social Security payroll tax rate",
"description": "Employee side Social Security FICA rate, including both employer and employee.",
"notes": "",
"section_1": "Payroll Taxes",
"section_2": "Social Security FICA",
"indexable": false,
"indexed": false,
"type": "float",
"value": [
{
"year": 2013,
"value": 0.062
}
],
"validators": {
"range": {
"min": 0,
"max": 0.5
}
},
"compatible_data": {
Expand Down Expand Up @@ -257,9 +283,9 @@
"cps": true
}
},
"FICA_mc_trt": {
"title": "Medicare payroll tax rate",
"description": "Medicare FICA rate, including both employer and employee.",
"FICA_mc_trt_employer": {
"title": "Employer side Medicare payroll tax rate",
"description": "Employer side Medicare FICA rate, including both employer and employee.",
"notes": "",
"section_1": "Payroll Taxes",
"section_2": "Medicare FICA",
Expand All @@ -269,13 +295,39 @@
"value": [
{
"year": 2013,
"value": 0.029
"value": 0.0145
}
],
"validators": {
"range": {
"min": 0,
"max": 1
"max": 0.5
}
},
"compatible_data": {
"puf": true,
"cps": true
}
},
"FICA_mc_trt_employee": {
"title": "Employee side Medicare payroll tax rate",
"description": "Employee side Medicare FICA rate, including both employer and employee.",
"notes": "",
"section_1": "Payroll Taxes",
"section_2": "Medicare FICA",
"indexable": false,
"indexed": false,
"type": "float",
"value": [
{
"year": 2013,
"value": 0.0145
}
],
"validators": {
"range": {
"min": 0,
"max": 0.5
}
},
"compatible_data": {
Expand Down Expand Up @@ -16350,8 +16402,8 @@
}
},
"CDCC_crt": {
"title": "Child & dependent care credit phaseout percentage rate ceiling",
"description": "The maximum percentage rate for the CDCC; this percentage rate decreases as AGI rises above the CDCC_ps level.",
"title": "Child & dependent care credit phaseout rate ceiling",
"description": "The maximum rate for the CDCC; this rate decreases as AGI rises above the CDCC_ps level.",
"notes": "",
"section_1": "Nonrefundable Credits",
"section_2": "Child And Dependent Care",
Expand All @@ -16361,21 +16413,21 @@
"value": [
{
"year": 2013,
"value": 35.0
"value": 0.350
},
{
"year": 2021,
"value": 50.0
"value": 0.500
},
{
"year": 2022,
"value": 35.0
"value": 0.350
}
],
"validators": {
"range": {
"min": 0,
"max": 100
"max": 1
}
},
"compatible_data": {
Expand All @@ -16384,8 +16436,8 @@
}
},
"CDCC_frt": {
"title": "Child & dependent care credit phaseout percentage rate floor",
"description": "The minimum percentage rate for the first AGI phaseout of the CDCC.",
"title": "Child & dependent care credit phaseout rate floor",
"description": "The minimum rate for the first AGI phaseout of the CDCC.",
"notes": "",
"section_1": "Nonrefundable Credits",
"section_2": "Child And Dependent Care",
Expand All @@ -16395,13 +16447,13 @@
"value": [
{
"year": 2013,
"value": 20.0
"value": 0.200
}
],
"validators": {
"range": {
"min": 0,
"max": 100
"max": 1
}
},
"compatible_data": {
Expand All @@ -16410,9 +16462,9 @@
}
},
"CDCC_prt": {
"title": "Child & dependent care credit phaseout percentage rate",
"description": "The CDCC credit rate is reduced by this many percentage points for each dollary of AGI over the phase-out thresholds.",
"notes": "In the law, the credit rate is reduced by 1 percentage point for every $2,000 of AGI over the limit.",
"title": "Child & dependent care credit phaseout rate",
"description": "The CDCC credit rate is reduced by this many percentage points for each dollar of AGI over the phase-out thresholds.",
"notes": "In the law, the credit rate is reduced by 1 percentage point for every $2,000 of AGI over the limit. 0.01 / 2000 = 0.000005",
"section_1": "Nonrefundable Credits",
"section_2": "Child And Dependent Care",
"indexable": false,
Expand All @@ -16421,7 +16473,7 @@
"value": [
{
"year": 2013,
"value": 0.0005
"value": 5e-06
}
],
"validators": {
Expand Down
4 changes: 2 additions & 2 deletions taxcalc/reforms/ARPA.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"2022": 15000},
"CDCC_ps2": {"2021": 400000,
"2022": 9e+99},
"CDCC_crt": {"2021": 50.0,
"2022": 35.0},
"CDCC_crt": {"2021": 0.5,
"2022": 0.35},
"CDCC_refundable": {"2021": true,
"2022": false},
"ALD_BusinessLosses_c": {"2026": [283535.22, 567070.42, 283535.22, 283535.22, 567070.42],
Expand Down
Loading

0 comments on commit 2794aa4

Please sign in to comment.