Skip to content

Commit

Permalink
Merge pull request #238 from PolicyEngine/agi-logic
Browse files Browse the repository at this point in the history
Add AGI logic
  • Loading branch information
MaxGhenis authored Nov 15, 2021
2 parents 4a8e0bb + 9550891 commit faef189
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 2 deletions.
12 changes: 12 additions & 0 deletions openfisca_us/parameters/tax/income/exemption/amount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: Personal and dependent exemption amount
metadata:
unit: currency-USD
values:
2013-01-01: 3900.0
2014-01-01: 3950.0
2015-01-01: 4000.0
2016-01-01: 4050.0
2017-01-01: 4050.0
2018-01-01: 0.0
2019-01-01: 0.0
2026-01-01: 4691.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Personal exemption phaseout rate
metadata:
unit: currency-USD
values:
2013-01-01: 0.02
53 changes: 53 additions & 0 deletions openfisca_us/parameters/tax/income/exemption/phaseout/start.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
description: Personal exemption phaseout starting income
metadata:
unit: currency-USD
HEAD_OF_HOUSEHOLD:
values:
2013-01-01: 275000.0
2014-01-01: 279650.0
2015-01-01: 284040.0
2016-01-01: 285350.0
2017-01-01: 287650.0
2018-01-01: 9.0e+99
2019-01-01: 9.0e+99
2026-01-01: 333198.0
JOINT:
values:
2013-01-01: 300000.0
2014-01-01: 305050.0
2015-01-01: 309900.0
2016-01-01: 311300.0
2017-01-01: 313800.0
2018-01-01: 9.0e+99
2019-01-01: 9.0e+99
2026-01-01: 363489.0
SEPARATE:
values:
2013-01-01: 150000.0
2014-01-01: 152525.0
2015-01-01: 154950.0
2016-01-01: 155650.0
2017-01-01: 156900.0
2018-01-01: 9.0e+99
2019-01-01: 9.0e+99
2026-01-01: 181744.0
SINGLE:
values:
2013-01-01: 250000.0
2014-01-01: 254200.0
2015-01-01: 258250.0
2016-01-01: 259400.0
2017-01-01: 261500.0
2018-01-01: 9.0e+99
2019-01-01: 9.0e+99
2026-01-01: 302907.0
WIDOW:
values:
2013-01-01: 300000.0
2014-01-01: 305050.0
2015-01-01: 309900.0
2016-01-01: 311300.0
2017-01-01: 313800.0
2018-01-01: 9.0e+99
2019-01-01: 9.0e+99
2026-01-01: 363489.0
4 changes: 2 additions & 2 deletions openfisca_us/tools/dev/convert_taxcalc_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import argparse

TAXCALC_PARAM_FILE = (
"/home/nikhil/pslmodels/tax-calculator/taxcalc/policy_current_law.json"
"/home/nikhil/pslmodels/Tax-Calculator/taxcalc/policy_current_law.json"
)

MARS_map = {
Expand All @@ -20,7 +20,7 @@ def year_to_date(year: int) -> str:


def convert_param(param: dict) -> dict:
result = dict(description=param["title"])
result = dict(description=param["title"], values={})
for value in param["value"]:
date = year_to_date(value["year"])
val = float(value["value"])
Expand Down
29 changes: 29 additions & 0 deletions openfisca_us/variables/finance/tax/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ class c00100(Variable):
definition_period = YEAR
documentation = """Adjusted Gross Income (AGI)"""

def formula(tax_unit, period, parameters):
return add(tax_unit, period, "ymod1", "c02500", "c02900")


class c01000(Variable):
value_type = float
Expand Down Expand Up @@ -466,12 +469,32 @@ class c04470(Variable):
)


class exemption_phaseout_start(Variable):
value_type = float
entity = TaxUnit
label = "Exemption phaseout start"
definition_period = YEAR

def formula(tax_unit, period, parameters):
return parameters(period).tax.income.exemption.phaseout.start[
tax_unit("mars", period)
]


class c04600(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
documentation = """Personal exemptions after phase-out"""

def formula(tax_unit, period, parameters):
phaseout = parameters(period).tax.income.exemption.phaseout
phaseout_start = tax_unit("exemption_phaseout_start", period)
line_5 = max_(0, tax_unit("c00100", period) - phaseout_start)
line_6 = line_5 / (2500 / tax_unit("sep", period))
line_7 = phaseout.rate * line_6
return tax_unit("pre_c04600", period) * (1 - line_7)


class qbided(Variable):
value_type = float
Expand Down Expand Up @@ -986,6 +1009,12 @@ class pre_c04600(Variable):
definition_period = YEAR
documentation = """Personal exemption before phase-out"""

def formula(tax_unit, period, parameters):
exemption = parameters(period).tax.income.personal_exemption
return where(
tax_unit("dsi", period), 0, tax_unit("xtot", period) * exemption
)


class codtc_limited(Variable):
value_type = float
Expand Down

0 comments on commit faef189

Please sign in to comment.