Skip to content

Commit

Permalink
Finish elimination of taxcalc-related variables (#3226)
Browse files Browse the repository at this point in the history
* Remove unused tax_unit_net_capital_gains alias for c01000

* Rename c23650 variable to net_capital_gains

* Relocate net_capital_gains variable

* Rename c01000 variable to loss_limited_net_capital_gains

* Move tax_unit_is_joint variable to own module

* Relocate loss_limited_net_capital_gains.py module

* Add capital_gains/loss_limit.yaml parameter and use it in formula

* Relocate/rename hasqdivltcg variable as has_qdiv_or_ltcg

* Remove taxcalc variable sep

* Rename k1bx14 to s_corp_self_employment_income

* Add adjusted_earnings variable (formerly earned)

* Add filer_adjusted_earnings variable (formerly filer_earned)

* Use new (filer_)adjusted_earnings variables in formulas and tests

* Add changelog entry

* Eliminate use of dsi alias variables

* Move IL unit tests to more consistent directory location

* Update changelog_entry.yaml

---------

Co-authored-by: Max Ghenis <[email protected]>
  • Loading branch information
martinholmer and MaxGhenis authored Nov 3, 2023
1 parent 2520ab6 commit 582af67
Show file tree
Hide file tree
Showing 82 changed files with 370 additions and 403 deletions.
10 changes: 10 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- bump: minor
changes:
added:
- The `net_capital_gains` variable (formerly `c23650`).
- The `gov/irs/capital_gains/loss_limit.yaml` parameter file.
- The `loss_limited_net_capital_gains` variable (formerly `c01000`) that uses the `loss_limit` parameter.
removed:
- Formula code that avoids `sep` variable that had no formula, and therefore, was likely to cause bugs.
changed:
- Rename taxcalc variables to be consistent with this project's coding style and to be in more sensible directory locations.
16 changes: 16 additions & 0 deletions policyengine_us/parameters/gov/irs/capital_gains/loss_limit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: Capital gains loss limit
metadata:
unit: currency-USD
reference:
- title: IRS Topic No. 409, Capital Gains and Losses
href: https://www.irs.gov/taxtopics/tc409
HEAD_OF_HOUSEHOLD:
2013-01-01: 3_000
JOINT:
2013-01-01: 3_000
SEPARATE:
2013-01-01: 1_500
SINGLE:
2013-01-01: 3_000
WIDOW:
2013-01-01: 3_000
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description: Personal exemption phase-out step size
metadata:
unit: /1
unit: currency-USD
reference:
- title: 26 U.S. Code § 151 - Allowance of deductions for personal exemptions (d)(3)(B)
href: https://www.law.cornell.edu/uscode/text/26/151#d_3_B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ values:
- taxable_interest_income
- dividend_income
- rental_income
- c01000 # Loss-limited capital gains.
- loss_limited_net_capital_gains
metadata:
unit: currency-USD
label: net investment income sources
Expand Down
16 changes: 8 additions & 8 deletions policyengine_us/reforms/winship.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def create_eitc_winship_reform(parameters, period, bypass=False):
):
return None

# Compute EITC under filer_earned = tax_unit_head_earned
# Then compute EITC under filer_earned = tax_unit_spouse_earned
# Compute EITC under filer_adj_earnings = filer head adj earnings
# Then compute EITC under filer_adj_earnings = filer spouse adj earnings
# Then set EITC = sum of the two

class original_eitc(Variable):
Expand Down Expand Up @@ -40,26 +40,26 @@ def formula(tax_unit, period, parameters):
person = tax_unit.members
simulation = tax_unit.simulation
agi = tax_unit("adjusted_gross_income", period)
earned_income = person("earned", period)
adj_earnings = person("adjusted_earnings", period)
is_head = person("is_tax_unit_head", period)
is_spouse = person("is_tax_unit_spouse", period)

filer_earned_head_only = tax_unit.sum(earned_income * is_head)
filer_earned_spouse_only = tax_unit.sum(earned_income * is_spouse)
filer_earned_head_only = tax_unit.sum(adj_earnings * is_head)
filer_earned_spouse_only = tax_unit.sum(adj_earnings * is_spouse)

head_only_branch = simulation.get_branch("head_only")
head_only_branch.set_input(
"filer_earned", period, filer_earned_head_only
"filer_adjusted_earnings", period, filer_earned_head_only
)
# Phase out with respect to individual earned income, instead of AGI.
# Phase out with respect to individual earnings instead of AGI
head_only_branch.set_input(
"adjusted_gross_income", period, filer_earned_head_only
)
head_eitc = head_only_branch.calculate("original_eitc", period)

