Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtract pre-tax contributions from taxable wages and salaries #3840

Merged
merged 7 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Subtract pre-tax contributions from taxable wages and salaries.
89 changes: 78 additions & 11 deletions policyengine_us/data/datasets/cps/cps.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ def add_personal_income_variables(
"""
# Get income imputation parameters.
yamlfilename = os.path.join(
os.path.abspath(os.path.dirname(__file__)), "income_parameters.yaml"
os.path.abspath(os.path.dirname(__file__)),
"imputation_parameters.yaml",
)
with open(yamlfilename, "r", encoding="utf-8") as yamlfile:
p = yaml.safe_load(yamlfile)
Expand All @@ -229,18 +230,18 @@ def add_personal_income_variables(
# Assign CPS variables.
cps["employment_income"] = person.WSAL_VAL
cps["taxable_interest_income"] = person.INT_VAL * (
p["taxable_interest_fraction"][year]
p["taxable_interest_fraction"]
)
cps["tax_exempt_interest_income"] = person.INT_VAL * (
1 - p["taxable_interest_fraction"][year]
1 - p["taxable_interest_fraction"]
)
cps["self_employment_income"] = person.SEMP_VAL
cps["farm_income"] = person.FRSE_VAL
cps["qualified_dividend_income"] = person.DIV_VAL * (
p["qualified_dividend_fraction"][year]
p["qualified_dividend_fraction"]
)
cps["non_qualified_dividend_income"] = person.DIV_VAL * (
1 - p["qualified_dividend_fraction"][year]
1 - p["qualified_dividend_fraction"]
)
cps["rental_income"] = person.RNT_VAL
# Assign Social Security retirement benefits if at least 62.
Expand All @@ -255,11 +256,12 @@ def add_personal_income_variables(
cps["unemployment_compensation"] = person.UC_VAL
# Add pensions and annuities.
cps_pensions = person.PNSN_VAL + person.ANN_VAL
cps["taxable_private_pension_income"] = cps_pensions * (
p["taxable_pension_fraction"][year]
# Assume a constant fraction of pension income is taxable.
cps["taxable_private_pension_income"] = (
cps_pensions * p["taxable_pension_fraction"]
)
cps["tax_exempt_private_pension_income"] = cps_pensions * (
1 - p["taxable_pension_fraction"][year]
1 - p["taxable_pension_fraction"]
)
# Other income (OI_VAL) is a catch-all for all other income sources.
# The code for alimony income is 20.
Expand All @@ -271,12 +273,77 @@ def add_personal_income_variables(
# They could also include General Assistance.
cps["tanf_reported"] = person.PAW_VAL
cps["ssi_reported"] = person.SSI_VAL
cps["pension_contributions"] = person.RETCB_VAL
# Assume all retirement contributions are traditional 401(k) for now.
# Procedure for allocating retirement contributions:
# 1) If they report any self-employment income, allocate entirely to
# self-employed pension contributions.
# 2) If they report any wage and salary income, allocate in this order:
# a) Traditional 401(k) contributions up to to limit
# b) Roth 401(k) contributions up to the limit
# c) IRA contributions up to the limit, split according to administrative fractions
# d) Other retirement contributions
# Disregard reported pension contributions from people who report neither wage and salary
# nor self-employment income.
# Assume no 403(b) or 457 contributions for now.
LIMIT_401K_2022 = 20_500
LIMIT_401K_CATCH_UP_2022 = 6_500
LIMIT_IRA_2022 = 6_000
LIMIT_IRA_CATCH_UP_2022 = 1_000
CATCH_UP_AGE_2022 = 50
retirement_contributions = person.RETCB_VAL
cps["self_employment_retirement_contributions"] = np.where(
person.SEMP_VAL > 0, retirement_contributions, 0
)
remaining_retirement_contributions = np.maximum(
retirement_contributions
- cps["self_employment_retirement_contributions"],
0,
)
# Compute the 401(k) limit for the person's age.
catch_up_eligible = person.A_AGE >= CATCH_UP_AGE_2022
limit_401k = LIMIT_401K_2022 + catch_up_eligible * LIMIT_401K_CATCH_UP_2022
limit_ira = LIMIT_IRA_2022 + catch_up_eligible * LIMIT_IRA_CATCH_UP_2022
cps["traditional_401k_contributions"] = np.where(
person.WSAL_VAL > 0,
np.minimum(remaining_retirement_contributions, limit_401k),
0,
)
remaining_retirement_contributions = np.maximum(
remaining_retirement_contributions
- cps["traditional_401k_contributions"],
0,
)
cps["roth_401k_contributions"] = np.where(
person.WSAL_VAL > 0,
np.minimum(remaining_retirement_contributions, limit_401k),
0,
)
remaining_retirement_contributions = np.maximum(
remaining_retirement_contributions - cps["roth_401k_contributions"],
0,
)
cps["traditional_ira_contributions"] = np.where(
person.WSAL_VAL > 0,
np.minimum(remaining_retirement_contributions, limit_ira),
0,
)
remaining_retirement_contributions = np.maximum(
remaining_retirement_contributions
- cps["traditional_ira_contributions"],
0,
)
roth_ira_limit = limit_ira - cps["traditional_ira_contributions"]
cps["roth_ira_contributions"] = np.where(
person.WSAL_VAL > 0,
np.minimum(remaining_retirement_contributions, roth_ira_limit),
0,
)
# Allocate capital gains into long-term and short-term based on aggregate split.
cps["long_term_capital_gains"] = person.CAP_VAL * (
p["long_term_capgain_fraction"][year]
p["long_term_capgain_fraction"]
)
cps["short_term_capital_gains"] = person.CAP_VAL * (
1 - p["long_term_capgain_fraction"][year]
1 - p["long_term_capgain_fraction"]
)
cps["receives_wic"] = person.WICYN == 1
cps["veterans_benefits"] = person.VET_VAL
Expand Down
14 changes: 14 additions & 0 deletions policyengine_us/data/datasets/cps/imputation_parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Personal income variable imputation parameters used
# in the cps.py add_personal_income_variables function.

# SOI 2020 data
taxable_interest_fraction: 0.680

# SOI 2018 data
qualified_dividend_fraction: 0.448

# no SOI data, so arbitrary assumption
taxable_pension_fraction: 1.000

# SOI 2012 data
long_term_capgain_fraction: 0.880
30 changes: 0 additions & 30 deletions policyengine_us/data/datasets/cps/income_parameters.yaml

This file was deleted.

13 changes: 4 additions & 9 deletions policyengine_us/parameters/gov/irs/ald/deductions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ values:
- health_savings_account_ald
- self_employed_health_insurance_ald
- self_employed_pension_contribution_ald
- ira_contributions
- sep_simple_qualified_plan_contributions
- traditional_ira_contributions
- qualified_adoption_assistance_expense
- us_bonds_for_higher_ed
- specified_possession_income
Expand All @@ -29,8 +28,7 @@ values:
- health_savings_account_ald
- self_employed_health_insurance_ald
- self_employed_pension_contribution_ald
- ira_contributions
- sep_simple_qualified_plan_contributions
- traditional_ira_contributions
- qualified_adoption_assistance_expense
- us_bonds_for_higher_ed
- specified_possession_income
Expand All @@ -45,8 +43,7 @@ values:
- health_savings_account_ald
- self_employed_health_insurance_ald
- self_employed_pension_contribution_ald
- ira_contributions
- sep_simple_qualified_plan_contributions
- traditional_ira_contributions
- qualified_adoption_assistance_expense
- us_bonds_for_higher_ed
- specified_possession_income
Expand All @@ -61,15 +58,13 @@ values:
- health_savings_account_ald
- self_employed_health_insurance_ald
- self_employed_pension_contribution_ald
- ira_contributions
- sep_simple_qualified_plan_contributions
- traditional_ira_contributions
- qualified_adoption_assistance_expense
- us_bonds_for_higher_ed
- specified_possession_income
- puerto_rico_income
metadata:
unit: variable
name: ald_deductions
label: Above-the-line deductions
reference:
- title: 26 U.S. Code § 62 - Adjusted gross income defined
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: The US subtracts these payroll deductions from wages and salaries when determining the taxable amount.
values:
2010-01-01:
# Assumes all are pre-tax.
- traditional_401k_contributions
# Assumes employer for now.
- health_insurance_premiums
metadata:
label: Pre-tax contributions
unit: list
period: year
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description: The US limits catch-up pension contributions to individuals this age or older.
values:
2021-01-01: 50
metadata:
unit: year
period: year
label: Pension contribution catch-up age threshold
references:
- title: 26 CFR § 1.414(v)-1 - Catch-up contributions. (g)(3)(ii)
href: https://www.law.cornell.edu/cfr/text/26/1.414(v)-1#g_3_ii
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
description: IRS limits the 401(k) contributions catch-up to this amount.
values:
2018-01-01: 6_000
2020-01-01: 6_500
2023-01-01: 7_500
metadata:
unit: currency-USD
period: year
label: 401(k) catch-up amount
references:
- title: 26 CFR § 1.414 - Catch-up contributions. (v)(2)(B)(i)
href: https://www.law.cornell.edu/cfr/text/26/1.414(v)-1
# Inflation adjusted amount
- title: Cost-of-Living Adjustments for Retirement Items
href: https://www.irs.gov/pub/irs-tege/cola-table.pdf#page=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: The US allows for catch-up IRA contributions of this amount.
values:
2018-01-01: 1_000
metadata:
unit: currency-USD
period: year
label: IRA catch-up amount
references:
- title: 26 U.S. Code § 219 - Retirement savings (b)(5)(B)
href: https://www.law.cornell.edu/uscode/text/26/219
- title: Cost-of-Living Adjustments for Retirement Items
href: https://www.irs.gov/pub/irs-tege/cola-table.pdf#page=2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
description: The US limits annual 401(k) contributions to this amount.
values:
2018-01-01: 18_500
2019-01-01: 19_000
2020-01-01: 19_500
2022-01-01: 20_500
2023-01-01: 22_500
2024-01-01: 23_000
metadata:
unit: currency-USD
period: year
label: 401(k) contribution limit
references:
- title: 26 CFR § 1.402(g)-1 - Limitation on exclusion for elective deferrals. (d))(i)
href: https://law.cornell.edu/cfr/text/26/1.402(g)-1
# Inflation adjusted amounts
- title: Cost-of-Living Adjustments for Retirement Items
href: https://www.irs.gov/pub/irs-tege/cola-table.pdf#page=1

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: The US limits annual IRA contributions to this amount.
values:
2018-01-01: 5_500
2019-01-01: 6_000
2023-01-01: 6_500
2024-01-01: 7_000
metadata:
unit: currency-USD
period: year
label: IRA contribution limit
references:
- title: 26 U.S. Code § 219 - Retirement savings (b)(5)(A)
href: https://www.law.cornell.edu/uscode/text/26/219
# Inflation adjusted amounts
- title: Cost-of-Living Adjustments for Retirement Items
href: https://www.irs.gov/pub/irs-tege/cola-table.pdf#page=2
4 changes: 3 additions & 1 deletion policyengine_us/parameters/gov/irs/gross_income/sources.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
description: Income sources counted as gross income for tax purposes.
values:
2010-01-01:
- employment_income
- irs_employment_income
- self_employment_income
- partnership_s_corp_income
- farm_income
Expand All @@ -19,6 +19,8 @@ values:
- taxable_unemployment_compensation
- taxable_social_security
- illicit_income
- taxable_ira_distributions
- taxable_401k_distributions
- miscellaneous_income
metadata:
unit: currency-USD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ values:
- unemployment_compensation # match?
- ca_state_disability_insurance
# Income from a job of any type.
- employment_income
- irs_employment_income
- self_employment_income
metadata:
unit: list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ description: Alabama provides these deductions for the state adjusted gross inco
values:
2021-01-01:
# IRA distributions prior to 1982 are not deductible.
- roth_ira_distributions # Line 1
- regular_ira_distributions # Line 1
- traditional_ira_contributions # Line 1
- alimony_expense # Line 4
- self_employed_health_insurance_ald # Line 7

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
description: Alabama counts these income sources for the state gross income.
values:
2021-01-01:
- employment_income
- irs_employment_income
- self_employment_income
- interest_income
- dividend_income
- alimony_income
- regular_ira_distributions
- roth_ira_distributions
- taxable_ira_distributions
- pension_income
- rental_income
- capital_gains
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
description: Arkansas accounts for these sources when calculating the gross income.
values:
2021-01-01:
- employment_income # Line 8
- irs_employment_income # Line 8
- self_employment_income # Line 8
- military_service_income # Line 9
- interest_income # Line 10
- dividend_income # Line 11
- alimony_income # Line 12
- capital_gains # Line 13
- regular_ira_distributions # Line 16
- taxable_ira_distributions # Line 16
# - ar_military_retirement_income_person # Line 17
- taxable_pension_income # Line 18
- rental_income # Line 19
Expand Down