From 249996814ab54eeeeb6b8532ca16f2e3e3e8c569 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 12 Nov 2026 14:34:47 -0500 Subject: [PATCH 1/5] Restore 2017 federal tax deduction histories and tests --- changelog.d/federal-tax-2017-history.fixed.md | 1 + .../gov/irs/capital_gains/other_cg_rate.yaml | 4 + .../unrecaptured_s_1250_rate.yaml | 4 + .../deductions/deductions_if_itemizing.yaml | 9 + .../deductions_if_not_itemizing.yaml | 15 +- .../charity/non_itemizers_amount.yaml | 7 + .../irs/deductions/itemized_deductions.yaml | 12 + .../capital_gain_excess_tax_rate.yaml | 3 + .../irs/income/amt/deductions_add_back.yaml | 3 + .../qualified_business_income_deduction.yaml | 25 + ...le_income_deductions_if_not_itemizing.yaml | 29 + .../taxable_income/exemptions/exemptions.yaml | 142 +++ .../amt_tax_including_cg.yaml | 21 + .../capital_gains/capital_gains_tax.yaml | 19 + .../irs/tax/federal_income/integration.yaml | 1083 +++++++++++++++++ .../taxable_income/exemptions/exemptions.py | 6 +- 16 files changed, 1381 insertions(+), 2 deletions(-) create mode 100644 changelog.d/federal-tax-2017-history.fixed.md create mode 100644 policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/taxable_income_deductions_if_not_itemizing.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml diff --git a/changelog.d/federal-tax-2017-history.fixed.md b/changelog.d/federal-tax-2017-history.fixed.md new file mode 100644 index 00000000000..82086510990 --- /dev/null +++ b/changelog.d/federal-tax-2017-history.fixed.md @@ -0,0 +1 @@ +Correct personal-exemption phase-out steps and duplicate tuition deductions, and add explicit 2017 federal tax histories. diff --git a/policyengine_us/parameters/gov/irs/capital_gains/other_cg_rate.yaml b/policyengine_us/parameters/gov/irs/capital_gains/other_cg_rate.yaml index f8ddf893aad..bbf92c4800c 100644 --- a/policyengine_us/parameters/gov/irs/capital_gains/other_cg_rate.yaml +++ b/policyengine_us/parameters/gov/irs/capital_gains/other_cg_rate.yaml @@ -1,9 +1,13 @@ description: Capital gains tax rate applying to special categories of gains (including small business stock and collectibles). values: + 2017-01-01: 0.28 2018-01-01: 0.28 metadata: unit: /1 + period: year label: Other capital gain tax rate reference: - title: 26 U.S.C. § 1(h)(1)(F) href: https://www.law.cornell.edu/uscode/text/26/1#h_1_F + - title: 2017 Instructions for Schedule D (Form 1040), Schedule D Tax Worksheet, line 41 + href: https://www.irs.gov/pub/irs-prior/i1040sd--2017.pdf#page=16 diff --git a/policyengine_us/parameters/gov/irs/capital_gains/unrecaptured_s_1250_rate.yaml b/policyengine_us/parameters/gov/irs/capital_gains/unrecaptured_s_1250_rate.yaml index 781f72b5dc8..39ca67458d9 100644 --- a/policyengine_us/parameters/gov/irs/capital_gains/unrecaptured_s_1250_rate.yaml +++ b/policyengine_us/parameters/gov/irs/capital_gains/unrecaptured_s_1250_rate.yaml @@ -1,9 +1,13 @@ description: Tax rate on net un-recaptured Section 1250 gains. values: + 2017-01-01: 0.25 2018-01-01: 0.25 metadata: unit: /1 + period: year label: Tax rate on net un-recaptured Section 1250 gains. reference: - title: 26 U.S.C. § 1(h)(1)(E) href: https://www.law.cornell.edu/uscode/text/26/1#h_1_E + - title: 2017 Instructions for Schedule D (Form 1040), Schedule D Tax Worksheet, line 38 + href: https://www.irs.gov/pub/irs-prior/i1040sd--2017.pdf#page=16 diff --git a/policyengine_us/parameters/gov/irs/deductions/deductions_if_itemizing.yaml b/policyengine_us/parameters/gov/irs/deductions/deductions_if_itemizing.yaml index 87159339586..99426213520 100644 --- a/policyengine_us/parameters/gov/irs/deductions/deductions_if_itemizing.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/deductions_if_itemizing.yaml @@ -3,6 +3,12 @@ values: # The tips and overtime deductions (26 U.S.C. 224 and 225) are listed in every # year. Their own in_effect parameters zero them outside 2025-2028, so a reform # that switches them on in another year also reaches taxable income. + 2017-01-01: + - qualified_business_income_deduction + - wagering_losses_deduction + - itemized_taxable_income_deductions + - tip_income_deduction + - overtime_income_deduction 2018-01-01: - qualified_business_income_deduction - wagering_losses_deduction @@ -30,3 +36,6 @@ metadata: unit: list period: year label: Taxable income deductions if itemizing + reference: + - title: 2017 Form 1040, line 40 + href: https://www.irs.gov/pub/irs-prior/f1040--2017.pdf#page=2 diff --git a/policyengine_us/parameters/gov/irs/deductions/deductions_if_not_itemizing.yaml b/policyengine_us/parameters/gov/irs/deductions/deductions_if_not_itemizing.yaml index 27e158096e0..2dadb203d38 100644 --- a/policyengine_us/parameters/gov/irs/deductions/deductions_if_not_itemizing.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/deductions_if_not_itemizing.yaml @@ -3,10 +3,16 @@ values: # The tips and overtime deductions (26 U.S.C. 224 and 225) are listed in every # year. Their own in_effect parameters zero them outside 2025-2028, so a reform # that switches them on in another year also reaches taxable income. + # Tuition and fees are deducted above AGI, not again with the standard + # deduction (2017 Form 1040 lines 34 and 40; 2018 Schedule 1 line 34). + 2017-01-01: + - standard_deduction + - qualified_business_income_deduction + - tip_income_deduction + - overtime_income_deduction 2018-01-01: - standard_deduction - qualified_business_income_deduction - - tuition_and_fees_deduction - tip_income_deduction - overtime_income_deduction # The 2020 charitable deduction for non-itemizers is above the line @@ -42,3 +48,10 @@ metadata: unit: list period: year label: Taxable income deductions if not itemizing + reference: + - title: 26 U.S.C. 62(a)(18) (2017 edition), Higher education expenses + href: https://www.govinfo.gov/content/pkg/USCODE-2017-title26/pdf/USCODE-2017-title26-subtitleA-chap1-subchapB-partI-sec62.pdf#page=3 + - title: "2017 Form 1040, lines 34 and 40 #page 1-2" + href: https://www.irs.gov/pub/irs-prior/f1040--2017.pdf#page=1 + - title: 2018 Schedule 1 (Form 1040), line 34 + href: https://www.irs.gov/pub/irs-prior/f1040s1--2018.pdf#page=1 diff --git a/policyengine_us/parameters/gov/irs/deductions/itemized/charity/non_itemizers_amount.yaml b/policyengine_us/parameters/gov/irs/deductions/itemized/charity/non_itemizers_amount.yaml index e95802db011..ad206f7e93f 100644 --- a/policyengine_us/parameters/gov/irs/deductions/itemized/charity/non_itemizers_amount.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/itemized/charity/non_itemizers_amount.yaml @@ -7,6 +7,8 @@ metadata: breakdown: - filing_status reference: + - title: 2017 Form 1040, line 40 + href: https://www.irs.gov/pub/irs-prior/f1040--2017.pdf#page=2 - title: 2021 Publication 526 Charitable Contributions href: https://www.irs.gov/pub/irs-prior/p526--2021.pdf#page=2 - title: 26 U.S. Code § 170 - Charitable, etc., contributions and gifts - (p) @@ -19,26 +21,31 @@ metadata: # 26 U.S.C. 170(p) starts in 2021. The 2020 deduction for non-itemizers was # above the line (26 U.S.C. 62(a)(22)); see gov.irs.ald.charitable_contributions. JOINT: + 2017-01-01: 0 2018-01-01: 0 2021-01-01: 600 2022-01-01: 0 2026-01-01: 2_000 SINGLE: + 2017-01-01: 0 2018-01-01: 0 2021-01-01: 300 2022-01-01: 0 2026-01-01: 1_000 SEPARATE: + 2017-01-01: 0 2018-01-01: 0 2021-01-01: 300 2022-01-01: 0 2026-01-01: 1_000 HEAD_OF_HOUSEHOLD: + 2017-01-01: 0 2018-01-01: 0 2021-01-01: 300 2022-01-01: 0 2026-01-01: 1_000 SURVIVING_SPOUSE: + 2017-01-01: 0 2018-01-01: 0 2021-01-01: 300 2022-01-01: 0 diff --git a/policyengine_us/parameters/gov/irs/deductions/itemized_deductions.yaml b/policyengine_us/parameters/gov/irs/deductions/itemized_deductions.yaml index c19e9f6664d..2ffe9fba47b 100644 --- a/policyengine_us/parameters/gov/irs/deductions/itemized_deductions.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/itemized_deductions.yaml @@ -1,5 +1,13 @@ description: Deductions from taxable income if itemizing (that are not available if not itemizing). values: + 2017-01-01: + - charitable_deduction + - interest_deduction + - salt_deduction + - medical_expense_deduction + - casualty_loss_deduction + - misc_deduction + - claim_of_right_deduction 2018-01-01: - charitable_deduction - interest_deduction @@ -10,4 +18,8 @@ values: - claim_of_right_deduction metadata: unit: list + period: year label: itemized deductions + reference: + - title: 2017 Instructions for Schedule A (Form 1040) + href: https://www.irs.gov/pub/irs-prior/i1040sca--2017.pdf#page=1 diff --git a/policyengine_us/parameters/gov/irs/income/amt/capital_gains/capital_gain_excess_tax_rate.yaml b/policyengine_us/parameters/gov/irs/income/amt/capital_gains/capital_gain_excess_tax_rate.yaml index b7486fbbd29..0c26b7ad665 100644 --- a/policyengine_us/parameters/gov/irs/income/amt/capital_gains/capital_gain_excess_tax_rate.yaml +++ b/policyengine_us/parameters/gov/irs/income/amt/capital_gains/capital_gain_excess_tax_rate.yaml @@ -6,5 +6,8 @@ metadata: reference: - title: 26 U.S.C. § 55 (2018) §55. Alternative minimum tax imposed (b)(3)(E) href: https://www.law.cornell.edu/uscode/text/26/55#b_3_E + - title: 2017 Form 6251, Part III, line 61 + href: https://www.irs.gov/pub/irs-prior/f6251--2017.pdf#page=2 values: + 2017-01-01: 0.25 2018-01-01: 0.25 diff --git a/policyengine_us/parameters/gov/irs/income/amt/deductions_add_back.yaml b/policyengine_us/parameters/gov/irs/income/amt/deductions_add_back.yaml index 7ac0981c393..7046ce2eaed 100644 --- a/policyengine_us/parameters/gov/irs/income/amt/deductions_add_back.yaml +++ b/policyengine_us/parameters/gov/irs/income/amt/deductions_add_back.yaml @@ -1,5 +1,6 @@ description: The US adds these deductions from taxable income back when calculating alternative minimum taxable income, whether or not the filer itemizes. values: + 2017-01-01: [] 2018-01-01: [] # 2025 Form 6251 line 1a subtracts the enhanced deduction for seniors # (Schedule 1-A, line 37) from Form 1040 line 14, so the deduction is @@ -13,6 +14,8 @@ metadata: unit: list label: AMT income deductions add back reference: + - title: 2017 Form 6251, Part I + href: https://www.irs.gov/pub/irs-prior/f6251--2017.pdf#page=1 - title: Instructions for Form 6251 (2025), What's New (Enhanced deduction for seniors) and Line 1a and Line 1b, page 1-2 href: https://www.irs.gov/pub/irs-prior/i6251--2025.pdf#page=1 - title: 2025 Form 6251, lines 1a and 1b diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/qualified_business_income_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/qualified_business_income_deduction.yaml index 92a5aa55c3e..1c3249b2a62 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/qualified_business_income_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/qbid/qualified_business_income_deduction.yaml @@ -376,3 +376,28 @@ # Eligible QBI = 999.97, below $1,000, so no minimum. With the joint # threshold ($403,500) the whole $2,000 would count and give $400. qualified_business_income_deduction: 0 + +# P.L. 115-97 section 11011(e) applies section 199A to taxable years beginning +# after December 31, 2017. The final deduction cap is zero in 2017 even when +# component inputs are positive; the 2018 rate is 20 percent. +- name: Case 1, positive QBI inputs do not create a deduction in 2017. + period: 2017 + absolute_error_margin: 0.01 + input: + qbid_amount: 20_000 + qualified_business_income: 100_000 + taxable_income_less_qbid: 100_000 + section_199a_net_capital_gain: 0 + output: + qualified_business_income_deduction: 0 + +- name: Case 2, section 199A takes effect for the same inputs in 2018. + period: 2018 + absolute_error_margin: 0.01 + input: + qbid_amount: 20_000 + qualified_business_income: 100_000 + taxable_income_less_qbid: 100_000 + section_199a_net_capital_gain: 0 + output: + qualified_business_income_deduction: 20_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/taxable_income_deductions_if_not_itemizing.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/taxable_income_deductions_if_not_itemizing.yaml new file mode 100644 index 00000000000..c57189b3287 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/taxable_income_deductions_if_not_itemizing.yaml @@ -0,0 +1,29 @@ +# 2017 Form 1040 deducts tuition and fees at line 34 before AGI, while +# line 40 includes the standard deduction. Form 1040 has no second tuition +# deduction after AGI. https://www.irs.gov/pub/irs-prior/f1040--2017.pdf +# The 2018 Schedule 1 likewise takes tuition and fees before Form 1040 AGI. +# https://www.irs.gov/pub/irs-prior/f1040s1--2018.pdf + +- name: Case 1, 2017 tuition and fees are not deducted again after AGI. + period: 2017 + absolute_error_margin: 0.01 + input: + standard_deduction: 6_350 + tuition_and_fees_deduction: 4_000 + qualified_business_income_deduction: 0 + tip_income_deduction: 0 + overtime_income_deduction: 0 + output: + taxable_income_deductions_if_not_itemizing: 6_350 + +- name: Case 2, 2018 tuition and fees remain an above the line deduction. + period: 2018 + absolute_error_margin: 0.01 + input: + standard_deduction: 12_000 + tuition_and_fees_deduction: 4_000 + qualified_business_income_deduction: 0 + tip_income_deduction: 0 + overtime_income_deduction: 0 + output: + taxable_income_deductions_if_not_itemizing: 12_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml new file mode 100644 index 00000000000..796e31c7b9f --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml @@ -0,0 +1,142 @@ +# IRS 2017 Form 1040 instructions, PDF page 41, Deduction for Exemptions +# Worksheet lines 2-9: $4,050 per exemption, reduced 2% for each $2,500 +# ($1,250 MFS) or fraction by which AGI exceeds the filing-status threshold. +# https://www.irs.gov/pub/irs-prior/i1040gi--2017.pdf#page=41 + +- name: Case 1, single filer exactly at the 2017 phaseout threshold. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: 261_500 + exemptions_count: 1 + output: + exemptions: 4_050 + +- name: Case 2, the first dollar above the 2017 threshold takes one full step. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: 261_501 + exemptions_count: 1 + output: + exemptions: 3_969 # 4,050 * (1 - 0.02). + +- name: Case 3, exactly one 2017 phaseout step retains 98 percent. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: 264_000 + exemptions_count: 1 + output: + exemptions: 3_969 + +- name: Case 4, one dollar into the second 2017 step retains 96 percent. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: 264_001 + exemptions_count: 1 + output: + exemptions: 3_888 + +- name: Case 5, separate filers round the first partial 1250 dollar step up. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SEPARATE + adjusted_gross_income: 156_901 + exemptions_count: 1 + output: + exemptions: 3_969 + +- name: Case 6, separate filers round a partial second step up. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SEPARATE + adjusted_gross_income: 158_151 + exemptions_count: 1 + output: + exemptions: 3_888 + +- name: Case 7, a joint return reduces both exemptions by the first full step. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: JOINT + adjusted_gross_income: 313_801 + exemptions_count: 2 + output: + exemptions: 7_938 # 8,100 * 0.98. + +- name: Case 8, the head of household threshold rounds a partial step up. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: HEAD_OF_HOUSEHOLD + adjusted_gross_income: 287_651 + exemptions_count: 2 + output: + exemptions: 7_938 + +- name: Case 9, the surviving spouse threshold rounds a partial step up. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SURVIVING_SPOUSE + adjusted_gross_income: 313_801 + exemptions_count: 2 + output: + exemptions: 7_938 + +- name: Case 10, exactly 49 steps retain the final two percent. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: 384_000 + exemptions_count: 1 + output: + exemptions: 81 + +- name: Case 11, a fraction of the fiftieth step removes the exemption. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: 384_001 + exemptions_count: 1 + output: + exemptions: 0 + +- name: Case 12, negative AGI preserves the full 2017 exemption. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + adjusted_gross_income: -1_000 + exemptions_count: 1 + output: + exemptions: 4_050 + +- name: Case 13, the exemption deduction remains suspended in 2018. + period: 2018 + absolute_error_margin: 0.01 + input: + adjusted_gross_income: 50_000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Case 14, the exemption deduction remains suspended in 2026. + period: 2026 + absolute_error_margin: 0.01 + input: + adjusted_gross_income: 50_000 + exemptions_count: 2 + output: + exemptions: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/alternative_minimum_tax/amt_tax_including_cg.yaml b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/alternative_minimum_tax/amt_tax_including_cg.yaml index b89b41f7e71..8000dc04320 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/alternative_minimum_tax/amt_tax_including_cg.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/alternative_minimum_tax/amt_tax_including_cg.yaml @@ -377,3 +377,24 @@ # Line 20 = 0, line 21 = 48,350, line 22 = 211,900, line 23 = 48,350, # line 24 = 163,550, line 30 = 163,550, line 31 = 24,532.50. amt_tax_including_cg: 24_532.50 + +# 2017 Form 6251, PDF page 2, Part III: ordinary AMTI uses the $187,800 +# 26% bracket, preferential gain uses the $37,950 single-filer 0% band, +# and unrecaptured section 1250 gain uses 25% at line 61. +# https://www.irs.gov/pub/irs-prior/f6251--2017.pdf#page=2 +- name: Case 1, the 2017 AMT capital gains worksheet retains the 25 percent rate. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + amt_income_less_exemptions: 1_000_000 + dwks10: 500_000 + dwks13: 300_000 + dwks14: 0 + dwks19: 0 + unrecaptured_section_1250_gain: 200_000 + output: + # Ordinary tax: 187,800 * .26 + 312,200 * .28 = 136,244. + # Preferential tax: (300,000 - 37,950) * .15 = 39,307.50. + # Section 1250 tax: 200,000 * .25 = 50,000. + amt_tax_including_cg: 225_551.50 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/capital_gains/capital_gains_tax.yaml b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/capital_gains/capital_gains_tax.yaml index 084494fff14..777323c90e8 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/capital_gains/capital_gains_tax.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/capital_gains/capital_gains_tax.yaml @@ -186,6 +186,25 @@ income_tax_main_rates: 69_034.75 capital_gains_tax: 13_250 +# 2017 Schedule D Tax Worksheet, PDF page 16, lines 38 and 41 use 25% +# for unrecaptured section 1250 gain and 28% for the remaining rate gain. +# https://www.irs.gov/pub/irs-prior/i1040sd--2017.pdf#page=16 +- name: Case 1, 2017 special capital gains retain their 25 and 28 percent rates. + period: 2017 + absolute_error_margin: 0.01 + input: + filing_status: SINGLE + taxable_income: 500_000 + net_capital_gain: 20_000 + adjusted_net_capital_gain: 0 + capital_gains_28_percent_rate_gain: 10_000 + unrecaptured_section_1250_gain: 10_000 + foreign_earned_income_exclusion: 0 + output: + # The $480,000 ordinary portion fills the brackets below 25%. + # Special-gain tax = 10,000 * 0.25 + 10,000 * 0.28. + capital_gains_tax: 5_300 + - name: 2026, losses move gain from 28 and 25 percent (Axiom companion N10) absolute_error_margin: 0.01 period: 2026 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml index 6cb536051a3..cb520ef6cc8 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml @@ -41,3 +41,1086 @@ income_tax_before_refundable_credits: 9_000 self_employment_tax: 200 household_tax_before_refundable_credits: 9_700 + +# Historical reference cases: Tax-Calculator 6.9.1 +# Records use exact_calculations=True, no aging, weights or growth factors. +# Wages only; credit_claim_urn=0 enforces full eligible-credit receipt. +# Employee payroll = ptax_was/2 + ptax_amc (Additional Medicare is employee-only). +# IRS 2017 Form 1040 instructions: https://www.irs.gov/pub/irs-prior/i1040gi--2017.pdf +# Oracle policy/inputs: https://taxcalc.pslmodels.org/guide/policy-params/ + +- name: Case 3, 2017 single wages matches the independent tax reference. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 6350.0 + exemptions: 4050.0 + taxable_income: 29600.0 + income_tax_before_credits: 3973.75 + eitc: 0.0 + income_tax: 3973.75 + employee_payroll_tax: 3060.0 + +- name: Case 4, 2017 parent eitc matches the independent tax reference. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 9350.0 + exemptions: 8100.0 + taxable_income: 2550.0 + income_tax_before_credits: 255.0 + eitc: 3134.732 + income_tax: -3879.732 + employee_payroll_tax: 1530.0 + +- name: Case 5, 2017 joint children matches the independent tax reference. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12700.0 + exemptions: 16200.0 + taxable_income: 11100.0 + income_tax_before_credits: 1110.0 + eitc: 2231.658 + income_tax: -3121.658 + employee_payroll_tax: 3060.0 + +- name: Case 6, 2017 joint ctc phaseout matches the independent tax reference. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 12700.0 + exemptions: 16200.0 + taxable_income: 91101.0 + income_tax_before_credits: 14252.75 + eitc: 0.0 + income_tax: 12802.75 + employee_payroll_tax: 9180.0765 + +- name: Case 7, 2017 single exemption phaseout matches the independent tax reference. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 6350.0 + exemptions: 2753.9999999999995 + taxable_income: 290897.0 + income_tax_before_credits: 79395.26000000001 + eitc: 0.0 + income_tax: 79395.26000000001 + employee_payroll_tax: 13136.423499999999 + +- name: Case 8, 2017 joint two earners matches the independent tax reference. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 12700.0 + exemptions: 16200.0 + taxable_income: 41100.0 + income_tax_before_credits: 5232.5 + eitc: 0.0 + income_tax: 3232.5 + employee_payroll_tax: 5355.0 + +- name: Case 9, 2018 single wages matches the independent tax reference. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12000.0 + exemptions: 0.0 + taxable_income: 28000.0 + income_tax_before_credits: 3169.5 + eitc: 0.0 + income_tax: 3169.5 + employee_payroll_tax: 3060.0 + +- name: Case 10, 2018 parent eitc matches the independent tax reference. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 18000.0 + exemptions: 0.0 + taxable_income: 2000.0 + income_tax_before_credits: 200.0 + eitc: 3253.26 + income_tax: -4653.26 + employee_payroll_tax: 1530.0 + +- name: Case 11, 2018 joint children matches the independent tax reference. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 24000.0 + exemptions: 0.0 + taxable_income: 16000.0 + income_tax_before_credits: 1600.0 + eitc: 2430.64 + income_tax: -4830.639999999999 + employee_payroll_tax: 3060.0 + +- name: Case 12, 2018 joint ctc phaseout matches the independent tax reference. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 24000.0 + exemptions: 0.0 + taxable_income: 96001.0 + income_tax_before_credits: 12999.22 + eitc: 0.0 + income_tax: 8999.22 + employee_payroll_tax: 9180.0765 + +- name: Case 13, 2018 single exemption phaseout matches the independent tax reference. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 12000.0 + exemptions: 0.0 + taxable_income: 288001.0 + income_tax_before_credits: 76489.85 + eitc: 0.0 + income_tax: 76489.85 + employee_payroll_tax: 13210.8235 + +- name: Case 14, 2018 joint two earners matches the independent tax reference. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 24000.0 + exemptions: 0.0 + taxable_income: 46000.0 + income_tax_before_credits: 5139.0 + eitc: 0.0 + income_tax: 1139.0 + employee_payroll_tax: 5355.0 + +- name: Case 15, 2021 single wages matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12550.0 + exemptions: 0.0 + taxable_income: 27450.0 + income_tax_before_credits: 3095.0 + eitc: 0.0 + income_tax: 1695.0 + employee_payroll_tax: 3060.0 + +- name: Case 16, 2021 parent eitc matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 18800.0 + exemptions: 0.0 + taxable_income: 1200.0 + income_tax_before_credits: 120.0 + eitc: 3541.296 + income_tax: -9221.296 + employee_payroll_tax: 1530.0 + +- name: Case 17, 2021 joint children matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 25100.0 + exemptions: 0.0 + taxable_income: 14900.0 + income_tax_before_credits: 1490.0 + eitc: 2919.982 + income_tax: -13029.982 + employee_payroll_tax: 3060.0 + +- name: Case 18, 2021 joint ctc phaseout matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 25100.0 + exemptions: 0.0 + taxable_income: 94901.0 + income_tax_before_credits: 12375.22 + eitc: 0.0 + income_tax: 775.2199999999993 + employee_payroll_tax: 9180.0765 + +- name: Case 19, 2021 single exemption phaseout matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 12550.0 + exemptions: 0.0 + taxable_income: 287451.0 + income_tax_before_credits: 75152.1 + eitc: 0.0 + income_tax: 75152.1 + employee_payroll_tax: 14103.6235 + +- name: Case 20, 2021 joint two earners matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 25100.0 + exemptions: 0.0 + taxable_income: 44900.0 + income_tax_before_credits: 4990.0 + eitc: 0.0 + income_tax: -6610.0 + employee_payroll_tax: 5355.0 + +- name: Case 21, 2026 single wages matches the independent tax reference. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 16100.0 + exemptions: 0.0 + taxable_income: 23900.0 + income_tax_before_credits: 2620.0 + eitc: 0.0 + income_tax: 2620.0 + employee_payroll_tax: 3060.0 + +- name: Case 22, 2026 parent eitc matches the independent tax reference. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 24150.0 + exemptions: 0.0 + taxable_income: 0.0 + income_tax_before_credits: 0.0 + eitc: 4427.0 + income_tax: -6127.0 + employee_payroll_tax: 1530.0 + +- name: Case 23, 2026 joint children matches the independent tax reference. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 32200.0 + exemptions: 0.0 + taxable_income: 7800.0 + income_tax_before_credits: 780.0 + eitc: 5454.296 + income_tax: -8854.296 + employee_payroll_tax: 3060.0 + +- name: Case 24, 2026 joint ctc phaseout matches the independent tax reference. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 32200.0 + exemptions: 0.0 + taxable_income: 87801.0 + income_tax_before_credits: 10040.119999999999 + eitc: 0.0 + income_tax: 5640.119999999999 + employee_payroll_tax: 9180.0765 + +- name: Case 25, 2026 single exemption phaseout matches the independent tax reference. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 16100.0 + exemptions: 0.0 + taxable_income: 283901.0 + income_tax_before_credits: 68134.6 + eitc: 0.0 + income_tax: 68134.6 + employee_payroll_tax: 16689.0235 + +- name: Case 26, 2026 joint two earners matches the independent tax reference. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 32200.0 + exemptions: 0.0 + taxable_income: 37800.0 + income_tax_before_credits: 4040.0 + eitc: 0.0 + income_tax: -360.0 + employee_payroll_tax: 5355.0 diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/exemptions/exemptions.py b/policyengine_us/variables/gov/irs/income/taxable_income/exemptions/exemptions.py index 470e8af3662..98e97873b66 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/exemptions/exemptions.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/exemptions/exemptions.py @@ -8,6 +8,10 @@ class exemptions(Variable): definition_period = YEAR documentation = "Personal exemptions amount after phase-out" unit = USD + reference = ( + "https://www.law.cornell.edu/uscode/text/26/151#d_3_B", + "https://www.irs.gov/pub/irs-prior/i1040gi--2017.pdf#page=41", + ) def formula(tax_unit, period, parameters): # calculate exemptions amount before phase-out @@ -21,6 +25,6 @@ def formula(tax_unit, period, parameters): agi = tax_unit("adjusted_gross_income", period) excess_agi = max_(0, agi - phase_out_start_agi) phase_out_step_size = p.phase_out.step_size[filing_status] - steps = excess_agi / phase_out_step_size + steps = np.ceil(excess_agi / phase_out_step_size) phase_out_fraction = steps * p.phase_out.rate return max_(0, amount * (1 - phase_out_fraction)) From 1d02a7726905fc1247db019e4c3ac1559fccf293 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 12 Nov 2026 14:59:41 -0500 Subject: [PATCH 2/5] Validate federal tax history continuously from 2017 through 2026 --- changelog.d/federal-tax-2017-history.fixed.md | 2 +- docs/gov/irs/historical-validation.md | 104 + .../ctc/adult_ssn_requirement_applies.yaml | 3 + .../ctc/child_ssn_requirement_applies.yaml | 5 + .../ctc/refundable/social_security/add.yaml | 8 + .../refundable/social_security/subtract.yaml | 4 + .../retirement_saving/age_threshold.yaml | 3 + .../retirement_saving/contributions_cap.yaml | 3 + .../retirement_saving/distributions.yaml | 6 + ...fied_retirement_savings_contributions.yaml | 12 + .../credits/retirement_saving/rate/joint.yaml | 12 + .../rate/threshold_adjustment.yaml | 7 + .../dependent/additional_earned_income.yaml | 2 + .../deductions/standard/dependent/amount.yaml | 3 + .../reduction_amount.yaml | 8 + .../catch_up/age_threshold.yaml | 4 + .../catch_up/limit/ira.yaml | 3 + .../catch_up/limit/k401.yaml | 18 + .../retirement_contributions/limit/401k.yaml | 3 + .../limit/annual_additions.yaml | 3 + .../retirement_contributions/limit/ira.yaml | 3 + .../limit/traditional_ira_age.yaml | 13 + policyengine_us/programs.yaml | 8 +- .../test_federal_tax_history_reference.py | 90 + ...est_federal_2017_tax_history_properties.py | 148 ++ .../gov/irs/credits/cdcc/cdcc_limit.yaml | 7 + .../cdcc/cdcc_qualified_care_expenses.yaml | 65 + .../credits/cdcc/cdcc_relevant_expenses.yaml | 76 + .../dependent_care_assistance_exclusion.yaml | 336 +++- .../ctc_child_individual_maximum.yaml | 80 + ...ctc_child_identification_requirements.yaml | 82 + .../refundable/ctc_social_security_tax.yaml | 39 + .../savers_credit_eligible_person.yaml | 11 + .../savers_credit_person.yaml | 203 ++ ...savers_credit_qualified_contributions.yaml | 33 + .../standard/basic_standard_deduction.yaml | 179 ++ ...capped_qualified_tuition_expenses_ald.yaml | 124 ++ .../taxable_dependent_care_benefits.yaml | 17 +- .../overtime_income_deduction.yaml | 178 ++ .../tip_income/tip_income_deduction.yaml | 186 ++ .../taxable_income/exemptions/exemptions.yaml | 56 + .../irs/tax/federal_income/integration.yaml | 1702 ++++++++++++++++- .../person/is_qualifying_child_dependent.yaml | 24 + .../retirement/elective_deferral_limit.yaml | 165 ++ .../retirement/ira_contribution_limit.yaml | 155 ++ ...f_employed_pension_contribution_limit.yaml | 98 + .../traditional_ira_contributions.yaml | 139 ++ .../tests/test_ira_formula_differential.py | 98 + .../generate_federal_tax_history_reference.py | 294 +++ .../cdcc/cdcc_qualified_care_expenses.py | 22 + .../credits/cdcc/cdcc_relevant_expenses.py | 21 +- .../dependent_care_assistance_exclusion.py | 11 +- ...s_ctc_child_identification_requirements.py | 8 +- .../dependent_traditional_ira_deduction.py | 4 +- .../ira/traditional_ira_deduction.py | 5 +- .../retirement/_ira_supplied_contributions.py | 4 +- .../retirement/ira_contribution_limit.py | 4 +- .../retirement/ira_contribution_scale.py | 5 +- .../traditional_ira_age_eligible.py | 17 + .../traditional_ira_contributions.py | 5 +- 60 files changed, 4849 insertions(+), 79 deletions(-) create mode 100644 docs/gov/irs/historical-validation.md create mode 100644 policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/traditional_ira_age.yaml create mode 100644 policyengine_us/tests/code_health/test_federal_tax_history_reference.py create mode 100644 policyengine_us/tests/core/test_federal_2017_tax_history_properties.py create mode 100644 policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml create mode 100644 policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml create mode 100644 policyengine_us/tools/taxsim/generate_federal_tax_history_reference.py create mode 100644 policyengine_us/variables/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.py create mode 100644 policyengine_us/variables/household/expense/retirement/traditional_ira_age_eligible.py diff --git a/changelog.d/federal-tax-2017-history.fixed.md b/changelog.d/federal-tax-2017-history.fixed.md index 82086510990..8016896b61b 100644 --- a/changelog.d/federal-tax-2017-history.fixed.md +++ b/changelog.d/federal-tax-2017-history.fixed.md @@ -1 +1 @@ -Correct personal-exemption phase-out steps and duplicate tuition deductions, and add explicit 2017 federal tax histories. +Correct 2017 personal-exemption phase-outs, tuition deduction accounting, CTC identification, retirement limits and Saver's Credit histories. Apply the pre-2020 traditional IRA age limit, cap dependent-care exclusions by qualified expenses, and prevent expense reuse in the care credit. Add annual federal tax reference cases for 2017–2026. diff --git a/docs/gov/irs/historical-validation.md b/docs/gov/irs/historical-validation.md new file mode 100644 index 00000000000..32f040c1f87 --- /dev/null +++ b/docs/gov/irs/historical-validation.md @@ -0,0 +1,104 @@ +# Historical federal tax validation + +The federal tax reference tests compare PolicyEngine with Tax-Calculator 6.9.1 for six hypothetical filing units in every year from 2017 through 2026. All 60 cases agree within $0.01 on eight outputs: adjusted gross income, standard deduction, personal exemptions, taxable income, income tax before credits, EITC, income tax after credits, and employee payroll tax. The [integration file](../../../policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml) contains these cases alongside two existing tests. + +## Household coverage and assumptions + +Each year uses the same wages, ages and family composition. These examples do not age a cohort or use survey records. + +| Filing status | Annual wages, by adult | Children's ages | +| --- | --- | --- | +| Single | $40,000 | None | +| Head of household | $20,000 | 8 | +| Married filing jointly | $40,000; $0 | 8, 12 | +| Married filing jointly | $120,001; $0 | 8, 12 | +| Single | $300,001 | None | +| Married filing jointly | $35,000; $35,000 | 8, 12 | + +The head is 35 and the spouse, where present, is 33. The cases assume full receipt of eligible credits, wages as the only income source, and no itemized expenses. PolicyEngine uses Texas and explicitly sets ACA premium tax credits and state sales tax to zero. The comparison covers federal taxes only. + +Tax-Calculator uses the policy year as the records' start year, with no growth factors, weights or adjustment ratios. Its `exact_calculations=True` option preserves statutory steps rather than smoothing them. It does not reproduce every IRS Tax Table, EITC table or filing-rounding convention. The income-tax mapping uses `soi_iitax=False`; employee payroll tax equals `ptax_was / 2 + ptax_amc`, because ordinary wage FICA includes both shares while Additional Medicare Tax falls on the employee. The [generator](../../../policyengine_us/tools/taxsim/generate_federal_tax_history_reference.py) enforces these assumptions against the pinned [Tax-Calculator source](https://github.com/PSLmodels/Tax-Calculator/releases/tag/6.9.1). + +For 2020 and 2021, income tax includes annual Recovery Rebate Credit entitlement. These examples do not subtract advance payments and therefore do not represent the balance due or refund on a filed return. + +## Reproducing the independent reference + +From the repository root, run the standalone generator in a separate environment: + +```sh +uv run --no-project --isolated --with taxcalc==6.9.1 python \ + policyengine_us/tools/taxsim/generate_federal_tax_history_reference.py \ + --output federal-tax-history-reference.json +``` + +This command keeps Tax-Calculator out of the model's environment. The generator imports no PolicyEngine runtime, requires a new JSON output path, checks the Tax-Calculator version and five source-file hashes, and records all synthetic inputs, outputs and dependency versions. It also rejects gaps in 2017–2026 coverage. [Tooling tests](../../../policyengine_us/tests/code_health/test_federal_tax_history_reference.py) check these guards. + +## Disposition of the 35 date flags + +A frozen 2017 parameter trace identified 35 IRS parameter paths whose available histories began after 2017. A later first date alone does not establish an incorrect tax calculation: a constant can remain valid, a later provision can have an effective-date gate, and a parent node can overlap its leaf. The table accounts for all 35 paths. It does not count distinct laws or estimate the share of tax law that the model implements. + +Every path below has the prefix `gov.irs.`. “Explicit 2017” means the parameter now has a source-linked 2017 entry; it does not necessarily mean its calculated value changed. + +| Parameter path | Disposition for 2017 | Primary evidence | +| --- | --- | --- | +| `capital_gains.other_cg_rate` | Explicit 2017 rate of 28%; the previous backfilled value matched. | [Schedule D instructions, p. 16][schedule-d] | +| `capital_gains.unrecaptured_s_1250_rate` | Explicit 2017 rate of 25%; the previous value matched. | [Schedule D instructions, p. 16][schedule-d] | +| `credits.ctc.adult_ssn_requirement_applies` | Explicit false; no special SSN-only requirement in 2017. This does not remove the filer's TIN requirement. | [Publication 972, p. 3][ctc] | +| `credits.ctc.child_ssn_requirement_applies` | Corrected to false in 2017; the formula requires a valid TIN. The restricted SSN branch begins in 2018. | [IRC 24(e), (h)][section-24]; [Publication 972][ctc] | +| `credits.ctc.eligible_ssn_card_type` | No change; the restricted list does not govern the 2017 child-TIN branch. | [IRC 24(e), (h)][section-24] | +| `credits.ctc.refundable.social_security.add` | Explicit 2017 payroll-component list; the previous components matched. | [Schedule 8812, p. 2][actc] | +| `credits.ctc.refundable.social_security.subtract` | Explicit 2017 excess-withholding list; the formula subtracts EITC separately. | [Schedule 8812, p. 2][actc] | +| `credits.retirement_saving.age_threshold` | Explicit age 18; the previous value matched. | [Form 8880][saver] | +| `credits.retirement_saving.contributions_cap` | Explicit $2,000; the previous value matched. | [Form 8880, line 6][saver] | +| `credits.retirement_saving.distributions` | Corrected 2017 list excludes ABLE distributions; the 2018 list remains. | [Form 8880][saver]; [P.L. 115-97, §11024][tcja] | +| `credits.retirement_saving.qualified_retirement_savings_contributions` | Corrected 2017 list excludes ABLE contributions; the 2018 list remains. | [Form 8880][saver]; [P.L. 115-97, §11024][tcja] | +| `credits.retirement_saving.rate.joint` | Corrected 2017 joint band tops: $37,000, $40,000 and $62,000. | [Form 8880, line 9][saver] | +| `credits.retirement_saving.rate.threshold_adjustment` | Explicit multipliers: joint 1, head of household 0.75, other statuses 0.5. The previous values matched. | [Form 8880, line 9][saver] | +| `deductions.deductions_if_itemizing` | Explicit 2017 composition; QBI, tips and overtime retain their own effective-date gates. | [Form 1040, line 40][form-1040] | +| `deductions.deductions_if_not_itemizing` | Removed a second tuition deduction after AGI; the existing adjustment already deducts tuition before AGI. | [Form 1040, lines 34, 37, 40][form-1040]; [IRC 62(a)(18)][section-62] | +| `deductions.itemized.charity.non_itemizers_amount` | Explicit zero for every filing status; the previous values matched. | [Form 1040, line 40][form-1040] | +| `deductions.itemized_deductions` | Explicit 2017 modeled component list; no component change. | [Schedule A instructions][schedule-a] | +| `deductions.overtime_income.eligible_ssn_card_type` | No list change; the deduction's effective-date gate excludes 2017 and begins in 2025. | [P.L. 119-21, §70202][obbba] | +| `deductions.qbi.deduction_definition` | No change; the existing maximum rate makes the final deduction zero in 2017. Section 199A begins in 2018. | [P.L. 115-97, §11011(e)][tcja] | +| `deductions.qbi.income_definition` | Same effective-date disposition; reading components does not create a 2017 deduction. | [P.L. 115-97, §11011(e)][tcja] | +| `deductions.standard.dependent.amount` | Explicit $1,050; the previous value matched. The earned-income addition remains $350, subject to the ordinary cap. | [Form 1040 instructions, p. 39][instructions-1040] | +| `deductions.tip_income.eligible_ssn_card_type` | No list change; the deduction's effective-date gate excludes 2017 and begins in 2025. | [P.L. 119-21, §70201][obbba] | +| `dependent.ineligible_age.non_student` | No change; current history already supplies the under-19 boundary from 1954. Added a 2017 boundary test. | [Form 1040 instructions, p. 17][instructions-1040] | +| `dependent.ineligible_age.student` | No change; current history already supplies the under-24 boundary from 1989. Added a 2017 boundary test. | [Form 1040 instructions, p. 17][instructions-1040] | +| `gross_income.dependent_care_assistance_programs.reduction_amount` | Explicit 2017 caps: $5,000, or $2,500 for married filing separately. The previous values matched. | [Form 2441, line 21][dcap] | +| `gross_income.dependent_care_assistance_programs.reduction_amount.SINGLE` | Same $5,000 cap; this leaf overlaps the preceding parent node. | [Form 2441, line 21][dcap] | +| `gross_income.retirement_contributions.catch_up.age_threshold` | Explicit age 50; the previous value matched. | [Notice 2016-62][retirement-limits] | +| `gross_income.retirement_contributions.catch_up.limit.ira` | Explicit $1,000; the previous value matched. | [Notice 2016-62][retirement-limits] | +| `gross_income.retirement_contributions.catch_up.limit.k401` | Explicit $6,000 for age 50 and older; the previous values matched. | [Notice 2016-62][retirement-limits] | +| `gross_income.retirement_contributions.limit.401k` | Corrected 2017 elective-deferral limit to $18,000. | [Notice 2016-62][retirement-limits] | +| `gross_income.retirement_contributions.limit.annual_additions` | Corrected 2017 annual-additions limit to $54,000. | [Notice 2016-62][retirement-limits] | +| `gross_income.retirement_contributions.limit.ira` | Explicit $5,500; the previous value matched. | [Notice 2016-62][retirement-limits] | +| `income.amt.capital_gains.capital_gain_excess_tax_rate` | Explicit 25%; the previous value matched. | [Form 6251, line 61][amt] | +| `income.amt.deductions_add_back` | Explicit empty general list; separate itemized addbacks still apply. | [Form 6251, Part I][amt] | +| `income.exemption.traditional_distribution.age_threshold` | No change to 59.5. Only state retirement-deduction formulas call this parameter; federal validation does not cover those callers. | [Publication 590-B, p. 24][ira-distributions] | + +## Additional rule tests and limits + +Focused tests also cover the [personal-exemption phaseout](../../../policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml): a partial step triggers the full 2% reduction, as the [2017 worksheet, p. 41][instructions-1040] requires. [Dependent-care tests](../../../policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml) cover the actual qualified-expense ceiling and prevent reuse of excluded employer benefits for the child and dependent care credit, following [Form 2441, Part III][dcap]. [Traditional IRA tests](../../../policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml) cover the age-70.5 restriction through 2019 and its removal from 2020, following [Publication 590-A][ira-contributions] and [P.L. 116-94, Division O, §107][secure]. + +The 60 wage cases do not exercise every flagged provision. They do not establish complete coverage of itemized deductions, AMT preferences, capital gains, retirement transactions, identification compliance or special filing situations. The TIN input does not encode issuance dates or every identification requirement; aggregate childcare spending cannot distinguish each child's eligible expense share in mixed-age families. Fractional age inputs can express the former IRA age boundary, but integer survey ages do not reconstruct birthdays. + +This validation covers selected federal household calculations. It does not establish historical accuracy for state taxes, benefit programs, household net resources or national 2017 population estimates. Those uses require their own policy-date, input and population checks. + +[schedule-d]: https://www.irs.gov/pub/irs-prior/i1040sd--2017.pdf#page=16 +[ctc]: https://www.irs.gov/pub/irs-prior/p972--2017.pdf#page=3 +[section-24]: https://www.govinfo.gov/content/pkg/USCODE-2017-title26/pdf/USCODE-2017-title26-subtitleA-chap1-subchapA-partIV-subpartA-sec24.pdf#page=2 +[actc]: https://www.irs.gov/pub/irs-prior/f1040s8--2017.pdf#page=2 +[saver]: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 +[tcja]: https://www.govinfo.gov/content/pkg/PLAW-115publ97/pdf/PLAW-115publ97.pdf +[form-1040]: https://www.irs.gov/pub/irs-prior/f1040--2017.pdf +[section-62]: https://www.govinfo.gov/content/pkg/USCODE-2017-title26/pdf/USCODE-2017-title26-subtitleA-chap1-subchapB-partI-sec62.pdf#page=3 +[schedule-a]: https://www.irs.gov/pub/irs-prior/i1040sca--2017.pdf +[instructions-1040]: https://www.irs.gov/pub/irs-prior/i1040gi--2017.pdf +[obbba]: https://www.congress.gov/119/bills/hr1/BILLS-119hr1enr.pdf#page=100 +[dcap]: https://www.irs.gov/pub/irs-prior/f2441--2017.pdf#page=2 +[retirement-limits]: https://www.irs.gov/pub/irs-drop/n-16-62.pdf +[amt]: https://www.irs.gov/pub/irs-prior/f6251--2017.pdf +[ira-distributions]: https://www.irs.gov/pub/irs-prior/p590b--2017.pdf#page=24 +[ira-contributions]: https://www.irs.gov/pub/irs-prior/p590a--2017.pdf#page=5 +[secure]: https://www.govinfo.gov/content/pkg/PLAW-116publ94/pdf/PLAW-116publ94.pdf diff --git a/policyengine_us/parameters/gov/irs/credits/ctc/adult_ssn_requirement_applies.yaml b/policyengine_us/parameters/gov/irs/credits/ctc/adult_ssn_requirement_applies.yaml index 6639b957272..b7ffa349f6d 100644 --- a/policyengine_us/parameters/gov/irs/credits/ctc/adult_ssn_requirement_applies.yaml +++ b/policyengine_us/parameters/gov/irs/credits/ctc/adult_ssn_requirement_applies.yaml @@ -1,5 +1,6 @@ description: The IRS requires at least one filer with a valid SSN, and any co-filer with an SSN or ITIN, to claim the child portion of the Child Tax Credit if this is true. values: + 2017-01-01: false 2018-01-01: false 2025-01-01: true metadata: @@ -7,5 +8,7 @@ metadata: period: year label: Child Tax Credit adult identification requirement applies reference: + - title: 2017 Publication 972, Child Tax Credit + href: https://www.irs.gov/pub/irs-prior/p972--2017.pdf#page=3 - title: H.R.1 - One Big Beautiful Bill Act href: https://www.congress.gov/bill/119th-congress/house-bill/1/text diff --git a/policyengine_us/parameters/gov/irs/credits/ctc/child_ssn_requirement_applies.yaml b/policyengine_us/parameters/gov/irs/credits/ctc/child_ssn_requirement_applies.yaml index 0c7ce9ca69f..af1df35353c 100644 --- a/policyengine_us/parameters/gov/irs/credits/ctc/child_ssn_requirement_applies.yaml +++ b/policyengine_us/parameters/gov/irs/credits/ctc/child_ssn_requirement_applies.yaml @@ -1,11 +1,16 @@ description: The IRS requires a Social Security Number for qualifying children for the Child Tax Credit if this is true. values: + 2017-01-01: false 2018-01-01: true metadata: unit: bool period: year label: Child Tax Credit child identification requirement applies reference: + - title: "26 U.S. Code § 24(e)(1), (h)(1) and (7), 2017 edition #page 2-3" + href: https://www.govinfo.gov/content/pkg/USCODE-2017-title26/pdf/USCODE-2017-title26-subtitleA-chap1-subchapA-partIV-subpartA-sec24.pdf#page=2 + - title: 2017 Publication 972, Child Tax Credit + href: https://www.irs.gov/pub/irs-prior/p972--2017.pdf#page=3 - title: 26 U.S. Code § 24(h)(7) href: https://www.law.cornell.edu/uscode/text/26/24#h_7 - title: H.R.1 - One Big Beautiful Bill Act diff --git a/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/add.yaml b/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/add.yaml index 53123c3cadf..54512e91d24 100644 --- a/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/add.yaml +++ b/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/add.yaml @@ -1,5 +1,11 @@ description: The IRS defines social security taxes under the Child Tax Credit to include the following variables. values: + 2017-01-01: + - employee_social_security_tax + - employee_medicare_tax + - self_employment_tax_ald_person + - unreported_payroll_tax + - additional_medicare_tax 2018-01-01: # Person (summed over the head and spouse only): - employee_social_security_tax @@ -13,6 +19,8 @@ metadata: period: year label: Child Tax Credit added social security taxes reference: + - title: 2017 Schedule 8812, Part III, lines 7-9 + href: https://www.irs.gov/pub/irs-prior/f1040s8--2017.pdf#page=2 - title: 26 U.S. Code § 24(d)(2)(A) href: https://www.law.cornell.edu/uscode/text/26/24#d_2_A - title: 2024 Schedule 8812 (Form 1040), Part II-B, lines 21 to 23 diff --git a/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/subtract.yaml b/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/subtract.yaml index 7b547f3f388..20f607ee9be 100644 --- a/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/subtract.yaml +++ b/policyengine_us/parameters/gov/irs/credits/ctc/refundable/social_security/subtract.yaml @@ -1,5 +1,7 @@ description: The IRS defines social security taxes under the Child Tax Credit to exclude the following variables. values: + 2017-01-01: + - excess_payroll_tax_withheld 2018-01-01: - excess_payroll_tax_withheld metadata: @@ -7,5 +9,7 @@ metadata: period: year label: Child Tax Credit subtracted social security taxes reference: + - title: 2017 Schedule 8812, Part III, line 10 + href: https://www.irs.gov/pub/irs-prior/f1040s8--2017.pdf#page=2 - title: 26 U.S. Code § 24(d)(2)(B) href: https://www.law.cornell.edu/uscode/text/26/24#d_2_B diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/age_threshold.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/age_threshold.yaml index 13b7850d7b3..b9cddff2b68 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/age_threshold.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/age_threshold.yaml @@ -1,11 +1,14 @@ description: The IRS limits the saver's credit to taxpayers at or over to following age. values: + 2017-01-01: 18 2018-01-01: 18 metadata: unit: year period: year label: Retirement Savings Contributions Credit (Saver's Credit) age threshold reference: + - title: 2017 Form 8880 + href: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 - title: 26 U.S. Code § 25B(c)(1) href: https://www.law.cornell.edu/uscode/text/26/25B#c - title: IRS | Retirement Savings Contributions Credit (Saver's Credit) diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/contributions_cap.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/contributions_cap.yaml index 923c7853998..8d6674557c8 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/contributions_cap.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/contributions_cap.yaml @@ -1,5 +1,6 @@ description: The IRS caps the qualifying contributions at the following amount under the saver's credit. values: + 2017-01-01: 2_000 2018-01-01: 2_000 2027-01-01: 2_100 metadata: @@ -7,6 +8,8 @@ metadata: period: year label: Saver's Credit contributions cap reference: + - title: 2017 Form 8880 + href: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 - title: 26 U.S. Code § 25B(a) href: https://www.law.cornell.edu/uscode/text/26/25B - title: Public Law 119-21, saver's credit contribution cap from 2027 diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/distributions.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/distributions.yaml index f4a5e62f3b9..9bf7ffaae07 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/distributions.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/distributions.yaml @@ -1,5 +1,7 @@ description: The IRS subtracts these distributions from qualified contributions under the saver's credit. values: + 2017-01-01: + - retirement_distributions # 25B(d)(2)(A) reaches any entity of a type that can take contributions # under 25B(d)(1), so ABLE distributions count for as long as ABLE # contributions do (Form 8880, line 4). @@ -15,6 +17,10 @@ metadata: period: year label: Saver's Credit distributions that reduce qualified contributions reference: + - title: "2017 Form 8880 #page 1-2" + href: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 + - title: Public Law 115-97, section 11024(b)-(c) + href: https://www.govinfo.gov/content/pkg/PLAW-115publ97/pdf/PLAW-115publ97.pdf#page=24 - title: 26 U.S. Code § 25B(d)(2) href: https://www.law.cornell.edu/uscode/text/26/25B#d_2 - title: Public Law 119-21, ABLE contributions in the saver's credit diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/qualified_retirement_savings_contributions.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/qualified_retirement_savings_contributions.yaml index 70d9e8d2835..9fbdae87343 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/qualified_retirement_savings_contributions.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/qualified_retirement_savings_contributions.yaml @@ -1,5 +1,13 @@ description: The IRA sums the following elements as qualified retirement savings contributions when computing the saver's credit. values: + 2017-01-01: + - traditional_ira_contributions + - roth_ira_contributions + - traditional_401k_contributions + - traditional_403b_contributions + - roth_401k_contributions + - roth_403b_contributions + - self_employed_pension_contributions 2018-01-01: - traditional_ira_contributions - roth_ira_contributions @@ -30,6 +38,10 @@ metadata: period: year label: Saver's Credit qualified retirement savings contributions reference: + - title: "2017 Form 8880 #page 1-2" + href: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 + - title: Public Law 115-97, section 11024(b)-(c) + href: https://www.govinfo.gov/content/pkg/PLAW-115publ97/pdf/PLAW-115publ97.pdf#page=24 - title: 26 U.S. Code § 25B - (d) href: https://www.law.cornell.edu/uscode/text/26/25B#d_1 - title: Public Law 119-21, ABLE contributions in the saver's credit diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml index 960058499e1..2e43369376a 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml @@ -6,6 +6,10 @@ metadata: period: year label: Saver's Credit joint rate reference: + - title: 2017 Form 8880 + href: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 + - title: "IRS Notice 2016-62 #page 2-3" + href: https://www.irs.gov/pub/irs-drop/n-16-62.pdf#page=2 - title: 26 U.S. Code § 25B(b)(1) href: https://www.law.cornell.edu/uscode/text/26/25B#b - title: IRS | Retirement Savings Contributions Credit (Saver's Credit) @@ -25,11 +29,14 @@ brackets: # The first row of the Form 8880 line 9 table has no lower bound ("---"), so # a negative adjusted gross income takes the highest rate. - threshold: + 2017-01-01: -.inf 2018-01-01: -.inf amount: + 2017-01-01: 0.5 2018-01-01: 0.5 - threshold: values: + 2017-01-01: 37_001 2018-01-01: 38_001 2019-01-01: 38_501 2020-01-01: 39_001 @@ -40,9 +47,11 @@ brackets: 2025-01-01: 47_501 2026-01-01: 48_501 amount: + 2017-01-01: 0.2 2018-01-01: 0.2 - threshold: values: + 2017-01-01: 40_001 2018-01-01: 41_001 2019-01-01: 41_501 2020-01-01: 42_501 @@ -53,9 +62,11 @@ brackets: 2025-01-01: 51_001 2026-01-01: 52_501 amount: + 2017-01-01: 0.1 2018-01-01: 0.1 - threshold: values: + 2017-01-01: 62_001 2018-01-01: 63_001 2019-01-01: 64_001 2020-01-01: 65_001 @@ -66,4 +77,5 @@ brackets: 2025-01-01: 79_001 2026-01-01: 80_501 amount: + 2017-01-01: 0 2018-01-01: 0 diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/threshold_adjustment.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/threshold_adjustment.yaml index 032e88e834a..22b7867a885 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/threshold_adjustment.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/threshold_adjustment.yaml @@ -5,6 +5,8 @@ metadata: period: year label: Retirement Savings Contributions Credit (Saver's Credit) threshold adjustment rate reference: + - title: 2017 Form 8880 + href: https://www.irs.gov/pub/irs-prior/f8880--2017.pdf#page=1 - title: 26 U.S. Code § 25B(b)(2) href: https://www.law.cornell.edu/uscode/text/26/25B#b - title: IRS | Retirement Savings Contributions Credit (Saver's Credit) @@ -15,12 +17,17 @@ metadata: - filing_status JOINT: + 2017-01-01: 1 2018-01-01: 1 SINGLE: + 2017-01-01: 0.5 2018-01-01: 0.5 SEPARATE: + 2017-01-01: 0.5 2018-01-01: 0.5 HEAD_OF_HOUSEHOLD: + 2017-01-01: 0.75 2018-01-01: 0.75 SURVIVING_SPOUSE: + 2017-01-01: 0.5 2018-01-01: 0.5 diff --git a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml index faf0c3c8fb1..c9432e66ea7 100644 --- a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml @@ -33,6 +33,8 @@ metadata: type: downwards interval: 50 reference: + - title: 2017 Form 1040 instructions, Standard Deduction Worksheet for Dependents + href: https://www.irs.gov/pub/irs-prior/i1040gi--2017.pdf#page=39 - title: 26 U.S. Code § 63(c)(4)-(5) href: https://www.law.cornell.edu/uscode/text/26/63#c_4 - title: 26 U.S. Code § 1(f)(3)-(7) diff --git a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml index d3857ab59a7..08e1026f98e 100644 --- a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml @@ -1,5 +1,6 @@ description: The basic standard deduction of a filer who can be claimed as a dependent is limited to the greater of this amount or earned income plus the earned income addition. values: + 2017-01-01: 1_050 2018-01-01: 1_050 2019-01-01: 1_100 2022-01-01: 1_150 @@ -37,6 +38,8 @@ metadata: type: downwards interval: 50 reference: + - title: 2017 Form 1040 instructions, Standard Deduction Worksheet for Dependents + href: https://www.irs.gov/pub/irs-prior/i1040gi--2017.pdf#page=39 - title: 26 U.S. Code § 63(c)(4)-(5) href: https://www.law.cornell.edu/uscode/text/26/63#c_4 - title: 26 U.S. Code § 1(f)(3)-(7) diff --git a/policyengine_us/parameters/gov/irs/gross_income/dependent_care_assistance_programs/reduction_amount.yaml b/policyengine_us/parameters/gov/irs/gross_income/dependent_care_assistance_programs/reduction_amount.yaml index 028552803a9..9ef598e0628 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/dependent_care_assistance_programs/reduction_amount.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/dependent_care_assistance_programs/reduction_amount.yaml @@ -1,25 +1,30 @@ description: The IRS limits the amount of dependent care assistance excludable from gross income to this amount, based on filing status. SINGLE: + 2017-01-01: 5_000 2018-01-01: 5_000 2021-01-01: 10_500 2022-01-01: 5_000 2026-01-01: 7_500 JOINT: + 2017-01-01: 5_000 2018-01-01: 5_000 2021-01-01: 10_500 2022-01-01: 5_000 2026-01-01: 7_500 SEPARATE: + 2017-01-01: 2_500 2018-01-01: 2_500 2021-01-01: 5_250 2022-01-01: 2_500 2026-01-01: 3_750 HEAD_OF_HOUSEHOLD: + 2017-01-01: 5_000 2018-01-01: 5_000 2021-01-01: 10_500 2022-01-01: 5_000 2026-01-01: 7_500 SURVIVING_SPOUSE: + 2017-01-01: 5_000 2018-01-01: 5_000 2021-01-01: 10_500 2022-01-01: 5_000 @@ -28,8 +33,11 @@ metadata: propagate_metadata_to_children: true breakdown: filing_status unit: currency-USD + period: year label: IRS dependent care assistance exclusion cap reference: + - title: 2017 Form 2441, Part III, line 21 + href: https://www.irs.gov/pub/irs-prior/f2441--2017.pdf#page=2 - title: 26 U.S. Code § 129(a)(2)(A) href: https://www.law.cornell.edu/uscode/text/26/129#a_2_A - title: 26 U.S. Code § 129(a)(2)(D) # Substitutes $10,500 ($5,250 for a separate return) for taxable years beginning in 2021. diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/age_threshold.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/age_threshold.yaml index ed255c327a3..3408bf1ccf8 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/age_threshold.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/age_threshold.yaml @@ -1,10 +1,14 @@ description: The US limits catch-up pension contributions to individuals this age or older. values: 2004-01-01: 50 + 2017-01-01: 50 + 2021-01-01: 50 metadata: unit: year period: year label: Pension contribution catch-up age threshold reference: + - title: 2017 Publication 590-A + href: https://www.irs.gov/pub/irs-prior/p590a--2017.pdf#page=5 - 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 diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/ira.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/ira.yaml index e186cf1c9eb..f4e2c869241 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/ira.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/ira.yaml @@ -1,5 +1,6 @@ description: The US allows for catch-up IRA contributions of this amount. values: + 2017-01-01: 1_000 2018-01-01: 1_000 2024-01-01: 1_000 2025-01-01: 1_000 @@ -14,6 +15,8 @@ metadata: type: downwards interval: 100 reference: + - title: 2017 Publication 590-A + href: https://www.irs.gov/pub/irs-prior/p590a--2017.pdf#page=5 - 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 diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/k401.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/k401.yaml index cd2977c7be7..8e9b61bc639 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/k401.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/catch_up/limit/k401.yaml @@ -4,12 +4,18 @@ brackets: - threshold: values: 2004-01-01: 0 + 2017-01-01: 0 + 2018-01-01: 0 amount: values: 2004-01-01: 0 + 2017-01-01: 0 + 2018-01-01: 0 - threshold: values: 2004-01-01: 50 + 2017-01-01: 50 + 2018-01-01: 50 amount: values: 2004-01-01: 3_000 @@ -17,6 +23,8 @@ brackets: 2006-01-01: 5_000 2009-01-01: 5_500 2015-01-01: 6_000 + 2017-01-01: 6_000 + 2018-01-01: 6_000 2020-01-01: 6_500 2023-01-01: 7_500 2024-01-01: 7_500 @@ -31,6 +39,8 @@ brackets: - threshold: values: 2004-01-01: 60 + 2017-01-01: 60 + 2018-01-01: 60 amount: values: 2004-01-01: 3_000 @@ -38,6 +48,8 @@ brackets: 2006-01-01: 5_000 2009-01-01: 5_500 2015-01-01: 6_000 + 2017-01-01: 6_000 + 2018-01-01: 6_000 2020-01-01: 6_500 2023-01-01: 7_500 2024-01-01: 7_500 @@ -54,6 +66,8 @@ brackets: - threshold: values: 2004-01-01: 64 + 2017-01-01: 64 + 2018-01-01: 64 amount: values: 2004-01-01: 3_000 @@ -61,6 +75,8 @@ brackets: 2006-01-01: 5_000 2009-01-01: 5_500 2015-01-01: 6_000 + 2017-01-01: 6_000 + 2018-01-01: 6_000 2020-01-01: 6_500 2023-01-01: 7_500 2024-01-01: 7_500 @@ -79,6 +95,8 @@ metadata: amount_period: year label: 401(k) catch-up contribution limit by age reference: + - title: "IRS Notice 2016-62 #page 1-2" + href: https://www.irs.gov/pub/irs-drop/n-16-62.pdf#page=1 - title: 26 CFR 1.414(v)-1(c)(2) - Applicable dollar catch-up limit href: https://www.law.cornell.edu/cfr/text/26/1.414(v)-1#c_2 - title: 26 USC 414(v)(2)(E) - Increased catch-up contribution limit for individuals aged 60-63 diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/401k.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/401k.yaml index 925f7b6f8ca..6e839f9007d 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/401k.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/401k.yaml @@ -8,6 +8,7 @@ values: 2012-01-01: 17_000 2013-01-01: 17_500 2015-01-01: 18_000 + 2017-01-01: 18_000 2018-01-01: 18_500 2019-01-01: 19_000 2020-01-01: 19_500 @@ -26,6 +27,8 @@ metadata: type: downwards interval: 500 reference: + - title: IRS Notice 2016-62 + href: https://www.irs.gov/pub/irs-drop/n-16-62.pdf#page=1 - 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 diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/annual_additions.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/annual_additions.yaml index c192036f571..b3dca82203c 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/annual_additions.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/annual_additions.yaml @@ -1,5 +1,6 @@ description: The US limits annual additions to a defined contribution plan to this amount. values: + 2017-01-01: 54_000 2018-01-01: 55_000 2019-01-01: 56_000 2020-01-01: 57_000 @@ -19,6 +20,8 @@ metadata: type: downwards interval: 1000 reference: + - title: IRS Notice 2016-62 + href: https://www.irs.gov/pub/irs-drop/n-16-62.pdf#page=1 - title: 26 U.S. Code § 415 - Limitations on benefits and contributions under qualified plans href: https://www.law.cornell.edu/uscode/text/26/415 - title: Cost-of-Living Adjustments for Retirement Items diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/ira.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/ira.yaml index 28563cd6df3..e19e75ec228 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/ira.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/ira.yaml @@ -1,5 +1,6 @@ description: The US limits annual IRA contributions to this amount. values: + 2017-01-01: 5_500 2018-01-01: 5_500 2019-01-01: 6_000 2023-01-01: 6_500 @@ -15,6 +16,8 @@ metadata: type: downwards interval: 500 reference: + - title: IRS Notice 2016-62 + href: https://www.irs.gov/pub/irs-drop/n-16-62.pdf#page=3 - title: 26 U.S. Code § 219 - Retirement savings (b)(5)(A) href: https://www.law.cornell.edu/uscode/text/26/219 # Inflation adjusted amounts diff --git a/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/traditional_ira_age.yaml b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/traditional_ira_age.yaml new file mode 100644 index 00000000000..291fa412a18 --- /dev/null +++ b/policyengine_us/parameters/gov/irs/gross_income/retirement_contributions/limit/traditional_ira_age.yaml @@ -0,0 +1,13 @@ +description: The IRS limits traditional IRA contributions to individuals younger than this age at the close of the tax year. +values: + 2017-01-01: 70.5 + 2020-01-01: .inf +metadata: + unit: year + period: year + label: Traditional IRA contribution upper age limit + reference: + - title: 2017 Publication 590-A + href: https://www.irs.gov/pub/irs-prior/p590a--2017.pdf#page=5 + - title: "Public Law 116-94, Division O, section 107(a) and (d) #page 616-617" + href: https://www.govinfo.gov/content/pkg/PLAW-116publ94/pdf/PLAW-116publ94.pdf#page=616 diff --git a/policyengine_us/programs.yaml b/policyengine_us/programs.yaml index 7073cd8b37e..5f63da015eb 100644 --- a/policyengine_us/programs.yaml +++ b/policyengine_us/programs.yaml @@ -14,8 +14,12 @@ programs: coverage: US variable: income_tax parameter_prefix: gov.irs - verified_start_year: 2018 - notes: Validated against NBER TAXSIM for 2022 + verified_start_year: 2017 + notes: >- + Validated against NBER TAXSIM for 2022. Selected wage-only household cases + match Tax-Calculator 6.9.1 for every year from 2017 through 2026, with + source-based historical provision tests. See docs/gov/irs/historical-validation.md + for the validation scope and limitations. - id: state_income_tax name: State income taxes diff --git a/policyengine_us/tests/code_health/test_federal_tax_history_reference.py b/policyengine_us/tests/code_health/test_federal_tax_history_reference.py new file mode 100644 index 00000000000..ef6162de1c4 --- /dev/null +++ b/policyengine_us/tests/code_health/test_federal_tax_history_reference.py @@ -0,0 +1,90 @@ +"""The standalone oracle must reject source and assumption drift without PE.""" + +import importlib.util +import json +import tempfile +import unittest +from pathlib import Path +from types import SimpleNamespace + + +BUILDER = ( + Path(__file__).resolve().parents[2] + / "tools/taxsim/generate_federal_tax_history_reference.py" +) +SPEC = importlib.util.spec_from_file_location("federal_tax_history_reference", BUILDER) +builder = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(builder) + + +class FederalTaxHistoryReferenceTest(unittest.TestCase): + def test_every_year_from_2017_through_2026_is_required(self): + builder.validate_years(range(2017, 2027)) + self.assertEqual(tuple(builder.YEARS), tuple(range(2017, 2027))) + + def test_a_missing_intermediate_year_is_rejected(self): + with self.assertRaisesRegex(RuntimeError, "every year"): + builder.validate_years([2017, 2018, *range(2020, 2027)]) + + def test_shifted_year_endpoints_are_rejected(self): + with self.assertRaisesRegex(RuntimeError, "every year"): + builder.validate_years(range(2016, 2026)) + + def test_duplicate_or_out_of_order_years_are_rejected(self): + with self.assertRaisesRegex(RuntimeError, "every year"): + builder.validate_years([2017, 2018, 2018, *range(2020, 2027)]) + with self.assertRaisesRegex(RuntimeError, "every year"): + builder.validate_years(reversed(range(2017, 2027))) + + def test_original_reference_projection_preserves_its_four_years(self): + reference = { + "cases": ["synthetic"], + "years": {str(year): {"value": year} for year in range(2017, 2027)}, + } + projected = builder.original_reference_subset(reference) + self.assertEqual(list(projected["years"]), ["2017", "2018", "2021", "2026"]) + self.assertEqual(len(reference["years"]), 10) + self.assertEqual(projected["years"]["2021"], {"value": 2021}) + + def test_wrong_version_is_rejected(self): + with self.assertRaisesRegex(RuntimeError, "6.9.1"): + builder.validate_version("0.0.0") + + def test_modified_oracle_source_is_rejected(self): + with tempfile.TemporaryDirectory() as directory: + root = Path(directory) + (root / "source.py").write_text("changed\n") + with self.assertRaisesRegex(RuntimeError, "source.py"): + builder.verify_source_hashes(root, {"source.py": "incorrect"}) + + def test_income_tax_bucket_drift_is_rejected(self): + policy = SimpleNamespace(soi_iitax=[True]) + with self.assertRaisesRegex(RuntimeError, "soi_iitax"): + builder.validate_policy_assumptions(policy) + + def test_unequal_fica_shares_are_rejected(self): + policy = SimpleNamespace( + soi_iitax=[False], + FICA_ss_trt_employer=[0.062], + FICA_ss_trt_employee=[0.061], + FICA_mc_trt_employer=[0.0145], + FICA_mc_trt_employee=[0.0145], + ) + with self.assertRaisesRegex(RuntimeError, "FICA_ss"): + builder.validate_policy_assumptions(policy) + + def test_json_output_does_not_overwrite_an_existing_file(self): + with tempfile.TemporaryDirectory() as directory: + output = Path(directory) / "reference.json" + builder.write_reference(output, {"source": "first"}) + with self.assertRaises(FileExistsError): + builder.write_reference(output, {"source": "second"}) + self.assertEqual(json.loads(output.read_text()), {"source": "first"}) + + def test_output_rejects_a_yaml_path(self): + with self.assertRaisesRegex(ValueError, "JSON"): + builder.write_reference(Path("nonexistent-reference.yaml"), {}) + + +if __name__ == "__main__": + unittest.main() diff --git a/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py b/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py new file mode 100644 index 00000000000..4950befaeef --- /dev/null +++ b/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py @@ -0,0 +1,148 @@ +"""Generated populations check historical federal tax discontinuities. + +The 2017 Form 1040 exemption worksheet, page 41, rounds each partial +$2,500 step upward ($1,250 for separate filers). Thus the deduction stays +constant inside a step and never increases when AGI increases. From 2018 +the deduction remains suspended. These are intended statutory steps. + +Before 2018, IRC 24(e)(1) permits a child's SSN, ITIN or ATIN. Holding a +valid TIN fixed, changing the child's SSN-card category cannot change the +2017 identification result. A child without any TIN does not qualify. + +Each example contains a generated mixed population, which the YAML runner +cannot express. Individual and end-to-end source examples remain in YAML. +""" + +import numpy as np +import pytest +from hypothesis import HealthCheck, given, settings, strategies as st + +from policyengine_us import CountryTaxBenefitSystem, Simulation + +THRESHOLDS_2017 = { + "SINGLE": 261_500, + "JOINT": 313_800, + "SEPARATE": 156_900, + "HEAD_OF_HOUSEHOLD": 287_650, + "SURVIVING_SPOUSE": 313_800, +} +SETTINGS = settings( + max_examples=6, + deadline=None, + derandomize=True, + suppress_health_check=[HealthCheck.too_slow], +) + + +@pytest.fixture(scope="module") +def system(): + return CountryTaxBenefitSystem() + + +@SETTINGS +@given( + st.lists( + st.tuples( + st.sampled_from(list(THRESHOLDS_2017)), + st.integers(1, 6), + st.integers(0, 49), + st.integers(1, 1_249), + ), + min_size=2, + max_size=12, + ) +) +def test_exemption_steps_are_constant_and_nonincreasing(system, cases): + people, units = {}, {} + for i, (status, count, step_index, offset) in enumerate(cases): + step = 1_250 if status == "SEPARATE" else 2_500 + start = THRESHOLDS_2017[status] + step * step_index + incomes = (start, start + offset, start + step) + for j, income in enumerate(incomes): + name = f"person_{i}_{j}" + people[name] = {"age": {2017: 40}} + units[name] = { + "members": [name], + "filing_status": {2017: status}, + "adjusted_gross_income": {2017: income}, + "exemptions_count": {2017: count}, + } + sim = Simulation( + situation={"people": people, "tax_units": units}, tax_benefit_system=system + ) + deductions = sim.calculate("exemptions", 2017).reshape(-1, 3) + counts = np.array([case[1] for case in cases]) + assert np.isfinite(deductions).all() + assert (deductions >= 0).all() + assert (deductions <= 4_050 * counts[:, None]).all() + assert (deductions[:, 0] >= deductions[:, 1]).all() + np.testing.assert_allclose(deductions[:, 1], deductions[:, 2], atol=0.01, rtol=0) + # A statutory reduction is an integer number of 2%-of-exemption steps. + reductions = (4_050 * counts[:, None] - deductions) / (81 * counts[:, None]) + np.testing.assert_allclose(reductions, np.round(reductions), atol=0.0001, rtol=0) + + +@SETTINGS +@given(st.lists(st.booleans(), min_size=2, max_size=16)) +def test_2017_child_identification_uses_tin_instead_of_ssn_category(system, has_tins): + people = {} + expected = [] + for i, has_tin in enumerate(has_tins): + categories = ( + ("CITIZEN", "NON_CITIZEN_VALID_EAD", "OTHER_NON_CITIZEN", "NONE") + if has_tin + else ("NONE",) + ) + for j, category in enumerate(categories): + people[f"person_{i}_{j}"] = { + "age": {2017: 8}, + "has_tin": {2017: has_tin}, + "ssn_card_type": {2017: category}, + } + expected.append(has_tin) + sim = Simulation(situation={"people": people}, tax_benefit_system=system) + np.testing.assert_array_equal( + sim.calculate("meets_ctc_child_identification_requirements", 2017), expected + ) + + +@pytest.mark.parametrize("year", range(2017, 2027)) +@SETTINGS +@given( + st.lists( + st.tuples( + st.integers(0, 20_000), st.integers(0, 30_000), st.integers(0, 100_000) + ), + min_size=2, + max_size=10, + ), +) +def test_employer_care_exclusion_and_credit_do_not_reuse_expenses(system, year, cases): + """Form 2441 Part III reconciles the exclusion with the credit expense base.""" + people, units = {}, {} + for i, (benefits, qualified, earnings) in enumerate(cases): + head, child = f"head_{i}", f"child_{i}" + people[head] = { + "age": {year: 35}, + "is_tax_unit_head": {year: True}, + "dependent_care_employer_benefits": {year: benefits}, + } + people[child] = {"age": {year: 8}, "is_tax_unit_dependent": {year: True}} + units[f"unit_{i}"] = { + "members": [head, child], + "filing_status": {year: "SINGLE"}, + "cdcc_qualified_care_expenses": {year: qualified}, + "min_head_spouse_earned": {year: earnings}, + } + sim = Simulation( + situation={"people": people, "tax_units": units}, tax_benefit_system=system + ) + exclusion = sim.calculate("dependent_care_assistance_exclusion", year) + remaining = sim.calculate("cdcc_relevant_expenses", year) + benefits, qualified, earnings = np.array(cases).T + assert np.isfinite(exclusion).all() and np.isfinite(remaining).all() + assert (exclusion >= 0).all() and (remaining >= 0).all() + assert (exclusion <= benefits + 0.01).all() + assert (exclusion <= earnings + 0.01).all() + assert (remaining <= earnings + 0.01).all() + assert (exclusion + remaining <= qualified + 0.01).all() diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml index b5d26889b01..84bbbf47514 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml @@ -67,6 +67,7 @@ tax_unit: members: [person1, person2, person3] filing_status: SEPARATE + tax_unit_childcare_expenses: 5_000 output: dependent_care_assistance_exclusion: 4_000 # $6,000 - $4,000 = $2,000. @@ -77,6 +78,7 @@ - name: Two children with $12,000 benefits keep a $1,000 limit in 2020 period: 2020 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 @@ -89,6 +91,7 @@ - name: Two children with $12,000 benefits keep a $5,500 limit in 2021 period: 2021 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 @@ -101,6 +104,7 @@ - name: Two children with $12,000 benefits return to a $1,000 limit in 2022 period: 2022 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 @@ -113,6 +117,7 @@ - name: Two children with $7,000 benefits have no remaining limit in 2026 period: 2026 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 7_000 @@ -139,6 +144,7 @@ tax_unit: members: [head, child1, child2] filing_status: SEPARATE + tax_unit_childcare_expenses: 12_000 output: cdcc_treated_as_unmarried: true dependent_care_assistance_exclusion: 10_500 @@ -147,6 +153,7 @@ - name: The 2021 earned-income limit also controls the CDCC limit reduction period: 2021 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml new file mode 100644 index 00000000000..0643be1c4d9 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml @@ -0,0 +1,65 @@ +# IRC 21(b)(2) and 129(e)(1); Form 2441 Part III line 16 has no +# CDCC dollar cap and does not first subtract excluded employer benefits. +- name: Case 1, no qualifying individual means no qualified care expenses. + period: 2017 + input: + count_cdcc_eligible: 0 + tax_unit_childcare_expenses: 5_000 + care_expenses: 2_000 + output: + cdcc_qualified_care_expenses: 0 + +- name: Case 2, qualified care combines child and disabled-adult expenses before dollar limits. + period: 2021 + input: + count_cdcc_eligible: 2 + tax_unit_childcare_expenses: 12_000 + care_expenses: 2_000 + output: + cdcc_qualified_care_expenses: 14_000 + +- name: Case 3, a qualifying disabled adult can have care expenses without childcare. + period: 2025 + input: + count_cdcc_eligible: 1 + tax_unit_childcare_expenses: 0 + care_expenses: 2_000 + output: + cdcc_qualified_care_expenses: 2_000 + +- name: Case 4, negative reported care costs do not create negative qualified expenses. + period: 2017 + input: + count_cdcc_eligible: 1 + tax_unit_childcare_expenses: -100 + output: + cdcc_qualified_care_expenses: 0 + +- name: Case 5, the 2025 expense and wage chains compute without a DCAP cycle. + period: 2025 + input: + people: + person1: + age: 35 + employment_income: 100_000 + dependent_care_employer_benefits: 3_000 + person2: + age: 5 + spm_units: + spm_unit: + members: [person1, person2] + spm_unit_pre_subsidy_childcare_expenses: 5_000 + tax_units: + tax_unit: + members: [person1, person2] + households: + household: + members: [person1, person2] + state_code: TX + output: + tax_unit_childcare_expenses: 5_000 + cdcc_qualified_care_expenses: 5_000 + dependent_care_assistance_exclusion: 3_000 + taxable_dependent_care_benefits: [0, 0] + irs_employment_income: [97_000, 0] + cdcc_relevant_expenses: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml index d772de304e6..aa5608f3d13 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml @@ -1,6 +1,7 @@ - name: Limited at the smallest of the limit, expenses, and earned income, test 1 period: 2021 input: + count_cdcc_eligible: 1 tax_unit_childcare_expenses: 3_000 cdcc_limit: 5_000 min_head_spouse_earned: 4_000 @@ -10,6 +11,7 @@ - name: Limited at the smallest of the limit, expenses, and earned income, test 2 period: 2018 input: + count_cdcc_eligible: 1 tax_unit_childcare_expenses: 7_000 cdcc_limit: 5_000 min_head_spouse_earned: 4_000 @@ -19,6 +21,7 @@ - name: Limited at the smallest of the limit, expenses, and earned income, test 3 period: 2018 input: + count_cdcc_eligible: 1 tax_unit_childcare_expenses: 7_000 cdcc_limit: 5_000 min_head_spouse_earned: 8_000 @@ -34,6 +37,7 @@ pre_subsidy_care_expenses: 2_000 tax_units: tax_unit: + count_cdcc_eligible: 1 members: [person1] tax_unit_childcare_expenses: 1_000 cdcc_limit: 6_000 @@ -268,3 +272,75 @@ output: count_cdcc_eligible: 1 cdcc_relevant_expenses: 1000 +- name: Case 1, 2017 expenses paid with excluded employer benefits cannot also support the credit. + # Form 2441 (2017), Part III lines 27-31: $2,000 total less $1,000 + # excluded benefits leaves $1,000, below the $3,000 - $1,000 dollar cap. + period: 2017 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 1_000 + person2: + age: 5 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 2_000 + households: + household: + members: [person1, person2] + state_code: TX + output: + dependent_care_assistance_exclusion: 1_000 + cdcc_limit: 2_000 + cdcc_relevant_expenses: 1_000 + +- name: Case 2, the 2025 expense base also removes excluded employer benefits. + period: 2025 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 1_000 + person2: + age: 5 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 2_000 + households: + household: + members: [person1, person2] + state_code: TX + output: + dependent_care_assistance_exclusion: 1_000 + cdcc_limit: 2_000 + cdcc_relevant_expenses: 1_000 + +- name: Case 3, the 2021 higher credit cap still disallows double use of the same expenses. + # Form 2441 (2021), Part III lines 27-31: min(8,000 - 2,000, + # 5,000 - 2,000) = 3,000 of expenses for one qualifying child. + period: 2021 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 2_000 + person2: + age: 5 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 5_000 + households: + household: + members: [person1, person2] + state_code: TX + output: + dependent_care_assistance_exclusion: 2_000 + cdcc_limit: 6_000 + cdcc_relevant_expenses: 3_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml index 07b22fa61d1..1c2f8dde82c 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml @@ -1,17 +1,140 @@ # IRC section 129 dependent care assistance exclusion, as reconciled on -# Form 2441 Part III. The exclusion is the lesser of the employer benefits, +# Form 2441 Part III. Dollar/earnings-limit unit cases explicitly supply +# sufficient qualified expenses; the full-household cases also test that limit. +# The exclusion is the lesser of qualified expenses, employer benefits, # the section 129(a)(2)(A) dollar cap (by filing status), and the section # 129(b) earned-income limit. - name: No employer dependent care benefits gives no exclusion period: 2024 input: + cdcc_qualified_care_expenses: 20_000 dependent_care_employer_benefits: 0 filing_status: JOINT min_head_spouse_earned: 50_000 output: dependent_care_assistance_exclusion: 0 +# IRC 129(e)(1) adopts 21(b)(2), which requires a qualifying individual. +# 21(b)(1)(A) uses the dependent-child test; only the disabled-person branch +# 21(b)(1)(B) disregards 152(b)(1). 2017/2025 Form 2441 instructions, PDF p1. +- name: Case 13, a claimable filer's child alone does not establish qualified DCAP expenses. + period: 2024 + input: + people: + head: + age: 22 + employment_income: 6_000 + dependent_care_employer_benefits: 5_000 + claimable_as_dependent_on_another_return: true + child: + age: 2 + tax_units: + tax_unit: + members: [head, child] + filing_status: SINGLE + tax_unit_childcare_expenses: 5_000 + households: + household: + members: [head, child] + state_code: TX + output: + count_cdcc_eligible: 0 + cdcc_qualified_care_expenses: 0 + dependent_care_assistance_exclusion: 0 + taxable_dependent_care_benefits: [5_000, 0] + standard_deduction_worksheet_earned_income_person: [6_000, 0] + basic_standard_deduction: 6_450 + +- name: Case 14, a claimable filer retains qualified DCAP care for an incapacitated dependent. + period: 2024 + input: + people: + head: + age: 22 + employment_income: 6_000 + dependent_care_employer_benefits: 5_000 + claimable_as_dependent_on_another_return: true + relative: + age: 40 + is_tax_unit_dependent: true + is_incapable_of_self_care: true + pre_subsidy_care_expenses: 2_000 + tax_units: + tax_unit: + members: [head, relative] + filing_status: SINGLE + households: + household: + members: [head, relative] + state_code: TX + output: + count_cdcc_eligible: 1 + cdcc_qualified_care_expenses: 2_000 + # Box 1 wages $1,000 are the binding section 129 earned-income limit. + dependent_care_assistance_exclusion: 1_000 + taxable_dependent_care_benefits: [4_000, 0] + +- name: Contiguous history, 2018 single DCAP cap. + period: 2018 + input: + cdcc_qualified_care_expenses: 20_000 + dependent_care_employer_benefits: 20_000 + filing_status: SINGLE + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Contiguous history, 2018 separate DCAP cap. + period: 2018 + input: + cdcc_qualified_care_expenses: 20_000 + dependent_care_employer_benefits: 20_000 + filing_status: SEPARATE + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 2_500 + +- name: Contiguous history, 2019 single DCAP cap. + period: 2019 + input: + cdcc_qualified_care_expenses: 20_000 + dependent_care_employer_benefits: 20_000 + filing_status: SINGLE + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Contiguous history, 2019 separate DCAP cap. + period: 2019 + input: + cdcc_qualified_care_expenses: 20_000 + dependent_care_employer_benefits: 20_000 + filing_status: SEPARATE + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 2_500 + +- name: Contiguous history, 2023 single DCAP cap. + period: 2023 + input: + cdcc_qualified_care_expenses: 20_000 + dependent_care_employer_benefits: 20_000 + filing_status: SINGLE + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Contiguous history, 2023 separate DCAP cap. + period: 2023 + input: + cdcc_qualified_care_expenses: 20_000 + dependent_care_employer_benefits: 20_000 + filing_status: SEPARATE + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 2_500 + - name: Benefits below the cap and earned income are excluded in full period: 2024 input: @@ -25,6 +148,7 @@ employment_income: 60_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -44,6 +168,7 @@ employment_income: 60_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -63,6 +188,7 @@ employment_income: 2_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -79,6 +205,7 @@ dependent_care_employer_benefits: 5_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head] filing_status: SEPARATE output: @@ -98,6 +225,7 @@ employment_income: 60_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -121,6 +249,7 @@ age: 5 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [person1, person2] filing_status: SEPARATE output: @@ -141,6 +270,7 @@ age: 5 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [person1, person2] filing_status: SEPARATE output: @@ -159,6 +289,7 @@ age: 5 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [person1, person2] filing_status: SEPARATE output: @@ -181,6 +312,7 @@ employment_income: 40_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -197,6 +329,7 @@ dependent_care_employer_benefits: 12_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head] filing_status: HEAD_OF_HOUSEHOLD output: @@ -213,6 +346,7 @@ dependent_care_employer_benefits: 6_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head] filing_status: SEPARATE output: @@ -232,6 +366,7 @@ employment_income: 40_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -243,6 +378,7 @@ - name: The pre-ARPA joint cap is $5,000 for 2020 period: 2020 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 10_500 min_head_spouse_earned: 50_000 @@ -253,6 +389,7 @@ - name: The pre-ARPA separate cap is $2,500 for 2020 period: 2020 input: + cdcc_qualified_care_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 5_250 @@ -263,6 +400,7 @@ - name: Benefits exactly at the joint 2021 cap are fully excluded period: 2021 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 10_500 min_head_spouse_earned: 50_000 @@ -272,6 +410,7 @@ - name: Benefits exactly at the separate 2021 cap are fully excluded period: 2021 input: + cdcc_qualified_care_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 5_250 @@ -292,6 +431,7 @@ employment_income: 6_000 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -312,6 +452,7 @@ age: 5 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, child] filing_status: SEPARATE output: @@ -319,7 +460,7 @@ # Section 129(a)(2)(C) applies the unmarried $10,500 cap. dependent_care_assistance_exclusion: 10_500 -- name: Living apart without a qualifying individual keeps the $5,250 cap in 2021 +- name: Living apart without a qualifying individual has no DCAP exclusion in 2021 period: 2021 input: people: @@ -334,11 +475,12 @@ filing_status: SEPARATE output: cdcc_treated_as_unmarried: false - dependent_care_assistance_exclusion: 5_250 + dependent_care_assistance_exclusion: 0 - name: The separate cap returns to $2,500 for 2022 period: 2022 input: + cdcc_qualified_care_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 5_250 @@ -349,6 +491,7 @@ - name: Benefits above the 2026 joint cap are limited to $7,500 period: 2026 input: + cdcc_qualified_care_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 7_501 min_head_spouse_earned: 50_000 @@ -358,6 +501,7 @@ - name: Benefits exactly at the 2026 separate cap are fully excluded period: 2026 input: + cdcc_qualified_care_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 3_750 @@ -378,6 +522,7 @@ age: 5 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, child] filing_status: SEPARATE output: @@ -398,6 +543,7 @@ age: 5 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, child] filing_status: SEPARATE output: @@ -424,6 +570,7 @@ age: 4 tax_units: tax_unit: + cdcc_qualified_care_expenses: 20_000 members: [head, spouse, child] filing_status: JOINT output: @@ -431,3 +578,186 @@ min_head_spouse_earned: 2_500 # min(5,000 benefits, 5,000 joint cap, 2,500 earned income) = 2,500. dependent_care_assistance_exclusion: 2_500 +- name: Case 1, the 2017 single DCAP exclusion caps benefits at $5,000. + # 2017 Form 2441, PDF page 2, lines 20-25. + period: 2017 + input: + cdcc_qualified_care_expenses: 20_000 + filing_status: SINGLE + dependent_care_employer_benefits: 5_001 + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Case 2, the 2017 joint DCAP exclusion caps benefits at $5,000. + period: 2017 + input: + cdcc_qualified_care_expenses: 20_000 + filing_status: JOINT + dependent_care_employer_benefits: 5_001 + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Case 3, the 2017 separate DCAP exclusion caps benefits at $2,500. + period: 2017 + input: + cdcc_qualified_care_expenses: 20_000 + filing_status: SEPARATE + cdcc_treated_as_unmarried: false + dependent_care_employer_benefits: 2_501 + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 2_500 + +- name: Case 4, the 2017 head-of-household DCAP exclusion caps benefits at $5,000. + period: 2017 + input: + cdcc_qualified_care_expenses: 20_000 + filing_status: HEAD_OF_HOUSEHOLD + dependent_care_employer_benefits: 5_001 + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Case 5, the 2017 surviving-spouse DCAP exclusion caps benefits at $5,000. + period: 2017 + input: + cdcc_qualified_care_expenses: 20_000 + filing_status: SURVIVING_SPOUSE + dependent_care_employer_benefits: 5_001 + min_head_spouse_earned: 50_000 + output: + dependent_care_assistance_exclusion: 5_000 + +- name: Case 6, the 2017 DCAP exclusion also respects the lower earned-income limit. + period: 2017 + input: + cdcc_qualified_care_expenses: 20_000 + filing_status: JOINT + dependent_care_employer_benefits: 5_000 + min_head_spouse_earned: 2_000 + output: + dependent_care_assistance_exclusion: 2_000 +- name: Case 7, 2017 qualified expenses limit the exclusion below employer benefits. + # Form 2441 (2017), Part III, lines 16-25: min(5,000, 2,000, earnings). + period: 2017 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 5_000 + person2: + age: 5 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 2_000 + households: + household: + members: [person1, person2] + state_code: TX + output: + dependent_care_assistance_exclusion: 2_000 + taxable_dependent_care_benefits: [3_000, 0] + +- name: Case 8, a 2025 employer benefit with zero qualified expenses is taxable. + period: 2025 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 5_000 + person2: + age: 5 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 0 + households: + household: + members: [person1, person2] + state_code: TX + output: + dependent_care_assistance_exclusion: 0 + taxable_dependent_care_benefits: [5_000, 0] + +- name: Case 9, a child above the qualifying age does not support a 2017 exclusion. + period: 2017 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 5_000 + person2: + age: 14 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 5_000 + households: + household: + members: [person1, person2] + state_code: TX + output: + count_cdcc_eligible: 0 + dependent_care_assistance_exclusion: 0 + +- name: Case 10, 2025 care of an incapacitated adult qualifies without a young child. + # IRC 129(e)(1) uses section 21(b)(2), including a qualifying disabled adult. + period: 2025 + input: + people: + person1: + age: 45 + employment_income: 40_000 + dependent_care_employer_benefits: 5_000 + person2: + age: 40 + is_tax_unit_dependent: true + is_incapable_of_self_care: true + pre_subsidy_care_expenses: 2_000 + tax_units: + tax_unit: + members: [person1, person2] + households: + household: + members: [person1, person2] + state_code: TX + output: + count_cdcc_eligible: 1 + dependent_care_assistance_exclusion: 2_000 + +- name: Case 11, the raised 2021 dollar cap does not remove the qualified-expense limit. + period: 2021 + input: + people: + person1: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 10_500 + person2: + age: 5 + tax_units: + tax_unit: + members: [person1, person2] + tax_unit_childcare_expenses: 2_000 + households: + household: + members: [person1, person2] + state_code: TX + output: + dependent_care_assistance_exclusion: 2_000 + +- name: Case 12, a negative earned-income limit cannot create a negative exclusion. + period: 2017 + input: + dependent_care_employer_benefits: 5_000 + tax_unit_childcare_expenses: 5_000 + count_cdcc_eligible: 1 + min_head_spouse_earned: -100 + output: + dependent_care_assistance_exclusion: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/ctc_child_individual_maximum.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/ctc_child_individual_maximum.yaml index 72155b470eb..ea2adce6e2e 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/ctc_child_individual_maximum.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/ctc_child_individual_maximum.yaml @@ -60,3 +60,83 @@ members: [head, child] output: ctc_child_individual_maximum: [0, 0] + +# 2017 Publication 972, PDF pages 2-3: $1,000 under age 17, with a child +# SSN/ITIN/ATIN and a filer SSN/ITIN. The other child tests are supplied here +# through tax-unit dependency; this case isolates age and identification. +- name: Case 1, the 2017 child amount accepts an ITIN and excludes age 17 or a missing TIN. + period: 2017 + input: + people: + person1: + age: 35 + is_tax_unit_head: true + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + person2: + age: 16 + is_tax_unit_dependent: true + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + person3: + age: 17 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + has_tin: true + person4: + age: 5 + is_tax_unit_dependent: true + ssn_card_type: NONE + has_tin: false + tax_units: + tax_unit: + members: [person1, person2, person3, person4] + output: + filer_meets_child_ctc_identification_requirements: true + ctc_qualifying_child: [false, true, false, false] + ctc_child_individual_maximum: [0, 1_000, 0, 0] + ctc_maximum: 1_000 + +- name: Case 2, a 2017 filer without any TIN cannot claim a child's credit. + period: 2017 + input: + people: + person1: + age: 35 + is_tax_unit_head: true + ssn_card_type: NONE + has_tin: false + person2: + age: 5 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + has_tin: true + tax_units: + tax_unit: + members: [person1, person2] + output: + filer_meets_child_ctc_identification_requirements: false + ctc_child_individual_maximum: [0, 0] + ctc_maximum: 0 + +# Section 24(h)(7) starts in 2018; the filer SSN rule starts in 2025. +- name: Case 3, a 2018 ITIN filer can claim the child amount for a child with an eligible SSN. + period: 2018 + input: + people: + person1: + age: 35 + is_tax_unit_head: true + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + person2: + age: 5 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + has_tin: true + tax_units: + tax_unit: + members: [person1, person2] + output: + filer_meets_child_ctc_identification_requirements: true + ctc_child_individual_maximum: [0, 2_000] diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.yaml index 73a47ef58a6..b4198a11cb9 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.yaml @@ -10,6 +10,54 @@ output: meets_ctc_child_identification_requirements: false +- name: Contiguous history, an ITIN alone fails the 2019 child SSN rule. + period: 2019 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + +- name: Contiguous history, an ITIN alone fails the 2020 child SSN rule. + period: 2020 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + +- name: Contiguous history, an ITIN alone fails the 2021 child SSN rule. + period: 2021 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + +- name: Contiguous history, an ITIN alone fails the 2022 child SSN rule. + period: 2022 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + +- name: Contiguous history, an ITIN alone fails the 2023 child SSN rule. + period: 2023 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + +- name: Contiguous history, an ITIN alone fails the 2024 child SSN rule. + period: 2024 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + - name: Person is eligible for the CTC. period: 2023 input: @@ -23,3 +71,37 @@ ssn_card_type: OTHER_NON_CITIZEN output: meets_ctc_child_identification_requirements: false + +# IRC 24(e)(1), before the 2018 section 24(h)(7) SSN restriction; +# 2017 Publication 972, PDF page 3, permits an SSN, ITIN or ATIN. +- name: Case 1, a child with an ITIN meets the 2017 identification requirement. + period: 2017 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: true + +- name: Case 2, a child without any TIN fails the 2017 identification requirement. + period: 2017 + input: + ssn_card_type: NONE + has_tin: false + output: + meets_ctc_child_identification_requirements: false + +- name: Case 3, a child's ITIN does not satisfy the SSN requirement beginning in 2018. + period: 2018 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false + +- name: Case 4, the 2025 child SSN requirement continues to exclude an ITIN alone. + period: 2025 + input: + ssn_card_type: OTHER_NON_CITIZEN + has_tin: true + output: + meets_ctc_child_identification_requirements: false diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/refundable/ctc_social_security_tax.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/refundable/ctc_social_security_tax.yaml index 5b49a8fa388..98b6dbc71c0 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/refundable/ctc_social_security_tax.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/ctc/refundable/ctc_social_security_tax.yaml @@ -73,3 +73,42 @@ output: # 300 + 70 + 100 + 30 + 50 + 10 - 20; the dependent's $515 is left out. ctc_social_security_tax: 540 +- name: Case 1, the 2017 ACTC payroll-tax definition counts filers and subtracts excess withholding. + # 2017 Schedule 8812, PDF page 2, lines 7-10; EITC is subtracted + # separately by the refundability formula rather than this tax subtotal. + period: 2017 + input: + people: + person1: + age: 40 + is_tax_unit_head: true + employee_social_security_tax: 300 + employee_medicare_tax: 70 + self_employment_tax_ald_person: 0 + person2: + age: 40 + is_tax_unit_spouse: true + employee_social_security_tax: 100 + employee_medicare_tax: 30 + self_employment_tax_ald_person: 50 + person3: + age: 16 + is_tax_unit_dependent: true + employee_social_security_tax: 400 + employee_medicare_tax: 90 + self_employment_tax_ald_person: 25 + tax_units: + tax_unit: + members: [person1, person2, person3] + filing_status: JOINT + unreported_payroll_tax: 10 + additional_medicare_tax: 25 + excess_payroll_tax_withheld: 20 + marital_units: + marital_unit1: + members: [person1, person2] + marital_unit2: + members: [person3] + output: + # 300 + 70 + 100 + 30 + 50 + 10 + 25 - 20 = 565. + ctc_social_security_tax: 565 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_eligible_person.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_eligible_person.yaml index c070b58f18f..9fad36fbe60 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_eligible_person.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_eligible_person.yaml @@ -39,3 +39,14 @@ claimable_as_dependent_on_another_return: true output: savers_credit_eligible_person: false + +- name: Case 1, 2017 eligibility uses age eighteen and excludes students and claimed dependents. + # IRS Form 8880 (2017), eligibility box and page 2 Who Can Take This Credit. + period: 2017 + input: + age: [17, 18, 25, 25] + is_tax_unit_head_or_spouse: [true, true, true, true] + is_full_time_student: [false, false, true, false] + claimed_as_dependent_on_another_return: [false, false, false, true] + output: + savers_credit_eligible_person: [false, true, false, false] diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml index 1be355321c8..864bb119cae 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml @@ -350,3 +350,206 @@ output: # 50% x min(3,000, 2,000) = 1,000. savers_credit_person: 1_000 + +# IRS Form 8880 (2017), line 9; Notice 2016-62, PDF pages 2-3. +# Each element is an independent filer with $2,000 of eligible contributions. +- name: Case 8, 2017 joint rate boundaries retain the last dollar in each band. + period: 2017 + input: + filing_status: [JOINT, JOINT, JOINT, JOINT, JOINT, JOINT] + adjusted_gross_income: [37_000, 37_001, 40_000, 40_001, 62_000, 62_001] + savers_credit_eligible_person: [true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 400, 400, 200, 200, 0] + +- name: Case 9, 2017 nonjoint nonhead filers use the all-other-filers column. + # Form 8880 puts qualifying widow(er) with single and separate filers. + period: 2017 + input: + filing_status: [SINGLE, SINGLE, SEPARATE, SEPARATE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SINGLE, SINGLE] + adjusted_gross_income: [18_500, 18_501, 20_000, 20_001, 31_000, 31_001, -1, 0] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 3_000] + output: + savers_credit_person: [1_000, 400, 400, 200, 200, 0, 1_000, 1_000] + +- name: Case 10, 2017 head-of-household rate boundaries use the published amounts. + period: 2017 + input: + filing_status: [HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD] + adjusted_gross_income: [27_750, 27_751, 30_000, 30_001, 46_500, 46_501] + savers_credit_eligible_person: [true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 400, 400, 200, 200, 0] + +- name: Case 11, 2018 joint thresholds remain unchanged after adding 2017 history. + # IRS Form 8880 (2018), line 9. + period: 2018 + input: + filing_status: [JOINT, JOINT] + adjusted_gross_income: [38_000, 38_001] + savers_credit_eligible_person: [true, true] + savers_credit_qualified_contributions: [2_000, 2_000] + output: + savers_credit_person: [1_000, 400] + +# Contiguous annual rate controls: IRS Notices 2018-83, 2019-59, 2020-79, +# and 2021-61, their section 25B(b)(1) indexed joint-return amounts. +- name: Case 12, 2019 Saver rate boundaries follow IRS Notice 2018-83. + period: 2019 + input: + filing_status: + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + adjusted_gross_income: + - 38_500 + - 38_501 + - 41_500 + - 41_501 + - 64_000 + - 64_001 + savers_credit_eligible_person: + - true + - true + - true + - true + - true + - true + savers_credit_qualified_contributions: + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + output: + savers_credit_person: + - 1_000 + - 400 + - 400 + - 200 + - 200 + - 0 +- name: Case 13, 2020 Saver rate boundaries follow IRS Notice 2019-59. + period: 2020 + input: + filing_status: + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + adjusted_gross_income: + - 39_000 + - 39_001 + - 42_500 + - 42_501 + - 65_000 + - 65_001 + savers_credit_eligible_person: + - true + - true + - true + - true + - true + - true + savers_credit_qualified_contributions: + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + output: + savers_credit_person: + - 1_000 + - 400 + - 400 + - 200 + - 200 + - 0 +- name: Case 14, 2021 Saver rate boundaries follow IRS Notice 2020-79. + period: 2021 + input: + filing_status: + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + adjusted_gross_income: + - 39_500 + - 39_501 + - 43_000 + - 43_001 + - 66_000 + - 66_001 + savers_credit_eligible_person: + - true + - true + - true + - true + - true + - true + savers_credit_qualified_contributions: + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + output: + savers_credit_person: + - 1_000 + - 400 + - 400 + - 200 + - 200 + - 0 +- name: Case 15, 2022 Saver rate boundaries follow IRS Notice 2021-61. + period: 2022 + input: + filing_status: + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + - JOINT + adjusted_gross_income: + - 41_000 + - 41_001 + - 44_000 + - 44_001 + - 68_000 + - 68_001 + savers_credit_eligible_person: + - true + - true + - true + - true + - true + - true + savers_credit_qualified_contributions: + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + - 2_000 + output: + savers_credit_person: + - 1_000 + - 400 + - 400 + - 200 + - 200 + - 0 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_qualified_contributions.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_qualified_contributions.yaml index 715d4dbcc83..e2bd89039f9 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_qualified_contributions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_qualified_contributions.yaml @@ -114,3 +114,36 @@ output: # 800 - 300 = 500; the 400 of retirement-plan distributions doesn't count. savers_credit_qualified_contributions: 500 + +- name: Case 1, ABLE contributions do not qualify for the credit in 2017. + # Pub. L. 115-97 section 11024(b)-(c) applies after its 2017 enactment year. + # IRS Form 8880 (2017) lines 1-4 include retirement plans, not ABLE accounts. + period: 2017 + input: + able_contributions_person: 500 + output: + savers_credit_qualified_contributions: 0 + +- name: Case 2, 2017 retirement contributions are not reduced by ABLE distributions. + period: 2017 + input: + ira_compensation: 10_000 + traditional_ira_contributions_desired: 1_000 + able_contributions_person: 500 + retirement_distributions: 200 + savers_credit_relevant_able_distributions: 300 + output: + # Only the $200 retirement distribution reduces the $1,000 IRA contribution. + savers_credit_qualified_contributions: 800 + +- name: Case 3, ABLE contributions and distributions enter the credit from 2018. + # Pub. L. 115-97 section 11024(b)-(c); IRS Form 8880 (2018) lines 1 and 4. + period: 2018 + input: + ira_compensation: 10_000 + traditional_ira_contributions_desired: 1_000 + able_contributions_person: 500 + retirement_distributions: 200 + savers_credit_relevant_able_distributions: 300 + output: + savers_credit_qualified_contributions: 1_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml index 5bc9f4a9d6f..91e067b60c5 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml @@ -652,3 +652,182 @@ filing_status: JOINT output: basic_standard_deduction: 33_200 +- name: Case 1, a 2017 dependent with no earned income receives the $1,050 floor. + # 2017 Form 1040 instructions, PDF page 39, dependent worksheet line 1. + period: 2017 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1_050 + +- name: Case 2, the 2017 dependent floor still applies at $700 of earned income. + period: 2017 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 700 + output: + basic_standard_deduction: 1_050 + +- name: Case 3, a 2017 dependent adds $350 above the $700 worksheet boundary. + period: 2017 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 701 + output: + basic_standard_deduction: 1_051 + +- name: Case 4, a 2017 single dependent cannot exceed the $6,350 regular deduction. + # min(6,350, max(1,050, 6,001 + 350)) = 6,350. + period: 2017 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 6_001 + output: + basic_standard_deduction: 6_350 + +# Annual dependent worksheet histories, checked against dated IRS guidance. + +- name: Contiguous history, 2018 dependent deduction floor. + # https://www.irs.gov/irb/2018-10_IRB, Rev. Proc. 2018-18 section 3.14(2). + period: 2018 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1050 + +- name: Contiguous history, 2018 dependent earned-income addition. + # https://www.irs.gov/irb/2018-10_IRB, Rev. Proc. 2018-18 section 3.14(2). + period: 2018 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 3_000 + output: + basic_standard_deduction: 3_350 + +- name: Contiguous history, 2019 dependent deduction floor. + # https://www.irs.gov/pub/irs-drop/rp-18-57.pdf, section 3.16(2). + period: 2019 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1100 + +- name: Contiguous history, 2019 dependent earned-income addition. + # https://www.irs.gov/pub/irs-drop/rp-18-57.pdf, section 3.16(2). + period: 2019 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 3_000 + output: + basic_standard_deduction: 3_350 + +- name: Contiguous history, 2020 dependent deduction floor. + # https://www.irs.gov/pub/irs-drop/rp-19-44.pdf, section 3.16(2). + period: 2020 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1100 + +- name: Contiguous history, 2020 dependent earned-income addition. + # https://www.irs.gov/pub/irs-drop/rp-19-44.pdf, section 3.16(2). + period: 2020 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 3_000 + output: + basic_standard_deduction: 3_350 + +- name: Contiguous history, 2021 dependent deduction floor. + # https://www.irs.gov/pub/irs-drop/rp-20-45.pdf, section 3.16(2). + period: 2021 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1100 + +- name: Contiguous history, 2021 dependent earned-income addition. + # https://www.irs.gov/pub/irs-drop/rp-20-45.pdf, section 3.16(2). + period: 2021 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 3_000 + output: + basic_standard_deduction: 3_350 + +- name: Contiguous history, 2022 dependent deduction floor. + # https://www.irs.gov/pub/irs-drop/rp-21-45.pdf, section 3.15(2). + period: 2022 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1150 + +- name: Contiguous history, 2022 dependent earned-income addition. + # https://www.irs.gov/pub/irs-drop/rp-21-45.pdf, section 3.15(2). + period: 2022 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 3_000 + output: + basic_standard_deduction: 3_400 + +- name: Contiguous history, 2023 dependent deduction floor. + # https://www.irs.gov/irm/part3/irm_03-011-006r, standard deduction table. + period: 2023 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1250 + +- name: Contiguous history, 2024 dependent deduction floor. + # https://www.irs.gov/irm/part3/irm_03-011-006r, standard deduction table. + period: 2024 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1300 + +- name: Contiguous history, 2025 dependent deduction floor. + # https://www.irs.gov/irm/part3/irm_03-011-006r, standard deduction table. + period: 2025 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1350 + +- name: Contiguous history, 2026 dependent deduction floor. + # https://www.irs.gov/pub/irs-drop/rp-25-32.pdf, dependent standard deduction. + period: 2026 + input: + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + output: + basic_standard_deduction: 1350 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/capped_qualified_tuition_expenses_ald.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/capped_qualified_tuition_expenses_ald.yaml index 8b532728736..281bdc7aad2 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/capped_qualified_tuition_expenses_ald.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/capped_qualified_tuition_expenses_ald.yaml @@ -97,3 +97,127 @@ state_code: TX output: capped_qualified_tuition_expenses_ald: 0 + +# Form 1040 puts the eligible tuition deduction before AGI, once. +# https://www.irs.gov/pub/irs-prior/f1040--2017.pdf +# https://www.irs.gov/pub/irs-prior/f1040s1--2018.pdf + +- name: 2017 tuition reduces the wage-to-taxable-income chain exactly once. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + worker: + age: 35 + employment_income: 40000 + qualified_tuition_expenses: 4000 + is_eligible_for_american_opportunity_credit: false + tax_units: + unit: + members: + - worker + filing_status: SINGLE + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - worker + state_code: TX + output: + capped_qualified_tuition_expenses_ald: 4000 + above_the_line_deductions: 4000 + adjusted_gross_income: 36000 + standard_deduction: 6350 + exemptions: 4050 + taxable_income: 25600 + +- name: 2018 tuition reduces the wage-to-taxable-income chain exactly once. + period: 2018 + absolute_error_margin: 0.01 + input: + people: + worker: + age: 35 + employment_income: 40000 + qualified_tuition_expenses: 4000 + is_eligible_for_american_opportunity_credit: false + tax_units: + unit: + members: + - worker + filing_status: SINGLE + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - worker + state_code: TX + output: + capped_qualified_tuition_expenses_ald: 4000 + above_the_line_deductions: 4000 + adjusted_gross_income: 36000 + standard_deduction: 12000 + exemptions: 0 + taxable_income: 24000 + +- name: 2019 tuition reduces the wage-to-taxable-income chain exactly once. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + worker: + age: 35 + employment_income: 40000 + qualified_tuition_expenses: 4000 + is_eligible_for_american_opportunity_credit: false + tax_units: + unit: + members: + - worker + filing_status: SINGLE + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - worker + state_code: TX + output: + capped_qualified_tuition_expenses_ald: 4000 + above_the_line_deductions: 4000 + adjusted_gross_income: 36000 + standard_deduction: 12200 + exemptions: 0 + taxable_income: 23800 + +- name: 2020 tuition reduces the wage-to-taxable-income chain exactly once. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + worker: + age: 35 + employment_income: 40000 + qualified_tuition_expenses: 4000 + is_eligible_for_american_opportunity_credit: false + tax_units: + unit: + members: + - worker + filing_status: SINGLE + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - worker + state_code: TX + output: + capped_qualified_tuition_expenses_ald: 4000 + above_the_line_deductions: 4000 + adjusted_gross_income: 36000 + standard_deduction: 12400 + exemptions: 0 + taxable_income: 23600 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml index 21e399e3bd0..8dde89eec6f 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml @@ -148,12 +148,17 @@ members: [head, child] state_code: TX output: - # Box 1 $1,000; exclusion min($5,000, $5,000, $1,000) = $1,000; line 1e - # $4,000. Earned income is line 1z, $5,000; unearned income is $0. - standard_deduction_worksheet_earned_income_person: [5_000, 0] - # max($1,300, $5,000 + $450) = $5,450 (Rev. Proc. 2023-34). - basic_standard_deduction: 5_450 - # Taxable income $5,000 - $5,450 < 0. Refundable credits are left out: + # IRC 129(e)(1) adopts 21(b)(2). The ordinary-child branch of 21(b)(1)(A) + # requires a dependent, which 152(b)(1) bars for this claimable filer. + # Only the disabled-person branch of 21(b)(1)(B) disregards that bar. + # Thus no exclusion applies: box 1 $1,000 plus taxable benefits $5,000. + count_cdcc_eligible: 0 + dependent_care_assistance_exclusion: 0 + taxable_dependent_care_benefits: [5_000, 0] + standard_deduction_worksheet_earned_income_person: [6_000, 0] + # max($1,300, $6,000 + $450) = $6,450 (Rev. Proc. 2023-34). + basic_standard_deduction: 6_450 + # Taxable income $6,000 - $6,450 < 0. Refundable credits are left out: # the model's EITC doesn't test whether the filer is claimable. income_tax_before_refundable_credits: 0 tax_unit_is_required_to_file: false diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/overtime_income/overtime_income_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/overtime_income/overtime_income_deduction.yaml index 6a45a5e5ab3..49a18295f5f 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/overtime_income/overtime_income_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/overtime_income/overtime_income_deduction.yaml @@ -626,3 +626,181 @@ state_code: TX output: overtime_income_deduction: 3_000 + +# Annual history: P.L. 119-21 sections 70201(j) and 70202(h) apply after 2024. + +- name: 2017 overtime deduction follows its statutory effective date. + period: 2017 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2018 overtime deduction follows its statutory effective date. + period: 2018 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2019 overtime deduction follows its statutory effective date. + period: 2019 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2020 overtime deduction follows its statutory effective date. + period: 2020 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2021 overtime deduction follows its statutory effective date. + period: 2021 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2022 overtime deduction follows its statutory effective date. + period: 2022 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2023 overtime deduction follows its statutory effective date. + period: 2023 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 0 + +- name: 2026 overtime deduction follows its statutory effective date. + period: 2026 + input: + people: + worker: + age: 40 + fsla_overtime_premium: 5000 + ssn_card_type: CITIZEN + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + overtime_income_deduction: 5000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tip_income/tip_income_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tip_income/tip_income_deduction.yaml index d785b4e9d66..873304242a1 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tip_income/tip_income_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tip_income/tip_income_deduction.yaml @@ -755,3 +755,189 @@ state_code: TX output: tip_income_deduction: 4_000 + +# Annual history: P.L. 119-21 sections 70201(j) and 70202(h) apply after 2024. + +- name: 2017 tip deduction follows its statutory effective date. + period: 2017 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2018 tip deduction follows its statutory effective date. + period: 2018 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2019 tip deduction follows its statutory effective date. + period: 2019 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2020 tip deduction follows its statutory effective date. + period: 2020 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2021 tip deduction follows its statutory effective date. + period: 2021 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2022 tip deduction follows its statutory effective date. + period: 2022 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2023 tip deduction follows its statutory effective date. + period: 2023 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 0 + +- name: 2026 tip deduction follows its statutory effective date. + period: 2026 + input: + people: + worker: + age: 40 + tip_income: 10000 + ssn_card_type: CITIZEN + treasury_tipped_occupation_code: 102 + tax_units: + unit: + members: + - worker + filing_status: SINGLE + adjusted_gross_income: 60000 + households: + household: + members: + - worker + state_code: TX + output: + tip_income_deduction: 10000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml index 796e31c7b9f..62cf0ec1fe3 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml @@ -140,3 +140,59 @@ exemptions_count: 2 output: exemptions: 0 + +- name: Personal exemptions remain suspended in 2019. + period: 2019 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Personal exemptions remain suspended in 2020. + period: 2020 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Personal exemptions remain suspended in 2021. + period: 2021 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Personal exemptions remain suspended in 2022. + period: 2022 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Personal exemptions remain suspended in 2023. + period: 2023 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Personal exemptions remain suspended in 2024. + period: 2024 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 + +- name: Personal exemptions remain suspended in 2025. + period: 2025 + input: + adjusted_gross_income: 50000 + exemptions_count: 2 + output: + exemptions: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml index cb520ef6cc8..fd9b4df878d 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/tax/federal_income/integration.yaml @@ -587,9 +587,1623 @@ income_tax: 1139.0 employee_payroll_tax: 5355.0 -- name: Case 15, 2021 single wages matches the independent tax reference. +- name: Case 15, 2019 single wages matches the independent tax reference. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12200.0 + exemptions: 0.0 + taxable_income: 27800.0 + income_tax_before_credits: 3142.0 + eitc: 0.0 + income_tax: 3142.0 + employee_payroll_tax: 3060.0 + +- name: Case 16, 2019 parent eitc matches the independent tax reference. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 18350.0 + exemptions: 0.0 + taxable_income: 1650.0 + income_tax_before_credits: 165.0 + eitc: 3370.994 + income_tax: -4770.994000000001 + employee_payroll_tax: 1530.0 + +- name: Case 17, 2019 joint children matches the independent tax reference. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 24400.0 + exemptions: 0.0 + taxable_income: 15600.0 + income_tax_before_credits: 1560.0 + eitc: 2631.0919999999996 + income_tax: -5071.092 + employee_payroll_tax: 3060.0 + +- name: Case 18, 2019 joint ctc phaseout matches the independent tax reference. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 24400.0 + exemptions: 0.0 + taxable_income: 95601.0 + income_tax_before_credits: 12749.22 + eitc: 0.0 + income_tax: 8749.22 + employee_payroll_tax: 9180.0765 + +- name: Case 19, 2019 single exemption phaseout matches the independent tax reference. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 12200.0 + exemptions: 0.0 + taxable_income: 287801.0 + income_tax_before_credits: 75923.85 + eitc: 0.0 + income_tax: 75923.85 + employee_payroll_tax: 13489.8235 + +- name: Case 20, 2019 joint two earners matches the independent tax reference. + period: 2019 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 24400.0 + exemptions: 0.0 + taxable_income: 45600.0 + income_tax_before_credits: 5084.0 + eitc: 0.0 + income_tax: 1084.0 + employee_payroll_tax: 5355.0 + +- name: Case 21, 2020 single wages matches the independent tax reference. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12400.0 + exemptions: 0.0 + taxable_income: 27600.0 + income_tax_before_credits: 3114.5 + eitc: 0.0 + income_tax: 1314.5 + employee_payroll_tax: 3060.0 + +- name: Case 22, 2020 parent eitc matches the independent tax reference. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 18650.0 + exemptions: 0.0 + taxable_income: 1350.0 + income_tax_before_credits: 135.0 + eitc: 3476.934 + income_tax: -7776.934 + employee_payroll_tax: 1530.0 + +- name: Case 23, 2020 joint children matches the independent tax reference. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 24800.0 + exemptions: 0.0 + taxable_income: 15200.0 + income_tax_before_credits: 1520.0 + eitc: 2807.332 + income_tax: -11087.332 + employee_payroll_tax: 3060.0 + +- name: Case 24, 2020 joint ctc phaseout matches the independent tax reference. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 24800.0 + exemptions: 0.0 + taxable_income: 95201.0 + income_tax_before_credits: 12524.22 + eitc: 0.0 + income_tax: 2724.2199999999993 + employee_payroll_tax: 9180.0765 + +- name: Case 25, 2020 single exemption phaseout matches the independent tax reference. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 12400.0 + exemptions: 0.0 + taxable_income: 287601.0 + income_tax_before_credits: 75455.35 + eitc: 0.0 + income_tax: 75455.35 + employee_payroll_tax: 13787.423499999999 + +- name: Case 26, 2020 joint two earners matches the independent tax reference. + period: 2020 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 24800.0 + exemptions: 0.0 + taxable_income: 45200.0 + income_tax_before_credits: 5029.0 + eitc: 0.0 + income_tax: -4771.0 + employee_payroll_tax: 5355.0 + +- name: Case 27, 2021 single wages matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12550.0 + exemptions: 0.0 + taxable_income: 27450.0 + income_tax_before_credits: 3095.0 + eitc: 0.0 + income_tax: 1695.0 + employee_payroll_tax: 3060.0 + +- name: Case 28, 2021 parent eitc matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 18800.0 + exemptions: 0.0 + taxable_income: 1200.0 + income_tax_before_credits: 120.0 + eitc: 3541.296 + income_tax: -9221.296 + employee_payroll_tax: 1530.0 + +- name: Case 29, 2021 joint children matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 25100.0 + exemptions: 0.0 + taxable_income: 14900.0 + income_tax_before_credits: 1490.0 + eitc: 2919.982 + income_tax: -13029.982 + employee_payroll_tax: 3060.0 + +- name: Case 30, 2021 joint ctc phaseout matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 25100.0 + exemptions: 0.0 + taxable_income: 94901.0 + income_tax_before_credits: 12375.22 + eitc: 0.0 + income_tax: 775.2199999999993 + employee_payroll_tax: 9180.0765 + +- name: Case 31, 2021 single exemption phaseout matches the independent tax reference. + period: 2021 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 12550.0 + exemptions: 0.0 + taxable_income: 287451.0 + income_tax_before_credits: 75152.1 + eitc: 0.0 + income_tax: 75152.1 + employee_payroll_tax: 14103.6235 + +- name: Case 32, 2021 joint two earners matches the independent tax reference. period: 2021 absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 25100.0 + exemptions: 0.0 + taxable_income: 44900.0 + income_tax_before_credits: 4990.0 + eitc: 0.0 + income_tax: -6610.0 + employee_payroll_tax: 5355.0 + +- name: Case 33, 2022 single wages matches the independent tax reference. + period: 2022 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 12950.0 + exemptions: 0.0 + taxable_income: 27050.0 + income_tax_before_credits: 3040.5 + eitc: 0.0 + income_tax: 3040.5 + employee_payroll_tax: 3060.0 + +- name: Case 34, 2022 parent eitc matches the independent tax reference. + period: 2022 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 19400.0 + exemptions: 0.0 + taxable_income: 600.0 + income_tax_before_credits: 60.0 + eitc: 3733.0 + income_tax: -5233.0 + employee_payroll_tax: 1530.0 + +- name: Case 35, 2022 joint children matches the independent tax reference. + period: 2022 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 25900.0 + exemptions: 0.0 + taxable_income: 14100.0 + income_tax_before_credits: 1410.0 + eitc: 3270.3559999999998 + income_tax: -5860.356 + employee_payroll_tax: 3060.0 + +- name: Case 36, 2022 joint ctc phaseout matches the independent tax reference. + period: 2022 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 25900.0 + exemptions: 0.0 + taxable_income: 94101.0 + income_tax_before_credits: 11936.22 + eitc: 0.0 + income_tax: 7936.219999999999 + employee_payroll_tax: 9180.0765 + +- name: Case 37, 2022 single exemption phaseout matches the independent tax reference. + period: 2022 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 12950.0 + exemptions: 0.0 + taxable_income: 287051.0 + income_tax_before_credits: 74220.85 + eitc: 0.0 + income_tax: 74220.85 + employee_payroll_tax: 14364.023500000001 + +- name: Case 38, 2022 joint two earners matches the independent tax reference. + period: 2022 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 25900.0 + exemptions: 0.0 + taxable_income: 44100.0 + income_tax_before_credits: 4881.0 + eitc: 0.0 + income_tax: 881.0 + employee_payroll_tax: 5355.0 + +- name: Case 39, 2023 single wages matches the independent tax reference. + period: 2023 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 13850.0 + exemptions: 0.0 + taxable_income: 26150.0 + income_tax_before_credits: 2918.0 + eitc: 0.0 + income_tax: 2918.0 + employee_payroll_tax: 3060.0 + +- name: Case 40, 2023 parent eitc matches the independent tax reference. + period: 2023 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 20800.0 + exemptions: 0.0 + taxable_income: 0.0 + income_tax_before_credits: 0.0 + eitc: 3995.0 + income_tax: -5595.0 + employee_payroll_tax: 1530.0 + +- name: Case 41, 2023 joint children matches the independent tax reference. + period: 2023 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 27700.0 + exemptions: 0.0 + taxable_income: 12300.0 + income_tax_before_credits: 1230.0 + eitc: 4102.072 + income_tax: -6872.072 + employee_payroll_tax: 3060.0 + +- name: Case 42, 2023 joint ctc phaseout matches the independent tax reference. + period: 2023 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 27700.0 + exemptions: 0.0 + taxable_income: 92301.0 + income_tax_before_credits: 10921.22 + eitc: 0.0 + income_tax: 6921.219999999999 + employee_payroll_tax: 9180.0765 + +- name: Case 43, 2023 single exemption phaseout matches the independent tax reference. + period: 2023 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 13850.0 + exemptions: 0.0 + taxable_income: 286151.0 + income_tax_before_credits: 72047.35 + eitc: 0.0 + income_tax: 72047.35 + employee_payroll_tax: 15182.423499999999 + +- name: Case 44, 2023 joint two earners matches the independent tax reference. + period: 2023 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 27700.0 + exemptions: 0.0 + taxable_income: 42300.0 + income_tax_before_credits: 4636.0 + eitc: 0.0 + income_tax: 636.0 + employee_payroll_tax: 5355.0 + +- name: Case 45, 2024 single wages matches the independent tax reference. + period: 2024 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 14600.0 + exemptions: 0.0 + taxable_income: 25400.0 + income_tax_before_credits: 2816.0 + eitc: 0.0 + income_tax: 2816.0 + employee_payroll_tax: 3060.0 + +- name: Case 46, 2024 parent eitc matches the independent tax reference. + period: 2024 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 20000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 8 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + filing_status: HEAD_OF_HOUSEHOLD + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + state_code: TX + output: + adjusted_gross_income: 20000.0 + standard_deduction: 21900.0 + exemptions: 0.0 + taxable_income: 0.0 + income_tax_before_credits: 0.0 + eitc: 4213.0 + income_tax: -5913.0 + employee_payroll_tax: 1530.0 + +- name: Case 47, 2024 joint children matches the independent tax reference. + period: 2024 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 40000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 40000.0 + standard_deduction: 29200.0 + exemptions: 0.0 + taxable_income: 10800.0 + income_tax_before_credits: 1080.0 + eitc: 4778.183999999999 + income_tax: -7698.183999999999 + employee_payroll_tax: 3060.0 + +- name: Case 48, 2024 joint ctc phaseout matches the independent tax reference. + period: 2024 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 120001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 0 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 120001.0 + standard_deduction: 29200.0 + exemptions: 0.0 + taxable_income: 90801.0 + income_tax_before_credits: 10432.119999999999 + eitc: 0.0 + income_tax: 6432.119999999999 + employee_payroll_tax: 9180.0765 + +- name: Case 49, 2024 single exemption phaseout matches the independent tax reference. + period: 2024 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 300001 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + tax_units: + tax_unit: + members: + - person1 + filing_status: SINGLE + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + state_code: TX + output: + adjusted_gross_income: 300001.0 + standard_deduction: 14600.0 + exemptions: 0.0 + taxable_income: 285401.0 + income_tax_before_credits: 70265.1 + eitc: 0.0 + income_tax: 70265.1 + employee_payroll_tax: 15703.223500000002 + +- name: Case 50, 2024 joint two earners matches the independent tax reference. + period: 2024 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 35 + employment_income: 35000 + is_tax_unit_head: true + is_tax_unit_spouse: false + is_tax_unit_dependent: false + person2: + age: 33 + employment_income: 35000 + is_tax_unit_head: false + is_tax_unit_spouse: true + is_tax_unit_dependent: false + person3: + age: 8 + is_tax_unit_dependent: true + person4: + age: 12 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: + - person1 + - person2 + - person3 + - person4 + filing_status: JOINT + takes_up_eitc: true + would_file_taxes_voluntarily: true + aca_ptc: 0 + state_sales_tax: 0 + households: + household: + members: + - person1 + - person2 + - person3 + - person4 + state_code: TX + output: + adjusted_gross_income: 70000.0 + standard_deduction: 29200.0 + exemptions: 0.0 + taxable_income: 40800.0 + income_tax_before_credits: 4432.0 + eitc: 0.0 + income_tax: 432.0 + employee_payroll_tax: 5355.0 + +- name: Case 51, 2025 single wages matches the independent tax reference. + period: 2025 + absolute_error_margin: 0.01 input: people: person1: @@ -614,16 +2228,16 @@ state_code: TX output: adjusted_gross_income: 40000.0 - standard_deduction: 12550.0 + standard_deduction: 15750.0 exemptions: 0.0 - taxable_income: 27450.0 - income_tax_before_credits: 3095.0 + taxable_income: 24250.0 + income_tax_before_credits: 2671.5 eitc: 0.0 - income_tax: 1695.0 + income_tax: 2671.5 employee_payroll_tax: 3060.0 -- name: Case 16, 2021 parent eitc matches the independent tax reference. - period: 2021 +- name: Case 52, 2025 parent eitc matches the independent tax reference. + period: 2025 absolute_error_margin: 0.01 input: people: @@ -654,16 +2268,16 @@ state_code: TX output: adjusted_gross_income: 20000.0 - standard_deduction: 18800.0 + standard_deduction: 23625.0 exemptions: 0.0 - taxable_income: 1200.0 - income_tax_before_credits: 120.0 - eitc: 3541.296 - income_tax: -9221.296 + taxable_income: 0.0 + income_tax_before_credits: 0.0 + eitc: 4328.0 + income_tax: -6028.0 employee_payroll_tax: 1530.0 -- name: Case 17, 2021 joint children matches the independent tax reference. - period: 2021 +- name: Case 53, 2025 joint children matches the independent tax reference. + period: 2025 absolute_error_margin: 0.01 input: people: @@ -707,16 +2321,16 @@ state_code: TX output: adjusted_gross_income: 40000.0 - standard_deduction: 25100.0 + standard_deduction: 31500.0 exemptions: 0.0 - taxable_income: 14900.0 - income_tax_before_credits: 1490.0 - eitc: 2919.982 - income_tax: -13029.982 + taxable_income: 8500.0 + income_tax_before_credits: 850.0 + eitc: 5144.982 + income_tax: -8544.982 employee_payroll_tax: 3060.0 -- name: Case 18, 2021 joint ctc phaseout matches the independent tax reference. - period: 2021 +- name: Case 54, 2025 joint ctc phaseout matches the independent tax reference. + period: 2025 absolute_error_margin: 0.01 input: people: @@ -760,16 +2374,16 @@ state_code: TX output: adjusted_gross_income: 120001.0 - standard_deduction: 25100.0 + standard_deduction: 31500.0 exemptions: 0.0 - taxable_income: 94901.0 - income_tax_before_credits: 12375.22 + taxable_income: 88501.0 + income_tax_before_credits: 10143.119999999999 eitc: 0.0 - income_tax: 775.2199999999993 + income_tax: 5743.119999999999 employee_payroll_tax: 9180.0765 -- name: Case 19, 2021 single exemption phaseout matches the independent tax reference. - period: 2021 +- name: Case 55, 2025 single exemption phaseout matches the independent tax reference. + period: 2025 absolute_error_margin: 0.01 input: people: @@ -795,16 +2409,16 @@ state_code: TX output: adjusted_gross_income: 300001.0 - standard_deduction: 12550.0 + standard_deduction: 15750.0 exemptions: 0.0 - taxable_income: 287451.0 - income_tax_before_credits: 75152.1 + taxable_income: 284251.0 + income_tax_before_credits: 69035.1 eitc: 0.0 - income_tax: 75152.1 - employee_payroll_tax: 14103.6235 + income_tax: 69035.1 + employee_payroll_tax: 16168.223500000002 -- name: Case 20, 2021 joint two earners matches the independent tax reference. - period: 2021 +- name: Case 56, 2025 joint two earners matches the independent tax reference. + period: 2025 absolute_error_margin: 0.01 input: people: @@ -848,15 +2462,15 @@ state_code: TX output: adjusted_gross_income: 70000.0 - standard_deduction: 25100.0 + standard_deduction: 31500.0 exemptions: 0.0 - taxable_income: 44900.0 - income_tax_before_credits: 4990.0 + taxable_income: 38500.0 + income_tax_before_credits: 4143.0 eitc: 0.0 - income_tax: -6610.0 + income_tax: -257.0 employee_payroll_tax: 5355.0 -- name: Case 21, 2026 single wages matches the independent tax reference. +- name: Case 57, 2026 single wages matches the independent tax reference. period: 2026 absolute_error_margin: 0.01 input: @@ -891,7 +2505,7 @@ income_tax: 2620.0 employee_payroll_tax: 3060.0 -- name: Case 22, 2026 parent eitc matches the independent tax reference. +- name: Case 58, 2026 parent eitc matches the independent tax reference. period: 2026 absolute_error_margin: 0.01 input: @@ -931,7 +2545,7 @@ income_tax: -6127.0 employee_payroll_tax: 1530.0 -- name: Case 23, 2026 joint children matches the independent tax reference. +- name: Case 59, 2026 joint children matches the independent tax reference. period: 2026 absolute_error_margin: 0.01 input: @@ -984,7 +2598,7 @@ income_tax: -8854.296 employee_payroll_tax: 3060.0 -- name: Case 24, 2026 joint ctc phaseout matches the independent tax reference. +- name: Case 60, 2026 joint ctc phaseout matches the independent tax reference. period: 2026 absolute_error_margin: 0.01 input: @@ -1037,7 +2651,7 @@ income_tax: 5640.119999999999 employee_payroll_tax: 9180.0765 -- name: Case 25, 2026 single exemption phaseout matches the independent tax reference. +- name: Case 61, 2026 single exemption phaseout matches the independent tax reference. period: 2026 absolute_error_margin: 0.01 input: @@ -1072,7 +2686,7 @@ income_tax: 68134.6 employee_payroll_tax: 16689.0235 -- name: Case 26, 2026 joint two earners matches the independent tax reference. +- name: Case 62, 2026 joint two earners matches the independent tax reference. period: 2026 absolute_error_margin: 0.01 input: diff --git a/policyengine_us/tests/policy/baseline/household/demographic/person/is_qualifying_child_dependent.yaml b/policyengine_us/tests/policy/baseline/household/demographic/person/is_qualifying_child_dependent.yaml index 1be0fe079da..a4f6422e406 100644 --- a/policyengine_us/tests/policy/baseline/household/demographic/person/is_qualifying_child_dependent.yaml +++ b/policyengine_us/tests/policy/baseline/household/demographic/person/is_qualifying_child_dependent.yaml @@ -44,3 +44,27 @@ output: # defined_for requires is_tax_unit_dependent is_qualifying_child_dependent: false +- name: Case 1, the 2017 dependency age test excludes the exact non-student and student limits. + # 2017 Form 1040 instructions, PDF page 17, Step 1: under 19, + # or under 24 if a student. This variable isolates the age test. + period: 2017 + input: + people: + person1: + age: 18 + is_tax_unit_dependent: true + is_full_time_student: false + person2: + age: 19 + is_tax_unit_dependent: true + is_full_time_student: false + person3: + age: 23 + is_tax_unit_dependent: true + is_full_time_student: true + person4: + age: 24 + is_tax_unit_dependent: true + is_full_time_student: true + output: + is_qualifying_child_dependent: [true, false, true, false] diff --git a/policyengine_us/tests/policy/baseline/household/expense/retirement/elective_deferral_limit.yaml b/policyengine_us/tests/policy/baseline/household/expense/retirement/elective_deferral_limit.yaml index a2d43d82c75..91715b57eda 100644 --- a/policyengine_us/tests/policy/baseline/household/expense/retirement/elective_deferral_limit.yaml +++ b/policyengine_us/tests/policy/baseline/household/expense/retirement/elective_deferral_limit.yaml @@ -220,3 +220,168 @@ age: 40 output: elective_deferral_limit: 18_000 + +- name: Case 11, 2017 deferral and catch-up limits follow Notice 2016-62. + # Notice 2016-62, PDF pages 1-2: $18,000 plus $6,000 from age 50. + period: 2017 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000, 100_000] + age: [49, 50, 60, 64] + traditional_401k_contributions_desired: [30_000, 30_000, 30_000, 30_000] + output: + elective_deferral_limit: [18_000, 24_000, 24_000, 24_000] + traditional_401k_contributions: [18_000, 24_000, 24_000, 24_000] + +- name: Case 12, 2018 deferral limits preserve the next-year increase. + # Notice 2017-64, $18,500 regular deferrals and $6,000 catch-up. + period: 2018 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000] + age: [49, 50] + traditional_401k_contributions_desired: [30_000, 30_000] + output: + elective_deferral_limit: [18_500, 24_500] + traditional_401k_contributions: [18_500, 24_500] + +# IRS retirement COLA table, PDF pages 1 and 3 (2019-2025); Notice 2018-83. +# https://www.irs.gov/pub/irs-tege/cola-table.pdf +- name: Case 13, 2019 actual elective deferrals respect that year's indexed cap. + period: 2019 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: &id001 + - 19_000 + - 25_000 + - 25_000 + traditional_401k_contributions: *id001 +- name: Case 14, 2020 actual elective deferrals respect that year's indexed cap. + period: 2020 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: &id002 + - 19_500 + - 26_000 + - 26_000 + traditional_401k_contributions: *id002 +- name: Case 15, 2021 actual elective deferrals respect that year's indexed cap. + period: 2021 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: &id003 + - 19_500 + - 26_000 + - 26_000 + traditional_401k_contributions: *id003 +- name: Case 16, 2022 actual elective deferrals respect that year's indexed cap. + period: 2022 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: &id004 + - 20_500 + - 27_000 + - 27_000 + traditional_401k_contributions: *id004 +- name: Case 17, 2023 actual elective deferrals respect that year's indexed cap. + period: 2023 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: &id005 + - 22_500 + - 30_000 + - 30_000 + traditional_401k_contributions: *id005 +- name: Case 18, 2024 actual elective deferrals respect that year's indexed cap. + period: 2024 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: &id006 + - 23_000 + - 30_500 + - 30_500 + traditional_401k_contributions: *id006 + +# IRS Notice 2025-67, PDF pages 1-2, and section 414(v)(2)(E). +- name: Case 19, 2026 actual deferrals include standard and enhanced catch-up limits. + period: 2026 + absolute_error_margin: 0.01 + input: + employment_income: [100_000, 100_000, 100_000] + age: + - 49 + - 50 + - 62 + traditional_401k_contributions_desired: + - 50_000 + - 50_000 + - 50_000 + output: + elective_deferral_limit: + - 24_500 + - 32_500 + - 35_750 + traditional_401k_contributions: + - 24_500 + - 32_500 + - 35_750 diff --git a/policyengine_us/tests/policy/baseline/household/expense/retirement/ira_contribution_limit.yaml b/policyengine_us/tests/policy/baseline/household/expense/retirement/ira_contribution_limit.yaml index 9d698e8cac8..fb00cc81524 100644 --- a/policyengine_us/tests/policy/baseline/household/expense/retirement/ira_contribution_limit.yaml +++ b/policyengine_us/tests/policy/baseline/household/expense/retirement/ira_contribution_limit.yaml @@ -132,3 +132,158 @@ output: ira_contribution_limit: [7_500, 3_000] traditional_ira_contributions: [0, 3_000] + +- name: Case 8, 2017 IRA limit includes the age-fifty catch-up. + # Publication 590-A (2017), PDF page 5: $5,500 or $6,500 at age 50+. + period: 2017 + input: + age: [49, 50] + ira_compensation: [100_000, 100_000] + traditional_ira_contributions_desired: [10_000, 10_000] + output: + ira_contribution_limit: [5_500, 6_500] + traditional_ira_contributions: [5_500, 6_500] + +# IRS retirement COLA table, PDF pages 2 and 3, section 219(b)(5)(A). +# https://www.irs.gov/pub/irs-tege/cola-table.pdf +# Section 219(b)(5)(B) supplies the $1,000 catch-up through 2025. +- name: Case 9, 2018 generated IRA contributions respect the annual and catch-up limits. + period: 2018 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id001 + - 5_500 + - 6_500 + traditional_ira_contributions: *id001 +- name: Case 10, 2019 generated IRA contributions respect the annual and catch-up limits. + period: 2019 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id002 + - 6_000 + - 7_000 + traditional_ira_contributions: *id002 +- name: Case 11, 2020 generated IRA contributions respect the annual and catch-up limits. + period: 2020 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id003 + - 6_000 + - 7_000 + traditional_ira_contributions: *id003 +- name: Case 12, 2021 generated IRA contributions respect the annual and catch-up limits. + period: 2021 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id004 + - 6_000 + - 7_000 + traditional_ira_contributions: *id004 +- name: Case 13, 2022 generated IRA contributions respect the annual and catch-up limits. + period: 2022 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id005 + - 6_000 + - 7_000 + traditional_ira_contributions: *id005 +- name: Case 14, 2023 generated IRA contributions respect the annual and catch-up limits. + period: 2023 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id006 + - 6_500 + - 7_500 + traditional_ira_contributions: *id006 +- name: Case 15, 2025 generated IRA contributions respect the annual and catch-up limits. + period: 2025 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: &id007 + - 7_000 + - 8_000 + traditional_ira_contributions: *id007 + +# IRS Notice 2025-67, PDF page 4, sections 219(b)(5)(A) and (B). +- name: Case 16, 2026 IRA catch-up uses the newly indexed eleven hundred dollars. + period: 2026 + input: + age: + - 49 + - 50 + ira_compensation: + - 50_000 + - 50_000 + traditional_ira_contributions_desired: + - 20_000 + - 20_000 + output: + ira_contribution_limit: + - 7_500 + - 8_600 + traditional_ira_contributions: + - 7_500 + - 8_600 diff --git a/policyengine_us/tests/policy/baseline/household/expense/retirement/self_employed_pension_contribution_limit.yaml b/policyengine_us/tests/policy/baseline/household/expense/retirement/self_employed_pension_contribution_limit.yaml index 0bc881fb9a9..f0e1416a8e4 100644 --- a/policyengine_us/tests/policy/baseline/household/expense/retirement/self_employed_pension_contribution_limit.yaml +++ b/policyengine_us/tests/policy/baseline/household/expense/retirement/self_employed_pension_contribution_limit.yaml @@ -441,3 +441,101 @@ self_employed_pension_contribution_limit: 0 self_employed_pension_contributions: 0 self_employed_pension_contribution_ald_person: 0 + +- name: Case 1, 2017 annual additions limit is fifty-four thousand dollars. + # Notice 2016-62, PDF page 1, section 415(c)(1)(A). + period: 2017 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 54_000 + self_employed_pension_contributions: 54_000 + +- name: Case 2, 2017 catch-up contributions sit outside the annual additions limit. + # Sections 414(v)(3)(A) and 415(c); Notice 2016-62, PDF pages 1-2. + period: 2017 + input: + age: 50 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 60_000 + self_employed_pension_contributions: 60_000 + +- name: Case 3, 2018 annual additions preserve the next-year increase. + # Notice 2017-64, section 415(c)(1)(A). + period: 2018 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 55_000 + +# IRS retirement COLA table, PDF pages 1 and 3, section 415(c)(1)(A). +# https://www.irs.gov/pub/irs-tege/cola-table.pdf +- name: Case 4, 2019 actual self-employed additions stop at that year's dollar limit. + period: 2019 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 56_000 + self_employed_pension_contributions: 56_000 +- name: Case 5, 2020 actual self-employed additions stop at that year's dollar limit. + period: 2020 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 57_000 + self_employed_pension_contributions: 57_000 +- name: Case 6, 2021 actual self-employed additions stop at that year's dollar limit. + period: 2021 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 58_000 + self_employed_pension_contributions: 58_000 +- name: Case 7, 2022 actual self-employed additions stop at that year's dollar limit. + period: 2022 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 61_000 + self_employed_pension_contributions: 61_000 +- name: Case 8, 2023 actual self-employed additions stop at that year's dollar limit. + period: 2023 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 66_000 + self_employed_pension_contributions: 66_000 +- name: Case 9, 2024 actual self-employed additions stop at that year's dollar limit. + period: 2024 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 69_000 + self_employed_pension_contributions: 69_000 +- name: Case 10, 2025 actual self-employed additions stop at that year's dollar limit. + period: 2025 + input: + age: 40 + self_employed_pension_earned_income: 500_000 + self_employed_pension_contributions_desired: 100_000 + output: + self_employed_pension_contribution_limit: 70_000 + self_employed_pension_contributions: 70_000 diff --git a/policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml b/policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml new file mode 100644 index 00000000000..8c285385bf3 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml @@ -0,0 +1,139 @@ +# Publication 590-A (2017), PDF page 5: a traditional IRA contributor must +# not have reached age 70 1/2 by year-end; Roth contributions have no age cap. +# SECURE Act, Pub. L. 116-94, Division O, section 107(a),(d), repeals the +# traditional age bar for contributions for tax years beginning after 2019. +# Ages below are supplied fractional ages at the close of the tax year. +- name: Case 1, 2017 traditional contributions stop exactly at age seventy and a half. + period: 2017 + input: + age: [70.49, 70.5, 71] + ira_compensation: [10_000, 10_000, 10_000] + traditional_ira_contributions_desired: [1_000, 1_000, 1_000] + output: + traditional_ira_contributions: [1_000, 0, 0] + traditional_ira_deduction: [1_000, 0, 0] + +- name: Case 2, the traditional age bar still applies in 2019 and leaves Roth available. + period: 2019 + input: + age: 70.5 + ira_compensation: 10_000 + traditional_ira_contributions_desired: 1_000 + roth_ira_contributions_desired: 1_000 + output: + traditional_ira_contributions: 0 + roth_ira_contributions: 1_000 + +- name: Case 3, traditional contributions become available at older ages from 2020. + period: 2020 + input: + age: 70.5 + ira_compensation: 10_000 + traditional_ira_contributions_desired: 1_000 + roth_ira_contributions_desired: 1_000 + output: + traditional_ira_contributions: 1_000 + traditional_ira_deduction: 1_000 + roth_ira_contributions: 1_000 + +- name: Case 4, the modern traditional contribution rule retains no age cap. + period: 2026 + input: + age: 90 + ira_compensation: 10_000 + traditional_ira_contributions_desired: 1_000 + output: + traditional_ira_contributions: 1_000 + traditional_ira_deduction: 1_000 + +- name: Case 5, ineligible desired traditional contributions do not displace Roth contributions. + # Publication 590-A (2017), PDF page 5: the combined allowance is $6,500 + # at age 50+, and Roth contributions have no upper-age restriction. + period: 2017 + input: + age: 70.5 + ira_compensation: 20_000 + traditional_ira_contributions_desired: 10_000 + roth_ira_contributions_desired: 10_000 + output: + ira_contribution_limit: 6_500 + traditional_ira_contributions: 0 + roth_ira_contributions: 6_500 + +- name: Case 6, a supplied traditional amount cannot produce an age-barred deduction. + # Actual input values can override contribution formulas; section 219(d)(1) + # nevertheless barred the deduction before the SECURE Act's repeal. + period: 2017 + input: + age: 70.5 + ira_compensation: 10_000 + traditional_ira_contributions: 1_000 + output: + traditional_ira_deduction: 0 + +- name: Case 7, an older earner's ineligible desired contributions leave compensation for a younger spouse. + # Publication 590-A (2017), PDF page 9, spousal IRA limit: the younger + # spouse can use $10,000 of joint compensation, capped at their $6,500. + period: 2017 + input: + people: + person1: + age: 70.5 + employment_income: 10_000 + traditional_ira_contributions_desired: 6_500 + is_tax_unit_head: true + person2: + age: 50 + traditional_ira_contributions_desired: 6_500 + is_tax_unit_spouse: true + tax_units: + tax_unit: + members: [person1, person2] + filing_status: JOINT + marital_units: + marital_unit: + members: [person1, person2] + output: + traditional_ira_contributions: [0, 6_500] + traditional_ira_deduction: [0, 6_500] + +- name: Case 8, the age bar also applies to a dependent's separately calculated deduction. + period: 2017 + input: + age: 70.5 + ira_compensation: 10_000 + traditional_ira_contributions: 1_000 + is_tax_unit_dependent: true + is_tax_unit_head_or_spouse: false + ira_active_participant: false + dependent_lives_with_spouse: false + output: + dependent_traditional_ira_deduction: 0 + +- name: Case 9, an age-barred supplied amount does not consume a younger spouse's compensation. + # 219(c)(1)(B) subtracts deductible/designated-nondeductible traditional + # amounts; 408(o)(2)(B) and former 219(d)(1) allow neither for the older + # spouse. Actual inputs remain supplied amounts, but cannot reduce the + # younger spouse's $6,500 allowance from $10,000 of joint compensation. + period: 2017 + input: + people: + person1: + age: 70.5 + employment_income: 10_000 + traditional_ira_contributions: 6_500 + is_tax_unit_head: true + person2: + age: 50 + traditional_ira_contributions: 6_500 + is_tax_unit_spouse: true + tax_units: + tax_unit: + members: [person1, person2] + filing_status: JOINT + marital_units: + marital_unit: + members: [person1, person2] + output: + ira_contribution_limit: [6_500, 6_500] + traditional_ira_deduction: [0, 6_500] diff --git a/policyengine_us/tests/test_ira_formula_differential.py b/policyengine_us/tests/test_ira_formula_differential.py index 12eccaabdc1..250d0535d79 100644 --- a/policyengine_us/tests/test_ira_formula_differential.py +++ b/policyengine_us/tests/test_ira_formula_differential.py @@ -21,6 +21,9 @@ from types import SimpleNamespace import numpy as np +import pytest +from hypothesis import given, settings, strategies as st +from policyengine_core.parameters import ParameterNode VARIABLES = Path(__file__).resolve().parents[1] / "variables" @@ -66,6 +69,11 @@ class People: def __init__(self, values, tax_groups=None, tax_values=None, marital_groups=None): self.values = {key: np.asarray(value) for key, value in values.items()} self.count = len(next(iter(self.values.values()))) + # The existing oracle cases use 2026 rules, with no traditional IRA + # age bar. Historical cases supply this dependency explicitly. + self.values.setdefault( + "traditional_ira_age_eligible", np.ones(self.count, dtype=bool) + ) groups = np.arange(self.count) if tax_groups is None else tax_groups self.tax_unit = Group(groups, tax_values) self.marital_unit = Group( @@ -519,6 +527,96 @@ def test_generated_single_contributions_preserve_shares_within_compensation(): ) +_HISTORICAL_IRA_TEST_AMOUNTS = st.integers(min_value=0, max_value=2_000_000).map( + lambda cents: cents / 100 +) + + +@settings(max_examples=40, deadline=None) +@given( + rows=st.lists( + st.tuples( + _HISTORICAL_IRA_TEST_AMOUNTS, + _HISTORICAL_IRA_TEST_AMOUNTS, + _HISTORICAL_IRA_TEST_AMOUNTS, + ), + min_size=1, + max_size=12, + ) +) +def test_historical_age_bar_leaves_roth_allowance_independent_of_traditional_desire( + rows, +): + """Pub. 590-A (2017), page 5: only Roth remains available at age 70.5+.""" + count = len(rows) + people = People( + { + "ira_compensation": [row[0] for row in rows], + "traditional_ira_contributions_desired": [row[1] for row in rows], + "roth_ira_contributions_desired": [row[2] for row in rows], + "age": np.full(count, 70.5), + "traditional_ira_age_eligible": np.zeros(count, dtype=bool), + "is_tax_unit_head_or_spouse": np.ones(count, dtype=bool), + }, + tax_values={"tax_unit_is_joint": np.zeros(count, dtype=bool)}, + ) + historical = parameters() + retirement = historical(None).gov.irs.gross_income.retirement_contributions + # The external 2017 publication gives $5,500 plus $1,000 at age 50+. + retirement.limit.ira = 5_500 + retirement.catch_up.limit.ira = 1_000 + people.values["ira_contribution_limit"] = formula( + RETIREMENT / "ira_contribution_limit.py", "ira_contribution_limit" + )(people, None, historical) + people.values["ira_contribution_scale"] = formula( + RETIREMENT / "ira_contribution_scale.py", "ira_contribution_scale" + )(people, None, historical) + traditional = formula( + RETIREMENT / "traditional_ira_contributions.py", "traditional_ira_contributions" + )(people, None, historical) + roth = formula(RETIREMENT / "roth_ira_contributions.py", "roth_ira_contributions")( + people, None, historical + ) + # With traditional contributions age-barred, their desired amount cannot + # reduce the separate Roth allowance: compensation, desired Roth, or $6,500. + expected_roth = np.asarray([min(row[0], row[2], 6_500) for row in rows]) + np.testing.assert_array_equal(traditional, np.zeros(count)) + np.testing.assert_allclose(roth, expected_roth, rtol=1e-10, atol=1e-8) + assert np.all(np.isfinite(roth)) + assert np.all(traditional + roth <= people("ira_contribution_limit", None) + 1e-8) + + +@pytest.fixture(scope="module") +def retirement_parameter_subtree(): + """Read only the small retirement subtree, without building a US model.""" + directory = ( + VARIABLES.parent / "parameters/gov/irs/gross_income/retirement_contributions" + ) + return ParameterNode(directory_path=directory) + + +@pytest.mark.parametrize("year", range(2017, 2027)) +def test_traditional_age_gate_matches_the_statute_in_every_year( + year, retirement_parameter_subtree +): + """Former 219(d)(1) through 2019; SECURE Act section 107 from 2020.""" + ages = np.array([18, 49, 50, 70, 70.49, 70.5, 70.51, 71, 90], dtype=np.float32) + people = People({"age": ages}) + selected = retirement_parameter_subtree(f"{year}-01-01") + annual = parameters() + annual( + None + ).gov.irs.gross_income.retirement_contributions.limit.traditional_ira_age = ( + selected.limit.traditional_ira_age + ) + calculate = formula( + RETIREMENT / "traditional_ira_age_eligible.py", "traditional_ira_age_eligible" + ) + actual = calculate(people, None, annual) + expected = ages < 70.5 if year <= 2019 else np.ones(len(ages), dtype=bool) + np.testing.assert_array_equal(actual, expected) + + def test_dependent_helper_repeats_the_formula_without_line_1e(): # ira_compensation_without_line_1e repeats the formula's sum without # Form 1040 line 1e, so with line 1e at zero the two agree on every term. diff --git a/policyengine_us/tools/taxsim/generate_federal_tax_history_reference.py b/policyengine_us/tools/taxsim/generate_federal_tax_history_reference.py new file mode 100644 index 00000000000..bee90eb257a --- /dev/null +++ b/policyengine_us/tools/taxsim/generate_federal_tax_history_reference.py @@ -0,0 +1,294 @@ +"""Generate 60 independent federal tax reference cases, every year 2017-2026. + +Run this file directly in an isolated environment containing Tax-Calculator 6.9.1. +It imports no PolicyEngine runtime and writes only to an explicit new JSON file. +Tax-Calculator's exact mode preserves statutory steps; it does not reproduce +every IRS tax-table or filing-rounding convention. The 2020-2021 credits represent +annual entitlement rather than a filing balance net of advance payments. +""" + +import argparse +import hashlib +import importlib.metadata +import json +import platform +from pathlib import Path + + +TAXCALC_VERSION = "6.9.1" +YEARS = tuple(range(2017, 2027)) +ORIGINAL_YEARS = (2017, 2018, 2021, 2026) +LEGACY_REFERENCE_SHA256 = ( + "4c224c18070c060a58cf7000deb75bef08ae0e3cf52466aeab212cc22f002c9f" +) +TAXCALC_SOURCE_HASHES = { + "records.py": "6ca49df37ea153403ed00dfc8afae7e24ed7b832ecbcff63a72397a61c35f697", + "calculator.py": "e869a26948b5c9f4ecfa717280b48ac003cc0fa9e7bd7f64ec4ca6231b742715", + "calcfunctions.py": "bfee8b802307cc7c613a0e74943b3a8a0316448950ac7794d5c4dea06fc33ff8", + "policy_current_law.json": ( + "80f97af457e05f30d94667cf4c0089a950efcced6f300f04912471035b50d2cc" + ), + "records_variables.json": ( + "a123615110212c5c3679b04e7d5813a6eff8356b37d1a89b59f3b5ddd5b72f15" + ), +} +CASES = [ + {"id": "single_wages", "status": "SINGLE", "wages": [40_000], "children": []}, + { + "id": "parent_eitc", + "status": "HEAD_OF_HOUSEHOLD", + "wages": [20_000], + "children": [8], + }, + { + "id": "joint_children", + "status": "JOINT", + "wages": [40_000, 0], + "children": [8, 12], + }, + { + "id": "joint_ctc_phaseout", + "status": "JOINT", + "wages": [120_001, 0], + "children": [8, 12], + }, + { + "id": "single_exemption_phaseout", + "status": "SINGLE", + "wages": [300_001], + "children": [], + }, + { + "id": "joint_two_earners", + "status": "JOINT", + "wages": [35_000, 35_000], + "children": [8, 12], + }, +] +MARS = {"SINGLE": 1, "JOINT": 2, "HEAD_OF_HOUSEHOLD": 4} +FIELDS = { + "adjusted_gross_income": "c00100", + "standard_deduction": "standard", + "exemptions": "c04600", + "taxable_income": "c04800", + "income_tax_before_credits": "c05800", + "eitc": "eitc", + "income_tax": "iitax", +} + + +def sha256(data: bytes) -> str: + """Return a lowercase digest of source or serialized reference bytes.""" + return hashlib.sha256(data).hexdigest() + + +def validate_version(actual: str) -> None: + """Reject another oracle version before performing calculations.""" + if actual != TAXCALC_VERSION: + raise RuntimeError(f"Requires Tax-Calculator {TAXCALC_VERSION}; found {actual}") + + +def validate_years(years) -> None: + """Reject gaps, duplicates, reordering, or changed coverage endpoints.""" + if tuple(years) != tuple(range(2017, 2027)): + raise RuntimeError("Reference requires every year 2017 through 2026 in order") + + +def original_reference_subset(reference: dict) -> dict: + """Retain the original 24-case reference for its unchanged-byte check.""" + return { + **{key: value for key, value in reference.items() if key != "provenance"}, + "years": {str(year): reference["years"][str(year)] for year in ORIGINAL_YEARS}, + } + + +def verify_source_hashes(root: Path, expected: dict[str, str]) -> dict[str, str]: + """Reject modifications to the pinned oracle's relevant source files.""" + observed = {} + for name, digest in expected.items(): + observed[name] = sha256((root / name).read_bytes()) + if observed[name] != digest: + raise RuntimeError( + f"Tax-Calculator source differs from the reference: {name}" + ) + return observed + + +def validate_policy_assumptions(policy) -> None: + """Check the income-tax bucket and equal FICA shares used by this mapping.""" + if list(policy.soi_iitax) != [False]: + raise RuntimeError("Reference requires soi_iitax=False") + for component in ("FICA_ss", "FICA_mc"): + employer = list(getattr(policy, f"{component}_trt_employer")) + employee = list(getattr(policy, f"{component}_trt_employee")) + if employer != employee: + raise RuntimeError( + f"Reference requires equal {component} employer/employee rates" + ) + + +def record_inputs(year: int) -> list[dict]: + """Describe each synthetic filing unit in Tax-Calculator input variables.""" + rows = [] + for index, case in enumerate(CASES): + adults, children = len(case["wages"]), len(case["children"]) + rows.append( + { + "RECID": index + 1, + "MARS": MARS[case["status"]], + "FLPDYR": year, + "XTOT": adults + children, + "e00200": sum(case["wages"]), + "e00200p": case["wages"][0], + "e00200s": case["wages"][-1] if adults == 2 else 0, + "n24": children, + "EIC": children, + "nu18": children, + "n21": adults, + "age_head": 35, + "age_spouse": 33 if adults == 2 else 0, + } + ) + return rows + + +def generate_reference() -> dict: + """Run the pinned external oracle for every specified case and year.""" + validate_years(YEARS) + version = importlib.metadata.version("taxcalc") + validate_version(version) + distribution = importlib.metadata.distribution("taxcalc") + sources = verify_source_hashes( + Path(distribution.locate_file("taxcalc")), TAXCALC_SOURCE_HASHES + ) + + import pandas as pd + from taxcalc import Calculator, Policy, Records + + output = { + "taxcalc_version": version, + "exact_calculations": True, + "start_year_equals_policy_year": True, + "no_aging_or_microdata": True, + "full_credit_takeup": True, + "employee_payroll_mapping": "ptax_was / 2 + ptax_amc; wages-only records", + "cases": CASES, + "years": {}, + } + inputs = {} + for year in YEARS: + rows = record_inputs(year) + inputs[str(year)] = rows + records = Records( + data=pd.DataFrame(rows), + start_year=year, + gfactors=None, + weights=None, + adjust_ratios=None, + exact_calculations=True, + ) + records.credit_claim_urn[:] = 0 + if not all(value == 1 for value in records.exact): + raise RuntimeError("Tax-Calculator did not enable exact statutory steps") + policy = Policy() + policy.set_year(year) + validate_policy_assumptions(policy) + calc = Calculator(policy=policy, records=records) + if calc.current_year != year or records.current_year != year: + raise RuntimeError("Reference policy and record years must match") + if not all(value == 0 for value in calc.array("credit_claim_urn")): + raise RuntimeError("Reference requires full eligible-credit receipt") + calc.calc_all() + result = {} + for index, case in enumerate(CASES): + result[case["id"]] = { + name: float(calc.array(source)[index]) + for name, source in FIELDS.items() + } + # Ordinary wage FICA includes both halves; Additional Medicare + # is employee-only. There are no self-employment or state taxes. + result[case["id"]]["employee_payroll_tax"] = float( + calc.array("ptax_was")[index] / 2 + calc.array("ptax_amc")[index] + ) + output["years"][str(year)] = result + + legacy_digest = sha256( + (json.dumps(original_reference_subset(output), indent=2) + "\n").encode() + ) + if legacy_digest != LEGACY_REFERENCE_SHA256: + raise RuntimeError( + "Oracle inputs/results differ from the archived reference; " + f"expected {LEGACY_REFERENCE_SHA256}, found {legacy_digest}" + ) + output["provenance"] = { + "generator_source_sha256": sha256(Path(__file__).read_bytes()), + "taxcalc_source_sha256": sources, + "legacy_reference_sha256": legacy_digest, + "legacy_reference_years": list(ORIGINAL_YEARS), + "reference_years": list(YEARS), + "contiguous_years": True, + "reference_without_provenance_sha256": sha256( + (json.dumps(output, indent=2) + "\n").encode() + ), + "versions": { + "python": platform.python_version(), + **{ + name: importlib.metadata.version(name) + for name in ("taxcalc", "pandas", "numpy", "numba") + }, + }, + "taxcalc_record_inputs_by_year": inputs, + "soi_iitax": False, + "credit_claim_urn": 0, + "record_arguments": { + "gfactors": None, + "weights": None, + "adjust_ratios": None, + "exact_calculations": True, + }, + "scope": ( + "Wages-only hypothetical filing units; annual credit entitlements; " + "unsmoothed statutory steps and rate schedules, not every IRS " + "tax-table or filing-rounding convention. No survey records." + ), + } + return output + + +def write_reference(output: Path, reference: dict) -> None: + """Write a new explicit JSON artifact without replacing existing files.""" + if output.suffix.lower() != ".json": + raise ValueError("Reference output must use a .json extension (JSON only)") + with output.open("x") as handle: + handle.write(json.dumps(reference, indent=2) + "\n") + + +def main() -> None: + """Expose the standalone generator without modifying committed YAML tests.""" + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--output", required=True, type=Path) + args = parser.parse_args() + if args.output.suffix.lower() != ".json": + parser.error("--output must use a .json extension") + if args.output.exists(): + parser.error("--output must name a new file") + try: + reference = generate_reference() + write_reference(args.output, reference) + except (RuntimeError, OSError, importlib.metadata.PackageNotFoundError) as error: + parser.exit(1, f"{error}\n") + print( + json.dumps( + { + "taxcalc_version": TAXCALC_VERSION, + "cases": len(CASES) * len(YEARS), + "years": list(YEARS), + "sha256": sha256(args.output.read_bytes()), + "legacy_reference_sha256": LEGACY_REFERENCE_SHA256, + } + ) + ) + + +if __name__ == "__main__": + main() diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.py b/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.py new file mode 100644 index 00000000000..271116e440c --- /dev/null +++ b/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.py @@ -0,0 +1,22 @@ +from policyengine_us.model_api import * + + +class cdcc_qualified_care_expenses(Variable): + value_type = float + entity = TaxUnit + label = "Qualified care expenses before dependent care benefits" + unit = USD + definition_period = YEAR + reference = ( + "https://www.law.cornell.edu/uscode/text/26/21#b_2", + "https://www.law.cornell.edu/uscode/text/26/129#e_1", + "https://www.irs.gov/pub/irs-prior/f2441--2017.pdf#page=2", + "https://www.irs.gov/pub/irs-prior/f2441--2025.pdf#page=2", + ) + + def formula(tax_unit, period, parameters): + expenses = add( + tax_unit, period, ["cdcc_qualifying_childcare_expenses", "care_expenses"] + ) + has_qualifying_individual = tax_unit("count_cdcc_eligible", period) > 0 + return where(has_qualifying_individual, max_(expenses, 0), 0) diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_relevant_expenses.py b/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_relevant_expenses.py index aa020f78a20..35e391de986 100644 --- a/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_relevant_expenses.py +++ b/policyengine_us/variables/gov/irs/credits/cdcc/cdcc_relevant_expenses.py @@ -10,20 +10,19 @@ class cdcc_relevant_expenses(Variable): reference = ( "https://www.law.cornell.edu/uscode/text/26/21#c", "https://www.law.cornell.edu/uscode/text/26/21#d_1", + "https://www.irs.gov/pub/irs-prior/f2441--2017.pdf#page=2", + "https://www.irs.gov/pub/irs-prior/f2441--2021.pdf#page=2", + "https://www.irs.gov/pub/irs-prior/f2441--2025.pdf#page=2", ) def formula(tax_unit, period, parameters): - # Section 21 employment-related expenses cover care for any qualifying - # individual: childcare for children under 13 - # (tax_unit_childcare_expenses) plus care for a disabled qualifying - # individual of any age — a disabled adult dependent or spouse - # (care_expenses, a person-level yearly input). - # cdcc_qualifying_childcare_expenses leaves out childcare for a child - # who is not a qualifying individual because a filer can be claimed - # as a dependent. - childcare = tax_unit("cdcc_qualifying_childcare_expenses", period) - adult_care = add(tax_unit, period, ["care_expenses"]) - expenses = childcare + adult_care + # Form 2441 line 30 excludes expenses paid with the benefits already + # excluded under section 129; line 29 separately reduces the dollar cap. + expenses = max_( + tax_unit("cdcc_qualified_care_expenses", period) + - tax_unit("dependent_care_assistance_exclusion", period), + 0, + ) cdcc_limit = tax_unit("cdcc_limit", period) eligible_capped_expenses = min_(expenses, cdcc_limit) # cap further to the lowest earnings between the taxpayer and spouse diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py b/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py index 3746d08563b..c6b255f231c 100644 --- a/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py +++ b/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py @@ -20,7 +20,9 @@ class dependent_care_assistance_exclusion(Variable): # ARPA section 9632 temporarily increased the cap for 2021. "https://www.govinfo.gov/content/pkg/PLAW-117publ2/pdf/PLAW-117publ2.pdf#page=158", # Form 2441 Part III lines 12-26 compute the excluded benefit. + "https://www.irs.gov/pub/irs-prior/f2441--2017.pdf#page=2", "https://www.irs.gov/pub/irs-prior/f2441--2021.pdf#page=2", + "https://www.irs.gov/pub/irs-prior/f2441--2025.pdf#page=2", "https://www.irs.gov/instructions/i2441", ) @@ -48,4 +50,11 @@ def formula(tax_unit, period, parameters): # min_head_spouse_earned returns the taxpayer's earnings when unmarried # and the lesser of the two when married filing jointly. earned_income_limit = tax_unit("min_head_spouse_earned", period) - return min_(benefits, min_(dollar_cap, earned_income_limit)) + qualified_expenses = tax_unit("cdcc_qualified_care_expenses", period) + return max_( + min_( + benefits, + min_(qualified_expenses, min_(dollar_cap, earned_income_limit)), + ), + 0, + ) diff --git a/policyengine_us/variables/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.py b/policyengine_us/variables/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.py index 0ffc8504445..9502f949439 100644 --- a/policyengine_us/variables/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.py +++ b/policyengine_us/variables/gov/irs/credits/ctc/maximum/individual/meets_ctc_child_identification_requirements.py @@ -6,7 +6,11 @@ class meets_ctc_child_identification_requirements(Variable): entity = Person definition_period = YEAR label = "Child meets CTC identification requirements" - reference = "https://www.law.cornell.edu/uscode/text/26/24#h_7" + reference = ( + "https://www.law.cornell.edu/uscode/text/26/24#e_1", + "https://www.law.cornell.edu/uscode/text/26/24#h_7", + "https://www.irs.gov/pub/irs-prior/p972--2017.pdf#page=3", + ) def formula(person, period, parameters): p = parameters(period).gov.irs.credits.ctc @@ -15,4 +19,4 @@ def formula(person, period, parameters): ssn_card_str = ssn_card_type.decode_to_str() p = parameters(period).gov.irs.credits.ctc return np.isin(ssn_card_str, p.eligible_ssn_card_type) - return True + return person("has_tin", period) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/dependent_traditional_ira_deduction.py b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/dependent_traditional_ira_deduction.py index 8b896ddd0e6..d778d38b21a 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/dependent_traditional_ira_deduction.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/dependent_traditional_ira_deduction.py @@ -88,4 +88,6 @@ def formula(person, period, parameters): spouse_active = person.marital_unit.sum(active) > active.astype(int) phased = active | (lives_with_spouse & spouse_active) limit = min_(compensation, where(phased, phased_limit, dollar_limit)) - return min_(contributions, limit) + return min_(contributions, limit) * person( + "traditional_ira_age_eligible", period + ) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/traditional_ira_deduction.py b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/traditional_ira_deduction.py index 1175e16e46e..04edfe84418 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/traditional_ira_deduction.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/above_the_line_deductions/ira/traditional_ira_deduction.py @@ -39,7 +39,7 @@ def formula(person, period, parameters): # Only the higher earner's allowance is needed for the lower earner. compensation_consumed = min_( max_(0, contributions), min_(compensation, dollar_limit) - ) + max_(0, roth_contributions) + ) * person("traditional_ira_age_eligible", period) + max_(0, roth_contributions) spouse_contributions = max_( 0, person.tax_unit.sum(compensation_consumed * filer) - compensation_consumed, @@ -61,8 +61,9 @@ def formula(person, period, parameters): # A tax unit dependent's deduction is on the dependent's own return. # It is recorded on the dependent so that person-level consumers see # it; the filers' above-the-line total sums the head and spouse only. - return where( + deduction = where( person("is_tax_unit_dependent", period), person("dependent_traditional_ira_deduction", period), filer_deduction, ) + return deduction * person("traditional_ira_age_eligible", period) diff --git a/policyengine_us/variables/household/expense/retirement/_ira_supplied_contributions.py b/policyengine_us/variables/household/expense/retirement/_ira_supplied_contributions.py index 990a0a17e93..5b78ba37726 100644 --- a/policyengine_us/variables/household/expense/retirement/_ira_supplied_contributions.py +++ b/policyengine_us/variables/household/expense/retirement/_ira_supplied_contributions.py @@ -64,7 +64,9 @@ def traditional_ira_contributions_without_spousal_rule(person, period, own_limit supplied_traditional = supplied["traditional_ira_contributions"] if supplied_traditional is not None: return max_(supplied_traditional, 0) - desired_traditional = person("traditional_ira_contributions_desired", period) + desired_traditional = person( + "traditional_ira_contributions_desired", period + ) * person("traditional_ira_age_eligible", period) supplied_roth = supplied["roth_ira_contributions"] if supplied_roth is None: generated_desired = desired_traditional + person( diff --git a/policyengine_us/variables/household/expense/retirement/ira_contribution_limit.py b/policyengine_us/variables/household/expense/retirement/ira_contribution_limit.py index a53cb854e56..0cae979145e 100644 --- a/policyengine_us/variables/household/expense/retirement/ira_contribution_limit.py +++ b/policyengine_us/variables/household/expense/retirement/ira_contribution_limit.py @@ -47,11 +47,11 @@ def formula(person, period, parameters): if supplied_traditional is None: generated_desired = generated_desired + person( "traditional_ira_contributions_desired", period - ) + ) * person("traditional_ira_age_eligible", period) else: supplied_consumed = supplied_consumed + min_( max_(supplied_traditional, 0), own_limit - ) + ) * person("traditional_ira_age_eligible", period) if supplied_roth is None: generated_desired = generated_desired + person( "roth_ira_contributions_desired", period diff --git a/policyengine_us/variables/household/expense/retirement/ira_contribution_scale.py b/policyengine_us/variables/household/expense/retirement/ira_contribution_scale.py index 6b298c95b93..35c9fe5492c 100644 --- a/policyengine_us/variables/household/expense/retirement/ira_contribution_scale.py +++ b/policyengine_us/variables/household/expense/retirement/ira_contribution_scale.py @@ -33,7 +33,10 @@ def formula(person, period, parameters): ("roth_ira_contributions", "roth_ira_contributions_desired"), ): if supplied[name] is None: - generated_desired = generated_desired + person(desired, period) + amount = person(desired, period) + if name == "traditional_ira_contributions": + amount = amount * person("traditional_ira_age_eligible", period) + generated_desired = generated_desired + amount else: supplied_own = supplied_own + max_(supplied[name], 0) available = max_(person("ira_contribution_limit", period) - supplied_own, 0) diff --git a/policyengine_us/variables/household/expense/retirement/traditional_ira_age_eligible.py b/policyengine_us/variables/household/expense/retirement/traditional_ira_age_eligible.py new file mode 100644 index 00000000000..810c4155d5c --- /dev/null +++ b/policyengine_us/variables/household/expense/retirement/traditional_ira_age_eligible.py @@ -0,0 +1,17 @@ +from policyengine_us.model_api import * + + +class traditional_ira_age_eligible(Variable): + value_type = bool + entity = Person + definition_period = YEAR + label = "Meets the traditional IRA contribution age restriction" + reference = ( + "https://www.irs.gov/pub/irs-prior/p590a--2017.pdf#page=5", + # PDF pages 616-617: repeal of section 219(d)(1), effective after 2019. + "https://www.govinfo.gov/content/pkg/PLAW-116publ94/pdf/PLAW-116publ94.pdf#page=616", + ) + + def formula(person, period, parameters): + p = parameters(period).gov.irs.gross_income.retirement_contributions.limit + return person("age", period) < p.traditional_ira_age diff --git a/policyengine_us/variables/household/expense/retirement/traditional_ira_contributions.py b/policyengine_us/variables/household/expense/retirement/traditional_ira_contributions.py index 40195fbff06..0bcd948a8a1 100644 --- a/policyengine_us/variables/household/expense/retirement/traditional_ira_contributions.py +++ b/policyengine_us/variables/household/expense/retirement/traditional_ira_contributions.py @@ -11,7 +11,8 @@ class traditional_ira_contributions(Variable): "traditional and Roth IRA contribution limit. If desired IRA " "contributions exceed the limit, PolicyEngine preserves desired " "allocation shares by scaling traditional and Roth IRA contributions " - "proportionally." + "proportionally. Before 2020, desired traditional contributions are " + "excluded at age 70.5 or older at the close of the tax year." ) definition_period = YEAR reference = "https://www.law.cornell.edu/uscode/text/26/219#b" @@ -19,4 +20,4 @@ class traditional_ira_contributions(Variable): def formula(person, period, parameters): desired = person("traditional_ira_contributions_desired", period) scale = person("ira_contribution_scale", period) - return desired * scale + return desired * scale * person("traditional_ira_age_eligible", period) From 1bad79ead7149abb4e1fa691447aef89fd059e9d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 12 Nov 2026 15:31:19 -0500 Subject: [PATCH 3/5] Apply inclusive Saver credit ceilings to fractional AGI --- changelog.d/federal-tax-2017-history.fixed.md | 2 +- docs/gov/irs/historical-validation.md | 2 + .../credits/retirement_saving/rate/joint.yaml | 72 +++++---- ...est_federal_2017_tax_history_properties.py | 87 +++++++++++ .../savers_credit_person.yaml | 144 ++++++++++++++++++ .../savers_credit_person.py | 7 +- 6 files changed, 281 insertions(+), 33 deletions(-) diff --git a/changelog.d/federal-tax-2017-history.fixed.md b/changelog.d/federal-tax-2017-history.fixed.md index 8016896b61b..8382d7a55c7 100644 --- a/changelog.d/federal-tax-2017-history.fixed.md +++ b/changelog.d/federal-tax-2017-history.fixed.md @@ -1 +1 @@ -Correct 2017 personal-exemption phase-outs, tuition deduction accounting, CTC identification, retirement limits and Saver's Credit histories. Apply the pre-2020 traditional IRA age limit, cap dependent-care exclusions by qualified expenses, and prevent expense reuse in the care credit. Add annual federal tax reference cases for 2017–2026. +Correct 2017 personal-exemption phase-outs, tuition deduction accounting, CTC identification, retirement limits and Saver's Credit histories. Apply inclusive Saver's Credit bands to fractional AGI, enforce the pre-2020 traditional IRA age limit, cap dependent-care exclusions by qualified expenses, and prevent expense reuse in the care credit. Add annual federal tax reference cases for 2017–2026. diff --git a/docs/gov/irs/historical-validation.md b/docs/gov/irs/historical-validation.md index 32f040c1f87..f86ef2d0417 100644 --- a/docs/gov/irs/historical-validation.md +++ b/docs/gov/irs/historical-validation.md @@ -81,6 +81,8 @@ Every path below has the prefix `gov.irs.`. “Explicit 2017” means the parame Focused tests also cover the [personal-exemption phaseout](../../../policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml): a partial step triggers the full 2% reduction, as the [2017 worksheet, p. 41][instructions-1040] requires. [Dependent-care tests](../../../policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml) cover the actual qualified-expense ceiling and prevent reuse of excluded employer benefits for the child and dependent care credit, following [Form 2441, Part III][dcap]. [Traditional IRA tests](../../../policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml) cover the age-70.5 restriction through 2019 and its removal from 2020, following [Publication 590-A][ira-contributions] and [P.L. 116-94, Division O, §107][secure]. +[Saver's Credit examples](../../../policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml) check the published inclusive AGI ceilings and fractional income above them. [Generated populations](../../../policyengine_us/tests/core/test_federal_2017_tax_history_properties.py) repeat these checks for all five filing statuses in every year from 2017 through 2026. + The 60 wage cases do not exercise every flagged provision. They do not establish complete coverage of itemized deductions, AMT preferences, capital gains, retirement transactions, identification compliance or special filing situations. The TIN input does not encode issuance dates or every identification requirement; aggregate childcare spending cannot distinguish each child's eligible expense share in mixed-age families. Fractional age inputs can express the former IRA age boundary, but integer survey ages do not reconstruct birthdays. This validation covers selected federal household calculations. It does not establish historical accuracy for state taxes, benefit programs, household net resources or national 2017 population estimates. Those uses require their own policy-date, input and population checks. diff --git a/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml b/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml index 2e43369376a..0f9a40ba581 100644 --- a/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml +++ b/policyengine_us/parameters/gov/irs/credits/retirement_saving/rate/joint.yaml @@ -18,6 +18,16 @@ metadata: href: https://www.irs.gov/pub/irs-pdf/f8880.pdf#page=1 - title: 2018 Form 8880 href: https://www.irs.gov/pub/irs-prior/f8880--2018.pdf#page=1 + - title: "IRS Notice 2018-83, 2019 retirement amounts #page 2-3" + href: https://www.irs.gov/pub/irs-drop/n-18-83.pdf#page=2 + - title: "IRS Notice 2019-59, 2020 retirement amounts #page 2-3" + href: https://www.irs.gov/pub/irs-drop/n-19-59.pdf#page=2 + - title: "IRS Notice 2020-79, 2021 retirement amounts #page 2-3" + href: https://www.irs.gov/pub/irs-drop/n-20-79.pdf#page=2 + - title: IRS Notice 2021-61, 2022 retirement amounts + href: https://www.irs.gov/pub/irs-drop/n-21-61.pdf#page=3 + - title: IRS Notice 2022-55, 2023 retirement amounts + href: https://www.irs.gov/pub/irs-drop/n-22-55.pdf#page=3 - title: IRS Notice 2023-75, 2024 Amounts Relating to Retirement Plans and IRAs (25B(b)(1)(A)-(D) joint amounts $46,000/$50,000/$76,500) href: https://www.irs.gov/pub/irs-drop/n-23-75.pdf#page=3 - title: IRS Notice 2024-80, 2025 Amounts Relating to Retirement Plans and IRAs (25B(b)(1)(A)-(D) joint amounts $47,500/$51,000/$79,000) @@ -26,6 +36,8 @@ metadata: href: https://www.irs.gov/pub/irs-drop/n-25-67.pdf#page=3 brackets: + # Thresholds below are the published inclusive band tops; the formula uses + # right=True so each reduced rate applies only above the preceding ceiling. # The first row of the Form 8880 line 9 table has no lower bound ("---"), so # a negative adjusted gross income takes the highest rate. - threshold: @@ -36,46 +48,46 @@ brackets: 2018-01-01: 0.5 - threshold: values: - 2017-01-01: 37_001 - 2018-01-01: 38_001 - 2019-01-01: 38_501 - 2020-01-01: 39_001 - 2021-01-01: 39_501 - 2022-01-01: 41_001 - 2023-01-01: 43_501 - 2024-01-01: 46_001 - 2025-01-01: 47_501 - 2026-01-01: 48_501 + 2017-01-01: 37_000 + 2018-01-01: 38_000 + 2019-01-01: 38_500 + 2020-01-01: 39_000 + 2021-01-01: 39_500 + 2022-01-01: 41_000 + 2023-01-01: 43_500 + 2024-01-01: 46_000 + 2025-01-01: 47_500 + 2026-01-01: 48_500 amount: 2017-01-01: 0.2 2018-01-01: 0.2 - threshold: values: - 2017-01-01: 40_001 - 2018-01-01: 41_001 - 2019-01-01: 41_501 - 2020-01-01: 42_501 - 2021-01-01: 43_001 - 2022-01-01: 44_001 - 2023-01-01: 47_501 - 2024-01-01: 50_001 - 2025-01-01: 51_001 - 2026-01-01: 52_501 + 2017-01-01: 40_000 + 2018-01-01: 41_000 + 2019-01-01: 41_500 + 2020-01-01: 42_500 + 2021-01-01: 43_000 + 2022-01-01: 44_000 + 2023-01-01: 47_500 + 2024-01-01: 50_000 + 2025-01-01: 51_000 + 2026-01-01: 52_500 amount: 2017-01-01: 0.1 2018-01-01: 0.1 - threshold: values: - 2017-01-01: 62_001 - 2018-01-01: 63_001 - 2019-01-01: 64_001 - 2020-01-01: 65_001 - 2021-01-01: 66_001 - 2022-01-01: 68_001 - 2023-01-01: 73_001 - 2024-01-01: 76_501 - 2025-01-01: 79_001 - 2026-01-01: 80_501 + 2017-01-01: 62_000 + 2018-01-01: 63_000 + 2019-01-01: 64_000 + 2020-01-01: 65_000 + 2021-01-01: 66_000 + 2022-01-01: 68_000 + 2023-01-01: 73_000 + 2024-01-01: 76_500 + 2025-01-01: 79_000 + 2026-01-01: 80_500 amount: 2017-01-01: 0 2018-01-01: 0 diff --git a/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py b/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py index 4950befaeef..ca3a546dee5 100644 --- a/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py +++ b/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py @@ -9,6 +9,9 @@ valid TIN fixed, changing the child's SSN-card category cannot change the 2017 identification result. A child without any TIN does not qualify. +IRC 25B(b) preserves the Saver credit rate at each published AGI ceiling +and reduces it immediately above that ceiling, including fractional AGI. + Each example contains a generated mixed population, which the YAML runner cannot express. Individual and end-to-end source examples remain in YAML. """ @@ -26,6 +29,36 @@ "HEAD_OF_HOUSEHOLD": 287_650, "SURVIVING_SPOUSE": 313_800, } +# Published joint-return AGI ceilings, independently transcribed from IRS notices: +# 2017: https://www.irs.gov/pub/irs-drop/n-16-62.pdf#page=2 +# 2018: https://www.irs.gov/pub/irs-drop/n-17-64.pdf#page=2 +# 2019: https://www.irs.gov/pub/irs-drop/n-18-83.pdf#page=2 +# 2020: https://www.irs.gov/pub/irs-drop/n-19-59.pdf#page=2 +# 2021: https://www.irs.gov/pub/irs-drop/n-20-79.pdf#page=2 +# 2022: https://www.irs.gov/pub/irs-drop/n-21-61.pdf#page=3 +# 2023: https://www.irs.gov/pub/irs-drop/n-22-55.pdf#page=3 +# 2024: https://www.irs.gov/pub/irs-drop/n-23-75.pdf#page=3 +# 2025/2026: https://www.irs.gov/pub/irs-drop/n-25-67.pdf#page=3 +SAVER_JOINT_CEILINGS = { + 2017: (37_000, 40_000, 62_000), + 2018: (38_000, 41_000, 63_000), + 2019: (38_500, 41_500, 64_000), + 2020: (39_000, 42_500, 65_000), + 2021: (39_500, 43_000, 66_000), + 2022: (41_000, 44_000, 68_000), + 2023: (43_500, 47_500, 73_000), + 2024: (46_000, 50_000, 76_500), + 2025: (47_500, 51_000, 79_000), + 2026: (48_500, 52_500, 80_500), +} +# IRC 25B(b)(2); Form 8880 puts qualifying widow(er) in the other-return column. +SAVER_STATUS_FACTORS = { + "JOINT": 1, + "HEAD_OF_HOUSEHOLD": 0.75, + "SINGLE": 0.5, + "SEPARATE": 0.5, + "SURVIVING_SPOUSE": 0.5, +} SETTINGS = settings( max_examples=6, deadline=None, @@ -146,3 +179,57 @@ def test_employer_care_exclusion_and_credit_do_not_reuse_expenses(system, year, assert (exclusion <= earnings + 0.01).all() assert (remaining <= earnings + 0.01).all() assert (exclusion + remaining <= qualified + 0.01).all() + + +@pytest.mark.parametrize("year", range(2017, 2027)) +@settings(SETTINGS, max_examples=3) +@given( + contributions=st.tuples(*(st.integers(1, 4_000) for _ in range(3))), + excess_cents=st.integers(1, 99), +) +def test_saver_rates_change_immediately_above_published_ceilings( + system, year, contributions, excess_cents +): + """Every generated population covers all statuses, bands and fractional gaps.""" + people, units, expected, capped = {}, {}, [], [] + rates = (0.5, 0.2, 0.1, 0) + offsets = (0, 0.01, 0.49, 0.5, 0.75, 1, excess_cents / 100) + for status, factor in SAVER_STATUS_FACTORS.items(): + for band, ceiling in enumerate(SAVER_JOINT_CEILINGS[year]): + contribution = contributions[band] + for offset in offsets: + name = f"person_{len(people)}" + people[name] = { + "savers_credit_eligible_person": {year: True}, + "savers_credit_qualified_contributions": {year: contribution}, + } + units[name] = { + "members": [name], + "filing_status": {year: status}, + "agi_plus_section_911_931_933_exclusions": { + year: ceiling * factor + offset + }, + } + capped.append(min(contribution, 2_000)) + expected.append(capped[-1] * rates[band + (offset > 0)]) + for income in (-100_000, 0): + name = f"person_{len(people)}" + people[name] = { + "savers_credit_eligible_person": {year: True}, + "savers_credit_qualified_contributions": {year: 4_000}, + } + units[name] = { + "members": [name], + "filing_status": {year: status}, + "agi_plus_section_911_931_933_exclusions": {year: income}, + } + capped.append(2_000) + expected.append(1_000) + sim = Simulation( + situation={"people": people, "tax_units": units}, tax_benefit_system=system + ) + credits = sim.calculate("savers_credit_person", year) + assert np.isfinite(credits).all() + assert (credits >= 0).all() + assert (credits <= 0.5 * np.array(capped) + 0.01).all() + np.testing.assert_allclose(credits, expected, atol=0.01, rtol=0) diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml index 864bb119cae..bbeb08628f3 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml @@ -436,6 +436,7 @@ - 200 - 200 - 0 + - name: Case 13, 2020 Saver rate boundaries follow IRS Notice 2019-59. period: 2020 input: @@ -553,3 +554,146 @@ - 200 - 200 - 0 + +# 26 U.S.C. 25B(b)(1)-(3) uses inclusive AGI ceilings, including cents. +# Sources: Notice 2016-62 PDF pages 2-3 and Notice 2025-67 PDF pages 3-4. +# For each band: ceiling - $0.25, ceiling, ceiling + $0.25, next dollar. +# Every filing-status multiplier also retains the first band at negative/zero AGI. + +- name: Case 16, 2017 joint credit changes immediately above each inclusive ceiling. + period: 2017 + input: + filing_status: [JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT] + adjusted_gross_income: [-1, 0, 36_999.75, 37_000, 37_000.25, 37_001, 39_999.75, 40_000, 40_000.25, 40_001, 61_999.75, 62_000, 62_000.25, 62_001] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 17, 2017 head of household credit changes immediately above each inclusive ceiling. + period: 2017 + input: + filing_status: [HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD] + adjusted_gross_income: [-1, 0, 27_749.75, 27_750, 27_750.25, 27_751, 29_999.75, 30_000, 30_000.25, 30_001, 46_499.75, 46_500, 46_500.25, 46_501] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 18, 2017 single credit changes immediately above each inclusive ceiling. + period: 2017 + input: + filing_status: [SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE] + adjusted_gross_income: [-1, 0, 18_499.75, 18_500, 18_500.25, 18_501, 19_999.75, 20_000, 20_000.25, 20_001, 30_999.75, 31_000, 31_000.25, 31_001] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 19, 2017 separate credit changes immediately above each inclusive ceiling. + period: 2017 + input: + filing_status: [SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE] + adjusted_gross_income: [-1, 0, 18_499.75, 18_500, 18_500.25, 18_501, 19_999.75, 20_000, 20_000.25, 20_001, 30_999.75, 31_000, 31_000.25, 31_001] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 20, 2017 surviving spouse credit changes immediately above each inclusive ceiling. + period: 2017 + input: + filing_status: [SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE] + adjusted_gross_income: [-1, 0, 18_499.75, 18_500, 18_500.25, 18_501, 19_999.75, 20_000, 20_000.25, 20_001, 30_999.75, 31_000, 31_000.25, 31_001] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 21, 2026 joint credit changes immediately above each inclusive ceiling. + period: 2026 + input: + filing_status: [JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT, JOINT] + adjusted_gross_income: [-1, 0, 48_499.75, 48_500, 48_500.25, 48_501, 52_499.75, 52_500, 52_500.25, 52_501, 80_499.75, 80_500, 80_500.25, 80_501] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 22, 2026 head of household credit changes immediately above each inclusive ceiling. + period: 2026 + input: + filing_status: [HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD, HEAD_OF_HOUSEHOLD] + adjusted_gross_income: [-1, 0, 36_374.75, 36_375, 36_375.25, 36_376, 39_374.75, 39_375, 39_375.25, 39_376, 60_374.75, 60_375, 60_375.25, 60_376] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 23, 2026 single credit changes immediately above each inclusive ceiling. + period: 2026 + input: + filing_status: [SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE, SINGLE] + adjusted_gross_income: [-1, 0, 24_249.75, 24_250, 24_250.25, 24_251, 26_249.75, 26_250, 26_250.25, 26_251, 40_249.75, 40_250, 40_250.25, 40_251] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 24, 2026 separate credit changes immediately above each inclusive ceiling. + period: 2026 + input: + filing_status: [SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE, SEPARATE] + adjusted_gross_income: [-1, 0, 24_249.75, 24_250, 24_250.25, 24_251, 26_249.75, 26_250, 26_250.25, 26_251, 40_249.75, 40_250, 40_250.25, 40_251] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 25, 2026 surviving spouse credit changes immediately above each inclusive ceiling. + period: 2026 + input: + filing_status: [SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE, SURVIVING_SPOUSE] + adjusted_gross_income: [-1, 0, 24_249.75, 24_250, 24_250.25, 24_251, 26_249.75, 26_250, 26_250.25, 26_251, 40_249.75, 40_250, 40_250.25, 40_251] + savers_credit_eligible_person: [true, true, true, true, true, true, true, true, true, true, true, true, true, true] + savers_credit_qualified_contributions: [2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000, 2_000] + output: + savers_credit_person: [1_000, 1_000, 1_000, 1_000, 400, 400, 400, 400, 200, 200, 200, 200, 0, 0] + +- name: Case 26, fractional 2017 joint AGI reaches the lower Saver credit and final tax. + # Form 8880 line 9: $37,000.50 is over the $37,000 inclusive 50% ceiling. + # AGI = wages $39,000.50 - deductible IRA $2,000. + # Taxable income = $37,000.50 - $12,700 standard deduction - $8,100 exemptions. + # Ordinary tax = $16,200.50 x 10% = $1,620.05; less $400 credit = $1,220.05. + period: 2017 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 40 + employment_income: 39_000.50 + traditional_ira_contributions: 2_000 + is_tax_unit_head: true + person2: + age: 38 + is_tax_unit_spouse: true + tax_units: + tax_unit: + members: [person1, person2] + filing_status: JOINT + aca_ptc: 0 + state_sales_tax: 0 + marital_units: + marital_unit: + members: [person1, person2] + households: + household: + members: [person1, person2] + state_code: TX + output: + adjusted_gross_income: 37_000.50 + savers_credit_qualified_contributions: [2_000, 0] + savers_credit_person: [400, 0] + savers_credit: 400 + income_tax_before_credits: 1_620.05 + income_tax: 1_220.05 diff --git a/policyengine_us/variables/gov/irs/credits/retirement_savings/savers_credit_person.py b/policyengine_us/variables/gov/irs/credits/retirement_savings/savers_credit_person.py index aef64786ddc..4fa31a691d5 100644 --- a/policyengine_us/variables/gov/irs/credits/retirement_savings/savers_credit_person.py +++ b/policyengine_us/variables/gov/irs/credits/retirement_savings/savers_credit_person.py @@ -9,6 +9,7 @@ class savers_credit_person(Variable): unit = USD reference = ( "https://www.irs.gov/pub/irs-pdf/f8880.pdf", + "https://www.law.cornell.edu/uscode/text/26/25B#b", "https://www.law.cornell.edu/uscode/text/26/25B#c", "https://www.law.cornell.edu/uscode/text/26/25B#d_2", ) @@ -32,7 +33,9 @@ def formula(person, period, parameters): filing_status = person.tax_unit("filing_status", period) # Joint as the base threshold_adjustment = p.rate.threshold_adjustment[filing_status] - # Credit rate + # Section 25B(b) applies each rate through its inclusive AGI ceiling. + # Use the published band tops without rounding AGI or shifting a top + # to the next dollar, which would retain the higher rate for cents. adjusted_agi = agi / threshold_adjustment - credit_rate = p.rate.joint.calc(adjusted_agi) + credit_rate = p.rate.joint.calc(adjusted_agi, right=True) return credit_rate * capped_qualified_contributions From 037303798a102f42fba6007e38ef02a8fce8765e Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 09:54:34 -0500 Subject: [PATCH 4/5] Fix issues from review: use independent dependent care expenses --- changelog.d/federal-tax-2017-history.fixed.md | 2 +- docs/gov/irs/historical-validation.md | 8 + ...nt_care_assistance_exclusion_invariants.py | 105 ++++---- ...est_federal_2017_tax_history_properties.py | 94 +++++++ .../baseline/gov/irs/credits/cdcc/cdcc.yaml | 12 + .../gov/irs/credits/cdcc/cdcc_limit.yaml | 22 +- .../cdcc/cdcc_qualified_care_expenses.yaml | 1 + .../credits/cdcc/cdcc_relevant_expenses.yaml | 9 + .../dependent_care_assistance_exclusion.yaml | 253 +++++++++++++++--- .../earned_income/eitc_earned_income.yaml | 12 + .../taxable_dependent_care_benefits.yaml | 16 ++ .../irs/ira/traditional_ira_deduction.yaml | 4 + .../al_federal_income_tax_deduction.yaml | 4 + ...ca_dependent_care_assistance_addition.yaml | 3 + .../credits/child_dependent_care/ca_cdcc.yaml | 4 + .../ca_cdcc_relevant_expenses.yaml | 30 ++- ...a_dependent_care_assistance_exclusion.yaml | 127 ++++++++- .../gov/states/dc/tax/income/dc_cdcc.yaml | 4 + .../de/tax/income/credits/cdcc/de_cdcc.yaml | 4 + .../dependent_care_credit/ga_cdcc.yaml | 4 + .../credits/cdcc/hi_cdcc_integration.yaml | 4 + .../cdcc/hi_dependent_care_benefits.yaml | 4 + ..._and_dependent_care_expense_deduction.yaml | 12 + .../gov/states/ks/tax/income/ks_cdcc.yaml | 4 + .../md_dependent_care_subtraction.yaml | 8 + ...ters_refund_federally_excluded_income.yaml | 3 + .../nd_renters_refund_income.yaml | 3 + .../states/ny/tax/income/credits/ny_cdcc.yaml | 12 + .../states/sc/tax/income/credits/sc_cdcc.yaml | 8 + ...d_dependent_care_deduction_cdcc_limit.yaml | 1 + ...hild_dependent_care_expense_deduction.yaml | 12 + ...separate_filer_and_dependent_care_wages.py | 21 +- .../dependent_care_assistance_exclusion.py | 10 +- ...dent_care_assistance_qualified_expenses.py | 29 ++ .../ca_dependent_care_assistance_exclusion.py | 42 +-- 35 files changed, 752 insertions(+), 139 deletions(-) create mode 100644 policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_qualified_expenses.py diff --git a/changelog.d/federal-tax-2017-history.fixed.md b/changelog.d/federal-tax-2017-history.fixed.md index 8382d7a55c7..d6cfdd7917c 100644 --- a/changelog.d/federal-tax-2017-history.fixed.md +++ b/changelog.d/federal-tax-2017-history.fixed.md @@ -1 +1 @@ -Correct 2017 personal-exemption phase-outs, tuition deduction accounting, CTC identification, retirement limits and Saver's Credit histories. Apply inclusive Saver's Credit bands to fractional AGI, enforce the pre-2020 traditional IRA age limit, cap dependent-care exclusions by qualified expenses, and prevent expense reuse in the care credit. Add annual federal tax reference cases for 2017–2026. +Correct 2017 personal-exemption phase-outs, tuition deduction accounting, CTC identification, retirement limits and Saver's Credit histories. Apply inclusive Saver's Credit bands to fractional AGI, enforce the pre-2020 traditional IRA age limit, cap federal and California dependent-care exclusions by independently supplied qualified expenses, and prevent expense reuse in the care credit. Keep the employer-assistance expense input independent of modeled childcare subsidies to avoid an adjusted-gross-income cycle, and document the zero default for unreported costs. Add annual federal tax reference cases for 2017–2026. diff --git a/docs/gov/irs/historical-validation.md b/docs/gov/irs/historical-validation.md index f86ef2d0417..4cf0c070943 100644 --- a/docs/gov/irs/historical-validation.md +++ b/docs/gov/irs/historical-validation.md @@ -81,6 +81,14 @@ Every path below has the prefix `gov.irs.`. “Explicit 2017” means the parame Focused tests also cover the [personal-exemption phaseout](../../../policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/exemptions/exemptions.yaml): a partial step triggers the full 2% reduction, as the [2017 worksheet, p. 41][instructions-1040] requires. [Dependent-care tests](../../../policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml) cover the actual qualified-expense ceiling and prevent reuse of excluded employer benefits for the child and dependent care credit, following [Form 2441, Part III][dcap]. [Traditional IRA tests](../../../policyengine_us/tests/policy/baseline/household/expense/retirement/traditional_ira_contributions.yaml) cover the age-70.5 restriction through 2019 and its removal from 2020, following [Publication 590-A][ira-contributions] and [P.L. 116-94, Division O, §107][secure]. +Employer dependent care assistance requires an independently supplied annual tax-unit input, `dependent_care_assistance_qualified_expenses`. It represents employment-related expenses for qualifying care incurred during the tax year, regardless of when paid, before employer benefits and statutory dollar or earnings limits. Include eligible employer-paid care and care for a qualifying disabled adult or spouse; exclude costs for ineligible people, purposes or providers and reimbursements disallowed under the applicable year's rules. The [2017 instructions, p. 1](https://www.irs.gov/pub/irs-prior/i2441--2017.pdf#page=1) retain state reimbursements included in income; the shorter reimbursement wording in the [2025 instructions, p. 2](https://www.irs.gov/pub/irs-prior/i2441--2025.pdf#page=2) does not by itself establish a legal change. The input must reflect the applicable treatment. + +The expense input defaults to zero: unreported costs are **modeled as zero**, not established as zero. With positive employer benefits, this assumption can increase taxable benefits. An informed household or population calculation requires an independently established qualified amount; W-2 box 10, gross childcare bills and modeled public subsidies do not supply it. Both the [2017](https://www.irs.gov/pub/irs-prior/i2441--2017.pdf#page=5) and [2025 instructions](https://www.irs.gov/pub/irs-prior/i2441--2025.pdf#page=5) illustrate $2,000 in benefits but only $900 in qualified expenses. No new dataset imputation, reporting-status input or missing-information validation is included. Carryovers, forfeitures and self-employment plan deductions remain outside this employer-benefit calculation. + +Supply this input separately from `cdcc_qualified_care_expenses`, which remains the computed expense helper for the later credit; overriding that helper does not establish the employer-assistance expense amount. The model retains its qualifying-person checks and subtracts excluded benefits once from creditable costs. The employer-benefit payroll input convention is unchanged. Keeping the assistance expense input independent also avoids a cycle through modeled childcare subsidies and adjusted gross income. + +California applies its own earnings and dollar limits directly to the independently supplied qualified amount, as [FTB 3506 Part IV](https://www.ftb.ca.gov/forms/2017/17_3506.pdf#page=2) requires. Higher California earnings, including its different HSA treatment, cannot override the qualified-expense ceiling. The federal-minus-California exclusion addback continues to account for the different statutory caps. This correction does not establish complete historical validation of California taxes. + [Saver's Credit examples](../../../policyengine_us/tests/policy/baseline/gov/irs/credits/retirement_saving/savers_credit_person.yaml) check the published inclusive AGI ceilings and fractional income above them. [Generated populations](../../../policyengine_us/tests/core/test_federal_2017_tax_history_properties.py) repeat these checks for all five filing statuses in every year from 2017 through 2026. The 60 wage cases do not exercise every flagged provision. They do not establish complete coverage of itemized deductions, AMT preferences, capital gains, retirement transactions, identification compliance or special filing situations. The TIN input does not encode issuance dates or every identification requirement; aggregate childcare spending cannot distinguish each child's eligible expense share in mixed-age families. Fractional age inputs can express the former IRA age boundary, but integer survey ages do not reconstruct birthdays. diff --git a/policyengine_us/tests/core/test_dependent_care_assistance_exclusion_invariants.py b/policyengine_us/tests/core/test_dependent_care_assistance_exclusion_invariants.py index baf6d715cc2..e738ad7467b 100644 --- a/policyengine_us/tests/core/test_dependent_care_assistance_exclusion_invariants.py +++ b/policyengine_us/tests/core/test_dependent_care_assistance_exclusion_invariants.py @@ -1,41 +1,23 @@ -"""Cap-arithmetic invariants for the section 129 assistance exclusion. - -Restricted domain: these properties exercise the model's existing cap-only -calculation, not statutory eligibility for an exclusion. Fixtures omit -qualifying care expenses and may contain no qualifying persons. Form 2441 -lines 16-25 also limit excluded benefits to qualified expenses for qualifying -persons; with no such expenses, the statutory exclusion would be zero. -Positive exclusions here establish cap arithmetic only and do not verify -those qualification requirements. - -Within this domain, the modeled exclusion is the lesser of employer-provided -benefits, the section 129(a)(2)(A) dollar cap for the year and filing status, -and the section 129(b) earned-income limit. Section 129(a)(2)(D) raised the -cap to $10,500 ($5,250 on a separate return) for 2021 only. California keeps -$5,000 ($2,500) in every year (FTB 3506 Part IV line 22). Section 21(c) reduces -the CDCC dollar limit by the exclusion. - -Hypothesis draws batches of tax units with all five filing statuses and -zero to three children under 13, and a seeded population of 200 units adds -breadth. Each batch and a copy with every filer's benefits raised by a drawn -non-negative amount run together in one vectorized California simulation. -For every tax unit: - -1. Differential: dependent_care_assistance_exclusion equals an independent - numpy min of the benefits, the cap printed on Form 2441 line 21 for the - year (not the model's parameter) and the lesser of the filers' earnings. - Earnings are box 1 wages: Form 2441 line 18 earned income leaves out the - line 12 benefits, which the fixtures add on top to form employment_income. - Raising benefits therefore raises employment_income by the same amount. -2. Bound: 0 <= exclusion <= benefits, the year/status cap and earned income. -3. Monotone: raising benefits never lowers the exclusion. -4. California: ca_dependent_care_assistance_exclusion equals the same min with - the FTB 3506 line 22 cap and California wages (which the model does not - reduce by the benefits), and doesn't exceed the federal exclusion where - the federal earned income limit doesn't bind below California's cap. - Separate filers treated as unmarried use the full cap in both systems. -5. Section 21(c): cdcc_limit equals max(Form 2441 line 27 amount x the - number of qualifying persons (at most two) - exclusion, 0). +"""Source-based bounds for the section 129 assistance exclusion. + +Each generated tax unit has zero to three dependent children under 13 and +an independently known $20,000 of qualifying work-care costs when a child +qualifies, otherwise zero. Costs are incurred in the tested year, before +employer exclusion, with no carryovers, forfeitures or disallowed public +reimbursement. These are explicit hypothetical facts, not inferred from +benefits, gross bills or modeled subsidies. The properties retain every +filing status, published annual cap, earnings limit and no-person case. + +Form 2441 Part III limits the exclusion by benefits, qualified costs, the +published year/status cap and earned income. California uses the FTB 3506 +Part IV cap. Its earned-income amount is supplied as an isolated component +input equal to known box 1 wages; end-to-end California HSA and loss cases +remain in the variable-named YAML. Raising benefits also raises gross +employment income, keeping box 1 earnings and known care costs fixed. +Section 21(c) then reduces the CDCC dollar limit by the actual exclusion. + +Base and raised-benefit households run together in one vectorized +simulation per example; no extra model constructions are added here. """ import numpy as np @@ -138,8 +120,7 @@ def filer(): def _situation(units, year): - # Deliberately omit qualifying expenses to isolate the existing cap-only - # calculation described in the module's restricted property domain. + # Known costs and California earnings are independent component facts. people, groups = {}, {"tax_units": {}, "households": {}, "marital_units": {}} def add_filer(name, values, role): @@ -172,6 +153,14 @@ def add_filer(name, values, role): groups["tax_units"][f"tax_unit_{i}"] = { "members": members, "filing_status": unit["filing_status"], + "dependent_care_assistance_qualified_expenses": ( + 20_000 if unit["children"] else 0 + ), + "ca_cdcc_min_head_spouse_earned": min( + unit["head"]["box_1_wages"], unit["spouse"]["box_1_wages"] + ) + if unit["spouse"] + else unit["head"]["box_1_wages"], } groups["households"][f"household_{i}"] = { "members": members, @@ -183,7 +172,12 @@ def add_filer(name, values, role): } for kind in ("tax_units", "households"): for group in groups[kind].values(): - for key in ("filing_status", "state_code"): + for key in ( + "filing_status", + "state_code", + "dependent_care_assistance_qualified_expenses", + "ca_cdcc_min_head_spouse_earned", + ): if key in group: group[key] = {year: group[key]} return {"people": people, **groups} @@ -230,10 +224,9 @@ def _treated_as_unmarried(unit): ) -def _expected(units, year, caps, *, raised=False, wages_include_benefits=False): - # Independent cap-arithmetic oracle; qualified-expense/person eligibility - # under Form 2441 lines 16-25 is outside this property's domain. - benefits, cap, earned = [], [], [] +def _expected(units, year, caps, *, raised=False): + # Form 2441 lines 16-25 / FTB 3506 Part IV, including known care costs. + benefits, cap, earned, expenses = [], [], [], [] for unit in units: filers = [unit["head"]] + ([unit["spouse"]] if unit["spouse"] else []) benefits.append(sum(f["benefits"] + raised * f["increase"] for f in filers)) @@ -241,21 +234,16 @@ def _expected(units, year, caps, *, raised=False, wages_include_benefits=False): "filing_status" ] == "SEPARATE" and not _treated_as_unmarried(unit) cap.append(caps[1] if ordinary_separate else caps[0]) - earned.append( - min( - f["box_1_wages"] - + wages_include_benefits * (f["benefits"] + raised * f["increase"]) - for f in filers - ) - ) - return np.minimum(np.array(benefits), np.minimum(cap, earned)) + earned.append(min(f["box_1_wages"] for f in filers)) + expenses.append(20_000 if unit["children"] else 0) + return np.minimum(benefits, np.minimum(expenses, np.minimum(cap, earned))) def _check(units, year): base, raised = _run(units, year) exclusion = base["dependent_care_assistance_exclusion"] - # 1. Differential against the published caps. + # 1. Differential against known care costs and the published caps. expected = _expected(units, year, PUBLISHED_CAP[year]) np.testing.assert_allclose(exclusion, expected, atol=TOLERANCE) @@ -296,6 +284,8 @@ def _check(units, year): ) assert (exclusion <= caps + TOLERANCE).all() assert (exclusion <= earned_income_limits + TOLERANCE).all() + known_costs = np.array([20_000 if unit["children"] else 0 for unit in units]) + assert (exclusion <= known_costs + TOLERANCE).all() # 3. Monotone in benefits. assert ( @@ -307,13 +297,12 @@ def _check(units, year): atol=TOLERANCE, ) - # 4. California's line 22 cap. California earned income is measured from - # California wages (ca_taxable_wages), which the model does not reduce by - # the line 12 benefits; California law on that point is not checked here. + # 4. California's line 22 cap with explicitly known component earnings. + # Actual HSA/California wage differences remain covered in household YAML. california = base["ca_dependent_care_assistance_exclusion"] np.testing.assert_allclose( california, - _expected(units, year, CALIFORNIA_CAP, wages_include_benefits=True), + _expected(units, year, CALIFORNIA_CAP), atol=TOLERANCE, ) # Where the federal earned income limit doesn't bind below California's diff --git a/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py b/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py index ca3a546dee5..025fde50aff 100644 --- a/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py +++ b/policyengine_us/tests/core/test_federal_2017_tax_history_properties.py @@ -164,6 +164,10 @@ def test_employer_care_exclusion_and_credit_do_not_reuse_expenses(system, year, units[f"unit_{i}"] = { "members": [head, child], "filing_status": {year: "SINGLE"}, + # Independently known IRC 129 line16 costs; this is separate + # from the computed-CDCC helper override used to isolate no reuse. + # No carryovers, forfeitures or disallowed public reimbursement. + "dependent_care_assistance_qualified_expenses": {year: qualified}, "cdcc_qualified_care_expenses": {year: qualified}, "min_head_spouse_earned": {year: earnings}, } @@ -233,3 +237,93 @@ def test_saver_rates_change_immediately_above_published_ceilings( assert (credits >= 0).all() assert (credits <= 0.5 * np.array(capped) + 0.01).all() np.testing.assert_allclose(credits, expected, atol=0.01, rtol=0) + + +@pytest.mark.parametrize("benefits", [(0,), (2_000,), (0, 2_000)]) +def test_pa_dependent_care_graph_handles_zero_positive_and_mixed_benefits( + system, benefits +): + """Exercise both batch routes with a shared model and an actual PA care graph. + + Independent qualified costs900 and benefits2000 follow IRS2025 line16. + The900 qualified amount is independently known after disallowed public + reimbursements and before employer exclusion. The12000 gross-care input + does not establish qualified costs. No carryovers or forfeitures apply. + The working US-citizen grandparent claims a three-year-old grandchild + who lives in the home all year; the parents live elsewhere. The + grandparent pays over half the home costs and meets the dependency and + head-of-household tests. Care from an eligible provider enables work. + The grandparent has 40 covered-work quarters, consistent with the + model's default; no Medicare eligibility or enrollment input is forced. + State subsidies are exercised, not used as independent qualified-cost + evidence or asserted against untraced numerical grant expectations. + """ + year = 2025 + people, units, spm_units, households = {}, {}, {}, {} + for i, benefit in enumerate(benefits): + head, child = f"head_{i}", f"child_{i}" + members = [head, child] + people[head] = { + "age": {year: 67}, + "is_tax_unit_head": {year: True}, + "employment_income": {year: 40_000}, + "dependent_care_employer_benefits": {year: benefit}, + "weekly_hours_worked_before_lsr": {year: 40}, + "immigration_status": {year: "CITIZEN"}, + } + people[child] = { + "age": {year: 3}, + "is_tax_unit_dependent": {year: True}, + "immigration_status": {year: "CITIZEN"}, + "pa_ccw_provider_type": { + f"{year}-{month:02d}": "CENTER" for month in range(1, 13) + }, + "pa_ccw_age_group": { + f"{year}-{month:02d}": "PRE_SCHOOL" for month in range(1, 13) + }, + "childcare_hours_per_day": {year: 8}, + "childcare_attending_days_per_month": {year: 20}, + } + units[f"unit_{i}"] = { + "members": members, + "filing_status": {year: "HEAD_OF_HOUSEHOLD"}, + "dependent_care_assistance_qualified_expenses": {year: 900}, + } + spm_units[f"spm_{i}"] = { + "members": members, + "spm_unit_pre_subsidy_childcare_expenses": {year: 12_000}, + } + households[f"household_{i}"] = { + "members": members, + "state_code": {year: "PA"}, + "pa_ccw_region": {year: 1}, + } + sim = Simulation( + situation={ + "people": people, + "tax_units": units, + "spm_units": spm_units, + "households": households, + }, + tax_benefit_system=system, + ) + exclusion = sim.calculate("dependent_care_assistance_exclusion", year) + net_care = sim.calculate("tax_unit_childcare_expenses", year) + agi = sim.calculate("adjusted_gross_income", year) + box_1 = sim.calculate("irs_employment_income", year)[::2] + taxable = sim.calculate("taxable_dependent_care_benefits", year)[::2] + expected = np.minimum(benefits, 900) + np.testing.assert_allclose(exclusion, expected, atol=0.01, rtol=0) + np.testing.assert_allclose(box_1 + taxable + exclusion, 40_000, atol=0.01, rtol=0) + np.testing.assert_allclose(agi, 40_000 - expected, atol=0.01, rtol=0) + assert np.isfinite(net_care).all() and (net_care >= 0).all() + assert (exclusion >= 0).all() and (exclusion <= 900).all() + + # Calculate after care and AGI so a prewarmed premium cannot hide the + # original care -> premium -> IRMAA -> AGI dependency. Inputs start in + # 2025, so the IRMAA lookback fallback also reads this year's AGI. + eligible = sim.calculate("is_medicare_eligible", year)[::2] + enrolled = sim.calculate("medicare_part_b_enrolled", year)[::2] + gross_part_b = sim.calculate("gross_medicare_part_b_premium", year)[::2] + assert eligible.all() and enrolled.all() + assert np.isfinite(gross_part_b).all() and (gross_part_b > 0).all() diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc.yaml index 144411162af..b8035b5de60 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc.yaml @@ -172,6 +172,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known qualifying work-care costs for these children, + # net of disallowed public reimbursement, before employer exclusion; + # no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 6_000 tax_unit_childcare_expenses: 6_000 output: # Form 2441 Part III: $5,000 excluded under section 129. @@ -197,6 +201,10 @@ tax_unit: members: [parent1, child1] filing_status: HEAD_OF_HOUSEHOLD + # Independently known qualifying work-care costs for these children, + # net of disallowed public reimbursement, before employer exclusion; + # no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 6_000 tax_unit_childcare_expenses: 6_000 output: dependent_care_assistance_exclusion: 5_000 @@ -256,6 +264,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known qualifying work-care costs for these children, + # net of disallowed public reimbursement, before employer exclusion; + # no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 output: # Form 2441 Part III: min($9,000, $10,500 cap, $40,000) = $9,000. diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml index 84bbbf47514..4c5f0e71ff1 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_limit.yaml @@ -67,6 +67,7 @@ tax_unit: members: [person1, person2, person3] filing_status: SEPARATE + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 output: dependent_care_assistance_exclusion: 4_000 @@ -78,7 +79,9 @@ - name: Two children with $12,000 benefits keep a $1,000 limit in 2020 period: 2020 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap component: known costs, two qualifying recipients. + count_cdcc_eligible: 2 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 @@ -91,7 +94,9 @@ - name: Two children with $12,000 benefits keep a $5,500 limit in 2021 period: 2021 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap component: known costs, two qualifying recipients. + count_cdcc_eligible: 2 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 @@ -104,7 +109,9 @@ - name: Two children with $12,000 benefits return to a $1,000 limit in 2022 period: 2022 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap component: known costs, two qualifying recipients. + count_cdcc_eligible: 2 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 @@ -117,7 +124,9 @@ - name: Two children with $7,000 benefits have no remaining limit in 2026 period: 2026 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap component: known costs, two qualifying recipients. + count_cdcc_eligible: 2 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 7_000 @@ -144,6 +153,7 @@ tax_unit: members: [head, child1, child2] filing_status: SEPARATE + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 output: cdcc_treated_as_unmarried: true @@ -153,7 +163,9 @@ - name: The 2021 earned-income limit also controls the CDCC limit reduction period: 2021 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap component: known costs, two qualifying recipients. + count_cdcc_eligible: 2 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT capped_count_cdcc_eligible: 2 dependent_care_employer_benefits: 12_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml index 0643be1c4d9..36f55bda1ab 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_qualified_care_expenses.yaml @@ -52,6 +52,7 @@ tax_units: tax_unit: members: [person1, person2] + dependent_care_assistance_qualified_expenses: 5_000 households: household: members: [person1, person2] diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml index aa5608f3d13..380e5af55d3 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/cdcc_relevant_expenses.yaml @@ -287,6 +287,9 @@ tax_units: tax_unit: members: [person1, person2] + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 2_000 tax_unit_childcare_expenses: 2_000 households: household: @@ -310,6 +313,9 @@ tax_units: tax_unit: members: [person1, person2] + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 2_000 tax_unit_childcare_expenses: 2_000 households: household: @@ -335,6 +341,9 @@ tax_units: tax_unit: members: [person1, person2] + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml index 1c2f8dde82c..33ac635994e 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.yaml @@ -8,7 +8,9 @@ - name: No employer dependent care benefits gives no exclusion period: 2024 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 0 filing_status: JOINT min_head_spouse_earned: 50_000 @@ -32,6 +34,7 @@ tax_units: tax_unit: members: [head, child] + dependent_care_assistance_qualified_expenses: 0 filing_status: SINGLE tax_unit_childcare_expenses: 5_000 households: @@ -63,6 +66,7 @@ tax_units: tax_unit: members: [head, relative] + dependent_care_assistance_qualified_expenses: 2_000 filing_status: SINGLE households: household: @@ -78,7 +82,9 @@ - name: Contiguous history, 2018 single DCAP cap. period: 2018 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 20_000 filing_status: SINGLE min_head_spouse_earned: 50_000 @@ -88,7 +94,9 @@ - name: Contiguous history, 2018 separate DCAP cap. period: 2018 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 20_000 filing_status: SEPARATE min_head_spouse_earned: 50_000 @@ -98,7 +106,9 @@ - name: Contiguous history, 2019 single DCAP cap. period: 2019 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 20_000 filing_status: SINGLE min_head_spouse_earned: 50_000 @@ -108,7 +118,9 @@ - name: Contiguous history, 2019 separate DCAP cap. period: 2019 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 20_000 filing_status: SEPARATE min_head_spouse_earned: 50_000 @@ -118,7 +130,9 @@ - name: Contiguous history, 2023 single DCAP cap. period: 2023 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 20_000 filing_status: SINGLE min_head_spouse_earned: 50_000 @@ -128,7 +142,9 @@ - name: Contiguous history, 2023 separate DCAP cap. period: 2023 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 dependent_care_employer_benefits: 20_000 filing_status: SEPARATE min_head_spouse_earned: 50_000 @@ -148,7 +164,9 @@ employment_income: 60_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -168,7 +186,9 @@ employment_income: 60_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -188,7 +208,9 @@ employment_income: 2_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -205,7 +227,9 @@ dependent_care_employer_benefits: 5_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head] filing_status: SEPARATE output: @@ -225,7 +249,9 @@ employment_income: 60_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -249,7 +275,7 @@ age: 5 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [person1, person2] filing_status: SEPARATE output: @@ -270,7 +296,7 @@ age: 5 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [person1, person2] filing_status: SEPARATE output: @@ -289,7 +315,7 @@ age: 5 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [person1, person2] filing_status: SEPARATE output: @@ -312,7 +338,9 @@ employment_income: 40_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -329,7 +357,9 @@ dependent_care_employer_benefits: 12_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head] filing_status: HEAD_OF_HOUSEHOLD output: @@ -346,7 +376,9 @@ dependent_care_employer_benefits: 6_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head] filing_status: SEPARATE output: @@ -366,7 +398,9 @@ employment_income: 40_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -378,7 +412,9 @@ - name: The pre-ARPA joint cap is $5,000 for 2020 period: 2020 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 10_500 min_head_spouse_earned: 50_000 @@ -389,7 +425,9 @@ - name: The pre-ARPA separate cap is $2,500 for 2020 period: 2020 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 5_250 @@ -400,7 +438,9 @@ - name: Benefits exactly at the joint 2021 cap are fully excluded period: 2021 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 10_500 min_head_spouse_earned: 50_000 @@ -410,7 +450,9 @@ - name: Benefits exactly at the separate 2021 cap are fully excluded period: 2021 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 5_250 @@ -431,7 +473,9 @@ employment_income: 6_000 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse] filing_status: JOINT output: @@ -452,7 +496,7 @@ age: 5 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, child] filing_status: SEPARATE output: @@ -472,6 +516,9 @@ tax_units: tax_unit: members: [head] + # Component override tests the guard; not a legally qualified + # expense claim. Positive costs keep the no-person guard nonvacuous. + dependent_care_assistance_qualified_expenses: 5_000 filing_status: SEPARATE output: cdcc_treated_as_unmarried: false @@ -480,7 +527,9 @@ - name: The separate cap returns to $2,500 for 2022 period: 2022 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 5_250 @@ -491,7 +540,9 @@ - name: Benefits above the 2026 joint cap are limited to $7,500 period: 2026 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 7_501 min_head_spouse_earned: 50_000 @@ -501,7 +552,9 @@ - name: Benefits exactly at the 2026 separate cap are fully excluded period: 2026 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 3_750 @@ -522,7 +575,7 @@ age: 5 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, child] filing_status: SEPARATE output: @@ -543,7 +596,7 @@ age: 5 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, child] filing_status: SEPARATE output: @@ -570,7 +623,7 @@ age: 4 tax_units: tax_unit: - cdcc_qualified_care_expenses: 20_000 + dependent_care_assistance_qualified_expenses: 20_000 members: [head, spouse, child] filing_status: JOINT output: @@ -582,7 +635,9 @@ # 2017 Form 2441, PDF page 2, lines 20-25. period: 2017 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SINGLE dependent_care_employer_benefits: 5_001 min_head_spouse_earned: 50_000 @@ -592,7 +647,9 @@ - name: Case 2, the 2017 joint DCAP exclusion caps benefits at $5,000. period: 2017 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 5_001 min_head_spouse_earned: 50_000 @@ -602,7 +659,9 @@ - name: Case 3, the 2017 separate DCAP exclusion caps benefits at $2,500. period: 2017 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SEPARATE cdcc_treated_as_unmarried: false dependent_care_employer_benefits: 2_501 @@ -613,7 +672,9 @@ - name: Case 4, the 2017 head-of-household DCAP exclusion caps benefits at $5,000. period: 2017 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: HEAD_OF_HOUSEHOLD dependent_care_employer_benefits: 5_001 min_head_spouse_earned: 50_000 @@ -623,7 +684,9 @@ - name: Case 5, the 2017 surviving-spouse DCAP exclusion caps benefits at $5,000. period: 2017 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: SURVIVING_SPOUSE dependent_care_employer_benefits: 5_001 min_head_spouse_earned: 50_000 @@ -633,7 +696,9 @@ - name: Case 6, the 2017 DCAP exclusion also respects the lower earned-income limit. period: 2017 input: - cdcc_qualified_care_expenses: 20_000 + # Isolated cap/earnings component: one qualifying care recipient. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 filing_status: JOINT dependent_care_employer_benefits: 5_000 min_head_spouse_earned: 2_000 @@ -653,6 +718,7 @@ tax_units: tax_unit: members: [person1, person2] + dependent_care_assistance_qualified_expenses: 2_000 tax_unit_childcare_expenses: 2_000 households: household: @@ -675,6 +741,7 @@ tax_units: tax_unit: members: [person1, person2] + dependent_care_assistance_qualified_expenses: 0 tax_unit_childcare_expenses: 0 households: household: @@ -697,6 +764,7 @@ tax_units: tax_unit: members: [person1, person2] + dependent_care_assistance_qualified_expenses: 0 tax_unit_childcare_expenses: 5_000 households: household: @@ -723,6 +791,7 @@ tax_units: tax_unit: members: [person1, person2] + dependent_care_assistance_qualified_expenses: 2_000 households: household: members: [person1, person2] @@ -744,6 +813,7 @@ tax_units: tax_unit: members: [person1, person2] + dependent_care_assistance_qualified_expenses: 2_000 tax_unit_childcare_expenses: 2_000 households: household: @@ -756,8 +826,117 @@ period: 2017 input: dependent_care_employer_benefits: 5_000 + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 count_cdcc_eligible: 1 min_head_spouse_earned: -100 output: dependent_care_assistance_exclusion: 0 + +# IRS Form 2441 instructions (2017), page 5, line 16 example. +# https://www.irs.gov/pub/irs-prior/i2441--2017.pdf#page=5 +# No carryover or forfeiture; known costs precede employer exclusion. +- name: IRS 2017 benefits of $2,000 with $900 of independently known qualified costs. + period: 2017 + input: + people: + head: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 2_000 + child: + age: 5 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, child] + dependent_care_assistance_qualified_expenses: 900 + households: + household: + members: [head, child] + state_code: TX + output: + # min(2,000 benefits, 900 costs, 5,000 cap, 38,000 earnings). + dependent_care_assistance_exclusion: 900 + taxable_dependent_care_benefits: [1_100, 0] + +# IRS Form 2441 instructions (2025), page 5, line 16 example. +# https://www.irs.gov/pub/irs-prior/i2441--2025.pdf#page=5 +# No carryover or forfeiture; known costs precede employer exclusion. +- name: IRS 2025 benefits of $2,000 with $900 of independently known qualified costs. + period: 2025 + input: + people: + head: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 2_000 + child: + age: 5 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, child] + dependent_care_assistance_qualified_expenses: 900 + households: + household: + members: [head, child] + state_code: TX + output: + # min(2,000 benefits, 900 costs, 5,000 cap, 38,000 earnings). + dependent_care_assistance_exclusion: 900 + taxable_dependent_care_benefits: [1_100, 0] + +# IRC 129(e)(1) / IRS2017 and2025 instructions: costs reimbursed by a +# public agency are disallowed here. The 2017 exception for reimbursement +# included in income is not used: this $4,000 reimbursement is nontaxable. +# Gross care5,000 minus actual disallowed reimbursement4,000 gives the +# independently supplied1,000; modeled subsidy amounts do not set this input. +- name: Actual nontaxable public reimbursement leaves $1,000 of qualified DCAP costs. + period: 2017 + input: + people: + head: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 5_000 + child: + age: 5 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, child] + dependent_care_assistance_qualified_expenses: 1_000 + tax_unit_childcare_expenses: 1_000 + households: + household: + members: [head, child] + state_code: TX + output: + dependent_care_assistance_exclusion: 1_000 + taxable_dependent_care_benefits: [4_000, 0] + # Known net costs1,000 less actual exclusion1,000 are not reused. + cdcc_relevant_expenses: 0 + +- name: Unreported independent costs use the documented zero-cost convention. + period: 2025 + input: + people: + head: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 2_000 + child: + age: 5 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, child] + households: + household: + members: [head, child] + state_code: TX + output: + # The omitted input defaults0; this does not establish actual costs0. + dependent_care_assistance_exclusion: 0 + taxable_dependent_care_benefits: [2_000, 0] diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/earned_income/eitc_earned_income.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/earned_income/eitc_earned_income.yaml index c76a0475215..33a4e71e204 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/credits/earned_income/eitc_earned_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/earned_income/eitc_earned_income.yaml @@ -458,6 +458,10 @@ tax_unit: members: [person, child] filing_status: SEPARATE + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: @@ -484,6 +488,10 @@ tax_unit: members: [head, child] filing_status: HEAD_OF_HOUSEHOLD + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: @@ -514,6 +522,10 @@ tax_unit: members: [head, spouse, child] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml index 8dde89eec6f..384432710bf 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/taxable_dependent_care_benefits.yaml @@ -18,6 +18,9 @@ members: [head, child] filing_status: HEAD_OF_HOUSEHOLD # Qualified expenses at least equal to the benefits (Form 2441 line 16). + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: @@ -48,6 +51,9 @@ tax_unit: members: [head, child] filing_status: SEPARATE + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: @@ -82,6 +88,9 @@ tax_unit: members: [head, spouse, child] filing_status: JOINT + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 6_000 tax_unit_childcare_expenses: 6_000 households: household: @@ -112,6 +121,9 @@ tax_unit: members: [head, child] filing_status: HEAD_OF_HOUSEHOLD + # Independently known current-year work-care costs, before employer + # exclusion; no carryovers, forfeitures or disallowed reimbursement. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: @@ -142,6 +154,10 @@ tax_unit: members: [head, child] filing_status: SINGLE + # Isolated positive-expense component override: test the separate + # qualifying-person gate, not whether this child's costs qualify. + # IRC 152(b)(1) bars this child from qualifying for this return. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/irs/ira/traditional_ira_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/irs/ira/traditional_ira_deduction.yaml index 0d738e0d91a..165b84d49b2 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/ira/traditional_ira_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/ira/traditional_ira_deduction.yaml @@ -13,6 +13,10 @@ tax_unit: members: [head, child] filing_status: HEAD_OF_HOUSEHOLD + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/al/tax/income/deductions/al_federal_income_tax_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/al/tax/income/deductions/al_federal_income_tax_deduction.yaml index 9a70f6175b8..bef9d6103ed 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/al/tax/income/deductions/al_federal_income_tax_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/al/tax/income/deductions/al_federal_income_tax_deduction.yaml @@ -279,6 +279,10 @@ tax_units: tax_unit: members: [head, spouse, child1, child2] + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/ca_dependent_care_assistance_addition.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/ca_dependent_care_assistance_addition.yaml index 4d32b3e6452..abe90ad5407 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/ca_dependent_care_assistance_addition.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/ca_dependent_care_assistance_addition.yaml @@ -18,6 +18,7 @@ tax_unit: members: [head, child] filing_status: HEAD_OF_HOUSEHOLD + dependent_care_assistance_qualified_expenses: 16_000 tax_unit_childcare_expenses: 16_000 households: household: @@ -50,6 +51,7 @@ tax_unit: members: [head, child] filing_status: HEAD_OF_HOUSEHOLD + dependent_care_assistance_qualified_expenses: 16_000 tax_unit_childcare_expenses: 16_000 households: household: @@ -79,6 +81,7 @@ tax_unit: members: [head, child] filing_status: HEAD_OF_HOUSEHOLD + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml index 2d0544c753c..27d743f85af 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc.yaml @@ -499,6 +499,10 @@ tax_units: tax_unit: members: [head, child] + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 2_500 tax_unit_childcare_expenses: 2_500 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml index 4a566ade40c..ab4e4de995d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_cdcc_relevant_expenses.yaml @@ -84,10 +84,16 @@ count_cdcc_eligible: 2 min_head_spouse_earned: 50_000 ca_cdcc_min_head_spouse_earned: 50_000 + # Synthetic component facts: $5,000 of employer assistance and $10,000 + # of independently known current-year qualifying work-care costs for + # these two qualifying individuals, net of disallowed public reimbursement, with + # no carryovers or forfeitures; not inferred from the federal override. + dependent_care_employer_benefits: 5_000 + dependent_care_assistance_qualified_expenses: 10_000 dependent_care_assistance_exclusion: 5_000 output: - # California earned income equals federal earned income, so the - # California exclusion is the federal 5,000, within the $5,000 cap. + # min(5,000 benefits, 10,000 qualified costs, 5,000 California cap, + # 50,000 California earned income) = 5,000, independently of the override. ca_dependent_care_assistance_exclusion: 5_000 # min(10_000 expenses, $6,000 two-child cap - $5,000 exclusion, 50_000) = 1_000. ca_cdcc_relevant_expenses: 1_000 @@ -112,6 +118,10 @@ tax_unit: members: [person1, person2, person3] filing_status: SEPARATE + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 10_000 tax_unit_childcare_expenses: 10_000 households: household: @@ -144,6 +154,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: @@ -181,6 +195,10 @@ tax_unit: members: [head, child1, child2] filing_status: SEPARATE + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: @@ -215,6 +233,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: @@ -252,6 +274,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 6_500 tax_unit_childcare_expenses: 6_500 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_dependent_care_assistance_exclusion.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_dependent_care_assistance_exclusion.yaml index 6057b1982fc..05368eac099 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_dependent_care_assistance_exclusion.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/credits/child_dependent_care/ca_dependent_care_assistance_exclusion.yaml @@ -1,3 +1,5 @@ +# Component arithmetic assumes no carryovers, forfeitures or disallowed +# public reimbursement. Costs are independent IRC 129/FTB 3506 line 17 facts. # FTB 3506 Part IV line 22 caps California's excluded dependent care benefits # at $5,000 ($2,500 for a separate return). California did not adopt the 2021 # federal cap of $10,500 ($5,250) (ARPA section 9632) or the 2026 federal cap @@ -8,7 +10,11 @@ input: state_code: CA filing_status: JOINT - dependent_care_assistance_exclusion: 4_000 + # Isolated cap component; sufficient independently known costs/earnings. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 + ca_cdcc_min_head_spouse_earned: 50_000 + dependent_care_employer_benefits: 4_000 output: ca_dependent_care_assistance_exclusion: 4_000 @@ -17,10 +23,13 @@ input: state_code: CA filing_status: JOINT - dependent_care_assistance_exclusion: 9_000 + # Isolated cap component; sufficient independently known costs/earnings. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 + ca_cdcc_min_head_spouse_earned: 50_000 + dependent_care_employer_benefits: 9_000 output: - # Federal exclusion $9,000 under the $10,500 cap; California line 22 is - # $5,000, so min($9,000, $5,000) = $5,000. + # min(9,000 benefits, 20,000 costs, 50,000 earnings, 5,000 cap). ca_dependent_care_assistance_exclusion: 5_000 - name: California keeps the $2,500 separate-return cap in 2021 @@ -28,9 +37,13 @@ input: state_code: CA filing_status: SEPARATE - dependent_care_assistance_exclusion: 5_250 + # Isolated cap component; sufficient independently known costs/earnings. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 + ca_cdcc_min_head_spouse_earned: 50_000 + dependent_care_employer_benefits: 5_250 output: - # min($5,250 federal exclusion, $2,500) = $2,500. + # min(5,250 benefits, 20,000 costs, 50,000 earnings, 2,500 cap). ca_dependent_care_assistance_exclusion: 2_500 - name: A separate filer living apart from their spouse uses the $5,000 cap in 2021 @@ -48,6 +61,7 @@ tax_units: tax_unit: members: [head, child] + dependent_care_assistance_qualified_expenses: 6_000 filing_status: SEPARATE households: household: @@ -64,9 +78,13 @@ input: state_code: CA filing_status: JOINT - dependent_care_assistance_exclusion: 7_000 + # Isolated cap component; sufficient independently known costs/earnings. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 20_000 + ca_cdcc_min_head_spouse_earned: 50_000 + dependent_care_employer_benefits: 7_000 output: - # min($7,000 federal exclusion under the $7,500 cap, $5,000) = $5,000. + # min(7,000 benefits, 20,000 costs, 50,000 earnings, 5,000 cap). ca_dependent_care_assistance_exclusion: 5_000 - name: California earned income limit on the exclusion counts payroll HSA contributions @@ -86,6 +104,7 @@ tax_units: tax_unit: members: [head, spouse, child] + dependent_care_assistance_qualified_expenses: 5_000 filing_status: JOINT households: household: @@ -118,6 +137,7 @@ tax_units: tax_unit: members: [head, spouse, child] + dependent_care_assistance_qualified_expenses: 5_000 filing_status: JOINT households: household: @@ -129,3 +149,94 @@ # California: max(4,000 - 4,000, 0) = 0, so the exclusion stays at 0. ca_cdcc_min_head_spouse_earned: 0 ca_dependent_care_assistance_exclusion: 0 + +# FTB3506 (2017) instructions line17: benefits2,000, qualified costs900. +# https://www.ftb.ca.gov/forms/2017/17-3506-instructions.html +- name: California's 2017 exclusion uses $900 of costs against $2,000 benefits. + period: 2017 + input: + people: + head: + age: 35 + employment_income: 40_000 + dependent_care_employer_benefits: 2_000 + child: + age: 3 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, child] + dependent_care_assistance_qualified_expenses: 900 + households: + household: + members: [head, child] + state_code: CA + output: + dependent_care_assistance_exclusion: 900 + ca_dependent_care_assistance_exclusion: 900 + +# FTB3506 (2025) PartIV lines17–26 and ScheduleCA line1h HSA addback. +# https://www.ftb.ca.gov/forms/2025/2025-3506-instructions.html +- name: California's HSA earnings difference preserves the $900 qualified-cost ceiling. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 60_000 + dependent_care_employer_benefits: 2_000 + spouse: + age: 38 + employment_income: 4_000 + health_savings_account_payroll_contributions: 1_000 + child: + age: 3 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, spouse, child] + filing_status: JOINT + dependent_care_assistance_qualified_expenses: 900 + households: + household: + members: [head, spouse, child] + state_code: CA + output: + min_head_spouse_earned: 3_000 + ca_cdcc_min_head_spouse_earned: 4_000 + # Independent costs bind despite the1,000 California earnings increase. + dependent_care_assistance_exclusion: 900 + ca_dependent_care_assistance_exclusion: 900 + +# FTB3506 (2025) PartIV lines17–26 and ScheduleCA line1h HSA addback. +# https://www.ftb.ca.gov/forms/2025/2025-3506-instructions.html +- name: California's HSA earnings difference preserves the $0 qualified-cost ceiling. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 60_000 + dependent_care_employer_benefits: 2_000 + spouse: + age: 38 + employment_income: 4_000 + health_savings_account_payroll_contributions: 1_000 + child: + age: 3 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, spouse, child] + filing_status: JOINT + dependent_care_assistance_qualified_expenses: 0 + households: + household: + members: [head, spouse, child] + state_code: CA + output: + min_head_spouse_earned: 3_000 + ca_cdcc_min_head_spouse_earned: 4_000 + # Independent costs bind despite the1,000 California earnings increase. + dependent_care_assistance_exclusion: 0 + ca_dependent_care_assistance_exclusion: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/dc/tax/income/dc_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/dc/tax/income/dc_cdcc.yaml index 0bb0bf9a5ba..d39b8fa2b05 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/dc/tax/income/dc_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/dc/tax/income/dc_cdcc.yaml @@ -64,6 +64,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/credits/cdcc/de_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/credits/cdcc/de_cdcc.yaml index a25a1fc0bcf..2020b57cc2d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/credits/cdcc/de_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/de/tax/income/credits/cdcc/de_cdcc.yaml @@ -35,6 +35,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/ga/tax/income/credits/dependent_care_credit/ga_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ga/tax/income/credits/dependent_care_credit/ga_cdcc.yaml index c4d8f0cf859..84963f2f793 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ga/tax/income/credits/dependent_care_credit/ga_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ga/tax/income/credits/dependent_care_credit/ga_cdcc.yaml @@ -43,6 +43,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_cdcc_integration.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_cdcc_integration.yaml index 1f3880d2343..717989045a8 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_cdcc_integration.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_cdcc_integration.yaml @@ -166,6 +166,10 @@ tax_unit: members: [person1, person2] hi_agi: 38_000 + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 0 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_dependent_care_benefits.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_dependent_care_benefits.yaml index 660875d795c..0e9e87a9c49 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_dependent_care_benefits.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/credits/cdcc/hi_dependent_care_benefits.yaml @@ -434,6 +434,10 @@ tax_unit: members: [head, child1, child2] filing_status: SEPARATE + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 6_000 tax_unit_childcare_expenses: 6_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/deductions/household_and_dependent_care/id_household_and_dependent_care_expense_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/deductions/household_and_dependent_care/id_household_and_dependent_care_expense_deduction.yaml index 59fa8e7fd88..521027a9047 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/deductions/household_and_dependent_care/id_household_and_dependent_care_expense_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/id/tax/income/deductions/household_and_dependent_care/id_household_and_dependent_care_expense_deduction.yaml @@ -144,6 +144,10 @@ tax_unit: members: [person1, person2] filing_status: SEPARATE + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 10_000 tax_unit_childcare_expenses: 10_000 id_cdcc_limit: 3_000 households: @@ -182,6 +186,10 @@ tax_unit: members: [person1, person2, person3, person4] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: @@ -215,6 +223,10 @@ tax_unit: members: [person1, person2, person3] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/ks/tax/income/ks_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ks/tax/income/ks_cdcc.yaml index 127b7d1b954..6808f9d8ec0 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ks/tax/income/ks_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ks/tax/income/ks_cdcc.yaml @@ -55,6 +55,10 @@ tax_unit: members: [parent1, parent2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/agi/subtractions/md_dependent_care_subtraction.yaml b/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/agi/subtractions/md_dependent_care_subtraction.yaml index 49aabbeb174..f09041a9be5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/agi/subtractions/md_dependent_care_subtraction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/agi/subtractions/md_dependent_care_subtraction.yaml @@ -23,6 +23,10 @@ tax_unit: members: [person1, person2, person3] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: @@ -59,6 +63,10 @@ tax_unit: members: [person1, person2, person3, person4] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_federally_excluded_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_federally_excluded_income.yaml index 573b5afd1a7..f007f8fde9f 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_federally_excluded_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_federally_excluded_income.yaml @@ -9,6 +9,9 @@ traditional_403b_contributions: 1_000 pre_tax_health_insurance_premiums: 3_000 health_savings_account_payroll_contributions: 2_000 + # Isolated income component: one qualifying recipient and known costs. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 5_000 dependent_care_employer_benefits: 5_000 taxable_interest_income: 700 tax_exempt_interest_income: 1_500 diff --git a/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_income.yaml index 3712cce127d..18078f23f43 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/nd/tax/property/renters_refund/nd_renters_refund_income.yaml @@ -306,6 +306,9 @@ age: 40 state_code: ND employment_income: 50_000 + # Isolated income component: one qualifying recipient and known costs. + count_cdcc_eligible: 1 + dependent_care_assistance_qualified_expenses: 9_000 dependent_care_employer_benefits: 9_000 output: # IRC 129(a)(2)(A) excludes 7,500 for 2026, and the other 1,500 is diff --git a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_cdcc.yaml index 78659f28c7e..c23f3fe34ae 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_cdcc.yaml @@ -200,6 +200,10 @@ tax_unit: members: [person1, person2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 8_000 tax_unit_childcare_expenses: 8_000 households: household: @@ -244,6 +248,10 @@ tax_unit: members: [person1, person2, child1, child2] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 5_000 tax_unit_childcare_expenses: 5_000 households: household: @@ -283,6 +291,10 @@ tax_unit: members: [person1, person2, child1] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 4_000 tax_unit_childcare_expenses: 4_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/credits/sc_cdcc.yaml b/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/credits/sc_cdcc.yaml index b466cde4dc7..34de0c353be 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/credits/sc_cdcc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/credits/sc_cdcc.yaml @@ -162,6 +162,10 @@ tax_unit: members: [head, spouse, child] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: @@ -194,6 +198,10 @@ tax_unit: members: [head, spouse, child] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_deduction_cdcc_limit.yaml b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_deduction_cdcc_limit.yaml index 3e152dd3a5a..65d6f9b5aa6 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_deduction_cdcc_limit.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_deduction_cdcc_limit.yaml @@ -59,6 +59,7 @@ tax_units: tax_unit: members: [person1, person2, person3] + dependent_care_assistance_qualified_expenses: 5_000 filing_status: SEPARATE households: household: diff --git a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_expense_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_expense_deduction.yaml index 45b2c1eebec..6bf48653360 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_expense_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/cdcc_expense/va_child_dependent_care_expense_deduction.yaml @@ -44,6 +44,10 @@ tax_unit: members: [person1, person2, person3, person4] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: @@ -75,6 +79,10 @@ tax_unit: members: [person1, person2, person3] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 12_000 tax_unit_childcare_expenses: 12_000 households: household: @@ -106,6 +114,10 @@ tax_unit: members: [person1, person2, person3, person4] filing_status: JOINT + # Independently known current-year work-care costs for these + # qualifying individuals, net of disallowed public reimbursement, + # before employer exclusion; no carryovers or forfeitures. + dependent_care_assistance_qualified_expenses: 20_000 tax_unit_childcare_expenses: 20_000 households: household: diff --git a/policyengine_us/tests/test_separate_filer_and_dependent_care_wages.py b/policyengine_us/tests/test_separate_filer_and_dependent_care_wages.py index d7dca4289d4..6504b736c9a 100644 --- a/policyengine_us/tests/test_separate_filer_and_dependent_care_wages.py +++ b/policyengine_us/tests/test_separate_filer_and_dependent_care_wages.py @@ -12,7 +12,10 @@ exclusion <= employment income - benefits (IRC 129(b), Form 2441 line 18 earned income leaves out line 12 benefits). -Each example builds one simulation holding many tax units. +Each example builds one simulation holding many tax units. Wage examples +include an actual qualifying child and independently known $20,000 of +incurred work-care costs, with no carryovers, forfeitures or disallowed +public reimbursement; benefits do not establish those costs. """ from hypothesis import HealthCheck, given, settings @@ -104,19 +107,25 @@ def test_dependent_care_benefits_leave_wages_once(year, earners): benefits.append(benefit) people[f"p{i}"] = { "age": {year: 35}, + "is_tax_unit_head": {year: True}, "employment_income": {year: earner["wages"]}, "dependent_care_employer_benefits": {year: benefit}, } + people[f"child{i}"] = { + "age": {year: 5}, + "is_tax_unit_dependent": {year: True}, + } tax_units[f"t{i}"] = { - "members": [f"p{i}"], + "members": [f"p{i}", f"child{i}"], + "dependent_care_assistance_qualified_expenses": {year: 20_000}, "filing_status": {year: earner["status"]}, } sim = _simulate(year, people, tax_units) - wages = sim.calculate("employment_income", year) - box_1 = sim.calculate("irs_employment_income", year) - taxable = sim.calculate("taxable_dependent_care_benefits", year) + wages = sim.calculate("employment_income", year)[::2] + box_1 = sim.calculate("irs_employment_income", year)[::2] + taxable = sim.calculate("taxable_dependent_care_benefits", year)[::2] exclusion = sim.calculate("dependent_care_assistance_exclusion", year) - fica_wages = sim.calculate("payroll_tax_gross_wages", year) + fica_wages = sim.calculate("payroll_tax_gross_wages", year)[::2] for i, benefit in enumerate(benefits): assert box_1[i] == wages[i] - benefit assert fica_wages[i] == wages[i] - benefit diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py b/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py index c6b255f231c..9816bd65a67 100644 --- a/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py +++ b/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_exclusion.py @@ -30,6 +30,8 @@ def formula(tax_unit, period, parameters): # Total employer-provided dependent care benefits (Form 2441 line 12, # W-2 box 10). benefits = add(tax_unit, period, ["dependent_care_employer_benefits"]) + if not np.any(benefits > 0): + return np.zeros_like(benefits) p = parameters(period).gov.irs.gross_income.dependent_care_assistance_programs # Section 129(a)(2)(A) dollar cap by filing status (Form 2441 line 21; # $5,000, $2,500 MFS; $10,500 / $5,250 for 2021 under section @@ -50,7 +52,13 @@ def formula(tax_unit, period, parameters): # min_head_spouse_earned returns the taxpayer's earnings when unmarried # and the lesser of the two when married filing jointly. earned_income_limit = tax_unit("min_head_spouse_earned", period) - qualified_expenses = tax_unit("cdcc_qualified_care_expenses", period) + # Form 2441 line 16 is independent of the modeled net childcare bill: + # state subsidies can depend on AGI, which includes taxable benefits. + qualified_expenses = where( + tax_unit("count_cdcc_eligible", period) > 0, + tax_unit("dependent_care_assistance_qualified_expenses", period), + 0, + ) return max_( min_( benefits, diff --git a/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_qualified_expenses.py b/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_qualified_expenses.py new file mode 100644 index 00000000000..1257c19c51a --- /dev/null +++ b/policyengine_us/variables/gov/irs/credits/cdcc/dependent_care_assistance_qualified_expenses.py @@ -0,0 +1,29 @@ +from policyengine_us.model_api import * + + +class dependent_care_assistance_qualified_expenses(Variable): + value_type = float + entity = TaxUnit + label = "Qualified expenses for employer dependent care assistance" + unit = USD + definition_period = YEAR + default_value = 0 + reference = ( + "https://www.law.cornell.edu/uscode/text/26/129#e_1", + "https://www.law.cornell.edu/uscode/text/26/21#b_2", + # PDF pages 1 and 5: qualified expenses and Form 2441 line 16. + "https://www.irs.gov/pub/irs-prior/i2441--2017.pdf#page=1", + # PDF pages 2 and 5: qualified expenses and Form 2441 line 16. + "https://www.irs.gov/pub/irs-prior/i2441--2025.pdf#page=2", + ) + # Independently supplied employment-related expenses for qualifying care + # incurred this year, regardless of when paid, before employer benefits + # and statutory dollar/earnings limits, after disallowed reimbursements. + # Include eligible employer-paid care and disabled-adult/spousal care. + # Apply the year's reimbursement rules: the 2017 instructions retain + # state reimbursements included in income. Do not infer a change from + # the shorter wording in later instructions. + # Unreported expenses are modeled as zero, not established as zero. + # Neither W-2 box 10 nor gross bills establish this qualified amount; + # deriving it from modeled subsidies would create an AGI dependency cycle. + # See docs/gov/irs/historical-validation.md for the caller assumptions. diff --git a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_dependent_care_assistance_exclusion.py b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_dependent_care_assistance_exclusion.py index f415060ac92..b9bf665ff95 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_dependent_care_assistance_exclusion.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/credits/ca_dependent_care_assistance_exclusion.py @@ -13,13 +13,19 @@ class ca_dependent_care_assistance_exclusion(Variable): unit = USD definition_period = YEAR reference = ( + "https://www.ftb.ca.gov/forms/2017/17_3506.pdf#page=2", "https://www.ftb.ca.gov/forms/2021/2021-3506.pdf#page=2", + "https://www.ftb.ca.gov/forms/2025/2025-3506.pdf#page=2", "https://www.ftb.ca.gov/forms/2021/2021-3506-instructions.html", - "https://www.ftb.ca.gov/about-ftb/data-reports-plans/Summary-of-Federal-Income-Tax-Changes/index.html#PL-117-2-9632", + # P.L. 117-2 section 9632 and P.L. 119-21 section 70404. + "https://www.ftb.ca.gov/about-ftb/data-reports-plans/summary-of-federal-income-tax-changes/index.html#PL-117-2-9632", ) defined_for = StateCode.CA def formula(tax_unit, period, parameters): + benefits = add(tax_unit, period, ["dependent_care_employer_benefits"]) + if not np.any(benefits > 0): + return np.zeros_like(benefits) p = parameters(period).gov.states.ca.tax.income.credits.child_dependent_care # FTB 3506 Part IV lines 13-26 repeat Form 2441 Part III, except that # line 22 keeps California's own $5,000 ($2,500) cap: California did @@ -37,26 +43,20 @@ def formula(tax_unit, period, parameters): p.dependent_care_assistance_cap["SINGLE"], p.dependent_care_assistance_cap[filing_status], ) - # The federal exclusion is the lesser of the benefits, the federal cap - # and the earned-income limit. Capping it at the California amount - # gives line 26 whenever the federal cap is at least California's, - # as it is for every filer in 2021. - federal_exclusion = tax_unit("dependent_care_assistance_exclusion", period) - # The federal IRC 129(b) earned-income limit leaves out payroll HSA - # contributions, which California taxes. Where California's earned - # income is higher, let the exclusion rise by the difference, up to - # the benefits. This equals the lesser of the benefits, the cap and - # California earned income, because the federal cap is at least - # California's. - increase = max_( - tax_unit("ca_cdcc_min_head_spouse_earned", period) - - tax_unit("min_head_spouse_earned", period), + # FTB 3506 lines 17-18 limit benefits to independently known + # qualified costs; lines 19-21 apply California earned income. + # California taxes payroll HSA contributions, so its earnings may + # exceed federal earnings, but never override the expense ceiling. + qualified_expenses = where( + tax_unit("count_cdcc_eligible", period) > 0, + tax_unit("dependent_care_assistance_qualified_expenses", period), 0, ) - benefits = add(tax_unit, period, ["dependent_care_employer_benefits"]) - exclusion = where( - increase > 0, - min_(benefits, federal_exclusion + increase), - federal_exclusion, + earned_income_limit = tax_unit("ca_cdcc_min_head_spouse_earned", period) + return max_( + min_( + benefits, + min_(qualified_expenses, min_(dollar_cap, earned_income_limit)), + ), + 0, ) - return min_(exclusion, dollar_cap) From 43ca7bd3cd8615cac187db1b270ec2c3dd77f85f Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 14 Nov 2026 11:44:46 -0500 Subject: [PATCH 5/5] Supply qualified care costs in the Alabama branch test --- .../tests/test_pinned_branch_credit_dependents.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/policyengine_us/tests/test_pinned_branch_credit_dependents.py b/policyengine_us/tests/test_pinned_branch_credit_dependents.py index 8214dbc6c4a..6c822e0fe3d 100644 --- a/policyengine_us/tests/test_pinned_branch_credit_dependents.py +++ b/policyengine_us/tests/test_pinned_branch_credit_dependents.py @@ -84,6 +84,12 @@ def test_alabama_recomputes_dependent_care_exclusion_in_any_order(): "tax_unit": { "members": members, "tax_unit_childcare_expenses": {YEAR: 20_000}, + # Newly stipulated: all $20,000 is qualifying work-care + # incurred and paid in 2021 for these under-13 dependents, + # through an eligible provider, before employer benefits, + # net of disallowed public/third-party reimbursements. + # No carryovers or forfeitures; not inferred from W-2 box 10. + "dependent_care_assistance_qualified_expenses": {YEAR: 20_000}, } }, "households": {"household": {"members": members, "state_code": {YEAR: "AL"}}},