spouse_only_branch = simulation.get_branch("spouse_only")
spouse_only_branch.set_input(
"filer_earned", period, filer_earned_spouse_only
"filer_adjusted_earnings", period, filer_earned_spouse_only
)
spouse_only_branch.set_input(
"adjusted_gross_income", period, filer_earned_spouse_only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
period: 2018
input:
is_tax_unit_head: true
earned: 1
adjusted_earnings: 1
output:
head_earned: 1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
people:
head:
is_tax_unit_head: true
earned: 1
adjusted_earnings: 1
spouse:
is_tax_unit_spouse: true
earned: 2
adjusted_earnings: 2
tax_units:
tax_unit:
members: [head, spouse]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
- name: Negatives also produce zero.
period: 2022
input:
sey: -1
self_employment_income: -1
output:
taxable_self_employment_income: 0

- name: Otherwise, half of self-employment taxes are deducted.
period: 2022
input:
sey: 100_000
self_employment_income: 100_000
output:
taxable_self_employment_income: 92_350

- name: Zero if less than $400.
period: 2022
input:
sey: 399
self_employment_income: 399
output:
taxable_self_employment_income: 0
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
input:
taxable_interest_income: 0
dividend_income: 0
c01000: 0
loss_limited_net_capital_gains: 0
rental_income: 0
filing_status: SINGLE
output:
Expand All @@ -14,7 +14,7 @@
input:
taxable_interest_income: 0
dividend_income: 0
c01000: 0
loss_limited_net_capital_gains: 0
rental_income: 199_000
filing_status: SINGLE
output:
Expand All @@ -25,7 +25,7 @@
input:
taxable_interest_income: 0
dividend_income: 0
c01000: 0
loss_limited_net_capital_gains: 0
adjusted_gross_income: 205_000
rental_income: 205_000
filing_status: SINGLE
Expand All @@ -37,7 +37,7 @@
input:
taxable_interest_income: 0
dividend_income: 0
c01000: 0
loss_limited_net_capital_gains: 0
adjusted_gross_income: 900_000
rental_income: 900_000
filing_status: SINGLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
tax_units:
tax_unit:
members: [parent, child]
filer_earned: 25_000
filer_adjusted_earnings: 25_000
ca_eitc: 1
households:
household:
Expand All @@ -29,7 +29,7 @@
tax_units:
tax_unit:
members: [parent, child]
filer_earned: 25_100
filer_adjusted_earnings: 25_100
ca_eitc: 1
households:
household:
Expand All @@ -49,7 +49,7 @@
tax_units:
tax_unit:
members: [parent, child]
filer_earned: 25_100
filer_adjusted_earnings: 25_100
ca_eitc: 1
households:
household:
Expand Down Expand Up @@ -90,7 +90,7 @@
tax_units:
tax_unit:
members: [parent, child]
filer_earned: 30_000
filer_adjusted_earnings: 30_000
ca_eitc: 1
households:
household:
Expand All @@ -113,7 +113,7 @@
tax_units:
tax_unit:
members: [parent, child1, child2]
filer_earned: 25_100
filer_adjusted_earnings: 25_100
ca_eitc: 1
households:
household:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
adjusted_gross_income: 4_000
filing_status: SINGLE
exemptions_count: 3
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2, person3]
Expand Down Expand Up @@ -50,7 +50,7 @@
adjusted_gross_income: 4_000
filing_status: SINGLE
exemptions_count: 3
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2, person3]
Expand Down Expand Up @@ -81,7 +81,7 @@
adjusted_gross_income: 4_000
filing_status: SINGLE
exemptions_count: 2
dsi: true
head_is_dependent_elsewhere: true
households:
household:
members: [person1, person2]
Expand Down Expand Up @@ -111,7 +111,7 @@
adjusted_gross_income: 35_000
filing_status: SINGLE
exemptions_count: 3
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2, person3]
Expand Down Expand Up @@ -141,7 +141,7 @@
adjusted_gross_income: 35_000
filing_status: JOINT
exemptions_count: 3
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2, person3]
Expand Down Expand Up @@ -171,7 +171,7 @@
adjusted_gross_income: 55_000
filing_status: JOINT
exemptions_count: 3
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2, person3]
Expand All @@ -197,7 +197,7 @@
members: [person1, person2]
adjusted_gross_income: 6_000
filing_status: SINGLE
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2]
Expand All @@ -223,7 +223,7 @@
members: [person1, person2]
adjusted_gross_income: 6_000
filing_status: SINGLE
dsi: false
head_is_dependent_elsewhere: false
households:
household:
members: [person1, person2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
period: 2021
input:
state_code: HI
dsi: false
head_is_dependent_elsewhere: false
adjusted_gross_income: 29_000
rent: 1_100
output:
Expand All @@ -12,7 +12,7 @@
period: 2021
input:
state_code: HI
dsi: false
head_is_dependent_elsewhere: false
adjusted_gross_income: 31_000
rent: 1_100
output:
Expand All @@ -22,7 +22,7 @@
period: 2021
input:
state_code: HI
dsi: false
head_is_dependent_elsewhere: false
adjusted_gross_income: 29_000
rent: 900
output:
Expand All @@ -32,7 +32,7 @@
period: 2021
input:
state_code: HI
dsi: false
head_is_dependent_elsewhere: false
adjusted_gross_income: 32_000
rent: 900
output:
Expand Down
Loading

0 comments on commit 582af67

Please sign in to comment.