Skip to content

Commit

Permalink
format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelMakarchuk committed Feb 4, 2025
1 parent d8be53a commit 9ede0e4
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 16 deletions.
2 changes: 1 addition & 1 deletion changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- bump: minor
changes:
added:
- Reafctor the Alternative Minimum Tax (AMT) logic.
- Refactor the Alternative Minimum Tax (AMT) logic.
21 changes: 21 additions & 0 deletions policyengine_us/parameters/gov/irs/income/amt/multiplier.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: The IRS multiplies the Alternative Minimum Tax income tax brackets by this rate, based on filing status.
metadata:
unit: /1
period: year
breakdown:
- filing_status
label: AMT tax bracket multiplier
reference:
- title: 26 U.S. Code § 55 - Alternative minimum tax imposed (b)(1)(C)
href: https://www.law.cornell.edu/uscode/text/26/55#b_1_C

SINGLE:
2013-01-01: 1
JOINT:
2013-01-01: 1
HEAD_OF_HOUSEHOLD:
2013-01-01: 1
SURVIVING_SPOUSE:
2013-01-01: 0.5
SEPARATE:
2013-01-01: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Single person, low income
period: 2022
input:
filing_status: SINGLE
amt_income_less_exemptions: 10_000
output:
amt_higher_base_tax: 0

- name: Single person, 400k income
period: 2022
input:
filing_status: SINGLE
amt_income_less_exemptions: 400_000
output:
amt_higher_base_tax: 54_292

- name: Joint, 600k income
period: 2022
input:
filing_status: JOINT
amt_income_less_exemptions: 600_000
output:
amt_higher_base_tax: 110_292
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Single person, low income
period: 2022
input:
filing_status: SINGLE
amt_income_less_exemptions: 10_000
output:
amt_lower_base_tax: 2_600

- name: Single person, no income
period: 2022
input:
filing_status: SINGLE
amt_income_less_exemptions: 0
output:
amt_lower_base_tax: 0

- name: Joint, high income
period: 2022
input:
filing_status: JOINT
amt_income_less_exemptions: 400_000
output:
amt_lower_base_tax: 53_586
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from policyengine_us.model_api import *


class amt_base_tax(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Alternative Minimum Tax base tax"
unit = USD
documentation = "Alternative Minimum Tax (AMT) base tax, Form 6251 Part II Line 7 'All Others'"
reference = "https://www.irs.gov/pub/irs-pdf/f6251.pdf"

adds = [
"amt_lower_base_tax",
"amt_higher_base_tax",
]
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
from policyengine_us.model_api import *


class amt_base_tax(Variable):
class amt_higher_base_tax(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Alternative Minimum Tax"
label = "Alternative Minimum Tax higher base tax amount"
unit = USD
documentation = "Alternative Minimum Tax (AMT) base tax, Form 6251 Part II Line 7 'All Others'"
documentation = "Alternative Minimum Tax (AMT) base tax, Form 6251 Part II Line 7 'All Others' - higher bracket"
reference = "https://www.irs.gov/pub/irs-pdf/f6251.pdf"

def formula(tax_unit, period, parameters):
p = parameters(period).gov.irs.income.amt
filing_status = tax_unit("filing_status", period)
reduced_income = tax_unit("amt_income_less_exemptions", period)
bracket_fraction = where(
filing_status == filing_status.possible_values.SEPARATE,
0.5,
1.0,
)
bracket_fraction = p.multiplier[filing_status]
tax_rate_threshold = p.brackets.thresholds[-1] * bracket_fraction
lower_rate = p.brackets.rates[0]
higher_rate = p.brackets.rates[1]
lower_tax = min_(reduced_income, tax_rate_threshold) * lower_rate
higher_tax = max_(0, reduced_income - tax_rate_threshold) * higher_rate
return lower_tax + higher_tax
return max_(0, reduced_income - tax_rate_threshold) * higher_rate
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from policyengine_us.model_api import *


class amt_lower_base_tax(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Alternative Minimum Tax lower base tax amount"
unit = USD
documentation = "Alternative Minimum Tax (AMT) base tax, Form 6251 Part II Line 7 'All Others' - lower bracket"
reference = "https://www.irs.gov/pub/irs-pdf/f6251.pdf"

def formula(tax_unit, period, parameters):
p = parameters(period).gov.irs.income.amt
filing_status = tax_unit("filing_status", period)
reduced_income = tax_unit("amt_income_less_exemptions", period)
bracket_fraction = p.multiplier[filing_status]
tax_rate_threshold = p.brackets.thresholds[-1] * bracket_fraction
lower_rate = p.brackets.rates[0]
return min_(reduced_income, tax_rate_threshold) * lower_rate
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class amt_kiddie_tax_applies(Variable):

def formula(tax_unit, period, parameters):
age_head = tax_unit("age_head", period)
child = parameters(period).gov.irs.dependent.ineligible_age
young_head = (age_head != 0) & (age_head < child.non_student)
no_or_young_spouse = tax_unit("age_spouse", period) < child.non_student
p = parameters(period).gov.irs.dependent.ineligible_age
young_head = (age_head != 0) & (age_head < p.non_student)
no_or_young_spouse = tax_unit("age_spouse", period) < p.non_student
return young_head & no_or_young_spouse

0 comments on commit 9ede0e4

Please sign in to comment.