From d0023a5cbd05e65ed9a7864901cebfb8a1cc3ee7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 01:18:04 +0000 Subject: [PATCH 01/12] =?UTF-8?q?Restore=20California=E2=80=99s=20itemized?= =?UTF-8?q?=20deduction=20limitation=20for=20AMT=20only=20on=20itemized=20?= =?UTF-8?q?returns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ca-amt-itemizer-limitation.fixed.md | 1 + .../ca_itemized_deductions_limitation.yaml | 23 +++++++++++++++++++ .../amti/ca_amti_adjustments.py | 4 +--- .../amti/ca_itemized_deductions_limitation.py | 8 +++++-- .../ca/tax/income/deductions/ca_deductions.py | 2 +- .../ca/tax/income/deductions/ca_itemizes.py | 15 ++++++++++++ 6 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 changelog.d/ca-amt-itemizer-limitation.fixed.md create mode 100644 policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py diff --git a/changelog.d/ca-amt-itemizer-limitation.fixed.md b/changelog.d/ca-amt-itemizer-limitation.fixed.md new file mode 100644 index 00000000000..eabf5cfbb3a --- /dev/null +++ b/changelog.d/ca-amt-itemizer-limitation.fixed.md @@ -0,0 +1 @@ +Restore the California itemized deduction limitation for alternative minimum tax only when the filer itemizes on the state return. diff --git a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.yaml b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.yaml index 4a44add7a13..7d57b6683b5 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.yaml @@ -20,3 +20,26 @@ ca_itemized_deductions: 49_132.18 output: ca_itemized_deductions_limitation: 8_867.82 + +- name: California standard filers restore no potential itemized limitation on Schedule P + period: 2025 + input: + state_code: CA + ca_standard_deduction: 5_706 + ca_itemized_deductions_pre_limitation: 7_000 + ca_itemized_deductions: 5_000 + ca_agi: 400_000 + output: + ca_deductions: 5_706 + ca_itemized_deductions_limitation: 0 + ca_pre_exemption_amti: 400_000 + +- name: Equal state deductions keep the standard method for regular tax and AMT + period: 2025 + input: + state_code: CA + ca_standard_deduction: 5_706 + ca_itemized_deductions_pre_limitation: 7_000 + ca_itemized_deductions: 5_706 + output: + ca_itemized_deductions_limitation: 0 diff --git a/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_amti_adjustments.py b/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_amti_adjustments.py index 31b4c53e380..bce3601d5c5 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_amti_adjustments.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_amti_adjustments.py @@ -13,10 +13,8 @@ class ca_amti_adjustments(Variable): def formula(tax_unit, period, parameters): # Line 1 -14 p = parameters(period).gov.states.ca.tax.income.amt - itemized_ded = tax_unit("ca_itemized_deductions", period) + itemizes = tax_unit("ca_itemizes", period) standard_ded = tax_unit("ca_standard_deduction", period) - # Assuming that tax filer claimed itemized deducions if above standard ded amount - itemizes = itemized_ded > standard_ded itemized_sources = add(tax_unit, period, p.amti.sources) # Line 6 deductions = where(itemizes, itemized_sources, standard_ded) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.py b/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.py index ff1636da2c5..cbf03b2e3c3 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/alternative_minimum_tax/amti/ca_itemized_deductions_limitation.py @@ -8,7 +8,10 @@ class ca_itemized_deductions_limitation(Variable): defined_for = StateCode.CA unit = USD definition_period = YEAR - reference = "https://www.ftb.ca.gov/forms/2024/2024-540-p.pdf#page=1" + reference = ( + "https://www.ftb.ca.gov/forms/2024/2024-540-p.pdf#page=1", + "https://www.ftb.ca.gov/forms/2025/2025-540-p-instructions.html", + ) def formula(tax_unit, period, parameters): # Schedule P (540) Part I, line 18. For regular tax, high-AGI filers @@ -19,4 +22,5 @@ def formula(tax_unit, period, parameters): # income on Form 540 line 19 / Schedule P line 15). pre_limitation = tax_unit("ca_itemized_deductions_pre_limitation", period) post_limitation = tax_unit("ca_itemized_deductions", period) - return max_(pre_limitation - post_limitation, 0) + itemizes = tax_unit("ca_itemizes", period) + return where(itemizes, max_(pre_limitation - post_limitation, 0), 0) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_deductions.py b/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_deductions.py index 91ae6e79530..31d068a8a0e 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_deductions.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_deductions.py @@ -16,4 +16,4 @@ class ca_deductions(Variable): def formula(tax_unit, period, parameters): std_ded = tax_unit("ca_standard_deduction", period) itm_ded = tax_unit("ca_itemized_deductions", period) - return where(itm_ded > std_ded, itm_ded, std_ded) + return where(tax_unit("ca_itemizes", period), itm_ded, std_ded) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py b/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py new file mode 100644 index 00000000000..a97797fcc31 --- /dev/null +++ b/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py @@ -0,0 +1,15 @@ +from policyengine_us.model_api import * + + +class ca_itemizes(Variable): + value_type = bool + entity = TaxUnit + label = "Itemizes deductions on the California return" + defined_for = StateCode.CA + definition_period = YEAR + reference = "https://www.ftb.ca.gov/forms/2025/2025-540-instructions.html" + + def formula(tax_unit, period, parameters): + itemized = tax_unit("ca_itemized_deductions", period) + standard = tax_unit("ca_standard_deduction", period) + return itemized > standard From fde081434f8a00d976b423a7f3832a9b25229c33 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 01:39:43 +0000 Subject: [PATCH 02/12] Expose Hawaii's applicable standard deduction and resident itemization election --- .../hi-applicable-standard-deduction.fixed.md | 1 + .../itemized/threshold/deductions.yaml | 31 -------- .../standard/hi_standard_deduction.yaml | 76 +++++++++++++++++++ .../hi/tax/income/deductions/hi_deductions.py | 55 ++------------ .../hi/tax/income/deductions/hi_itemizes.py | 21 +++++ .../deductions/hi_required_to_itemize.py | 15 ++++ .../hi_itemized_deductions_eligible.py | 16 ++++ .../standard/hi_standard_deduction.py | 16 +++- 8 files changed, 147 insertions(+), 84 deletions(-) create mode 100644 changelog.d/hi-applicable-standard-deduction.fixed.md delete mode 100644 policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/threshold/deductions.yaml create mode 100644 policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py create mode 100644 policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_required_to_itemize.py create mode 100644 policyengine_us/variables/gov/states/hi/tax/income/deductions/itemized/hi_itemized_deductions_eligible.py diff --git a/changelog.d/hi-applicable-standard-deduction.fixed.md b/changelog.d/hi-applicable-standard-deduction.fixed.md new file mode 100644 index 00000000000..7dc349f2166 --- /dev/null +++ b/changelog.d/hi-applicable-standard-deduction.fixed.md @@ -0,0 +1 @@ +Use each Hawaii filer’s applicable standard deduction to determine eligibility for itemized deductions. diff --git a/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/threshold/deductions.yaml b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/threshold/deductions.yaml deleted file mode 100644 index 981c20c7c18..00000000000 --- a/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/threshold/deductions.yaml +++ /dev/null @@ -1,31 +0,0 @@ -description: Hawaii qualifies filers for itemized deductions with deductions over this amount, based on filing status. -SINGLE: - 2018-01-01: 2_200 -JOINT: - 2018-01-01: 4_400 -SEPARATE: - 2018-01-01: 2_200 -HEAD_OF_HOUSEHOLD: - 2018-01-01: 3_212 -SURVIVING_SPOUSE: - 2018-01-01: 4_400 -metadata: - propagate_metadata_to_children: true - breakdown: filing_status - unit: currency-USD - label: Hawaii itemized deductions deductions threshold - reference: - - title: 2022 Hawaii Resident Income Tax Instructions Itemized Deductions Worksheet - href: https://files.hawaii.gov/tax/forms/2022/n11ins.pdf#page=32 - - title: 2021 Hawaii Resident Income Tax Instructions Itemized Deductions Worksheet - href: https://files.hawaii.gov/tax/forms/2021/n11ins.pdf#page=32 - - title: 2020 Hawaii Resident Income Tax Instructions Itemized Deductions Worksheet - href: https://files.hawaii.gov/tax/forms/2020/n11ins.pdf#page=34 - - title: 2019 Hawaii Resident Income Tax Instructions Itemized Deductions Worksheet - href: https://files.hawaii.gov/tax/forms/2019/n11ins.pdf#page=38 - - title: 2018 Hawaii Resident Income Tax Instructions Itemized Deductions Worksheet - href: https://files.hawaii.gov/tax/forms/2018/n11ins.pdf#page=38 - - title: Hawaii Income Tax Law, Chapter 235, Section 235-2.4, (a)(2) - href: https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=10 - - title: 2025 Hawaii N-11 Instructions Itemized Deductions - href: https://files.hawaii.gov/tax/forms/current/n11ins.pdf#page=32 diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.yaml index 1bf143bee76..a3e72ad9cac 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.yaml @@ -13,3 +13,79 @@ filing_status: JOINT output: hi_standard_deduction: 4_400 + +- name: A dependent with no worksheet earnings receives the $500 minimum + period: 2025 + input: + state_code: HI + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 0 + hi_itemized_deductions: 510 + output: + hi_standard_deduction: 500 + hi_itemized_deductions_eligible: true + hi_itemizes: true + hi_deductions: 510 + +- name: Dependent worksheet earnings can limit the standard deduction + period: 2025 + input: + state_code: HI + filing_status: SINGLE + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 2_800 + hi_itemized_deductions: 2_800 + output: + hi_standard_deduction: 2_800 + hi_itemized_deductions_eligible: false + hi_itemizes: false + hi_deductions: 2_800 + +- name: High dependent earnings cannot raise the standard deduction above the filing-status amount + period: 2025 + input: + state_code: HI + filing_status: JOINT + head_or_spouse_is_dependent_elsewhere: true + standard_deduction_worksheet_earned_income: 15_000 + hi_itemized_deductions: 8_799 + output: + hi_standard_deduction: 8_800 + hi_itemized_deductions_eligible: false + hi_itemizes: false + +- name: Head of household itemization starts above the updated regular standard + period: 2025 + input: + state_code: HI + filing_status: HEAD_OF_HOUSEHOLD + hi_itemized_deductions: 6_425 + output: + hi_standard_deduction: 6_424 + hi_itemized_deductions_eligible: true + hi_itemizes: true + +- name: Separate filer required to itemize on Hawaii's return may deduct less than the usual threshold + period: 2025 + input: + state_code: HI + filing_status: SEPARATE + hi_required_to_itemize: true + hi_itemized_deductions: 275 + output: + hi_standard_deduction: 0 + hi_itemized_deductions_eligible: true + hi_itemizes: true + hi_deductions: 275 + +- name: A taxpayer who could itemize can elect the Hawaii standard deduction + period: 2025 + input: + state_code: HI + filing_status: SINGLE + hi_itemized_deductions: 7_000 + hi_itemizes: false + output: + hi_itemized_deductions_eligible: true + hi_deductions: 4_400 diff --git a/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_deductions.py b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_deductions.py index 55e78572067..b103f1b669f 100644 --- a/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_deductions.py +++ b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_deductions.py @@ -19,52 +19,9 @@ class hi_deductions(Variable): defined_for = StateCode.HI def formula(tax_unit, period, parameters): - p = parameters(period).gov.states.hi.tax.income.deductions.itemized - - standard_deduction = tax_unit("hi_standard_deduction", period) - total_itemized_deduction = tax_unit("hi_itemized_deductions", period) - filing_status = tax_unit("filing_status", period) - - # check itemized deduction eligibility - filing_status_eligible = ( - total_itemized_deduction > p.threshold.deductions[filing_status] - ) - # HRS 235-2.4(a)(3) applies IRC 63(c)(5): the standard deduction of a - # filer who can be claimed as a dependent is the greater of $500 or - # earned income, up to the regular amount. As federally, a joint - # return is limited when either spouse can be claimed. - is_dependent_on_another_return = tax_unit( - "head_or_spouse_is_dependent_elsewhere", period - ) - # Worksheet earned income: federal Form 1040 line 1 wages and Schedule - # 1 lines 3 (business) and 6 (farming), minus line 15 (N-11 - # instructions, PDF page 20). - worksheet_earned_income = tax_unit( - "standard_deduction_worksheet_earned_income", period - ) - dependent_standard_deduction = min_( - max_(p.threshold.dependent, worksheet_earned_income), standard_deduction - ) - applicable_standard_deduction = where( - is_dependent_on_another_return, - dependent_standard_deduction, - standard_deduction, - ) - dependent_eligible = is_dependent_on_another_return & ( - total_itemized_deduction > dependent_standard_deduction - ) - itemized_deductions_eligible = filing_status_eligible | dependent_eligible - itemized_deduction = where( - itemized_deductions_eligible, total_itemized_deduction, 0 - ) - non_itemizer_charitable_deduction = tax_unit( - "charitable_deduction_for_non_itemizers", period - ) - tip_income_deduction = tax_unit("hi_tip_income_deduction", period) - return ( - max_( - itemized_deduction, - applicable_standard_deduction + non_itemizer_charitable_deduction, - ) - + tip_income_deduction - ) + itemizes = tax_unit("hi_itemizes", period) + itemized = tax_unit("hi_itemized_deductions", period) + standard = tax_unit("hi_standard_deduction", period) + nonitemizer_charity = tax_unit("charitable_deduction_for_non_itemizers", period) + tips = tax_unit("hi_tip_income_deduction", period) + return where(itemizes, itemized, standard + nonitemizer_charity) + tips diff --git a/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py new file mode 100644 index 00000000000..7514a98c0bb --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py @@ -0,0 +1,21 @@ +from policyengine_us.model_api import * + + +class hi_itemizes(Variable): + value_type = bool + entity = TaxUnit + label = "Itemizes deductions on the Hawaii resident return" + definition_period = YEAR + defined_for = StateCode.HI + reference = ( + "https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=15", + "https://files.hawaii.gov/tax/news/announce/ann26-06.pdf#page=2", + ) + + def formula(tax_unit, period, parameters): + required = tax_unit("hi_required_to_itemize", period) + eligible = tax_unit("hi_itemized_deductions_eligible", period) + itemized = tax_unit("hi_itemized_deductions", period) + standard = tax_unit("hi_standard_deduction", period) + nonitemizer_charity = tax_unit("charitable_deduction_for_non_itemizers", period) + return required | (eligible & (itemized > standard + nonitemizer_charity)) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_required_to_itemize.py b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_required_to_itemize.py new file mode 100644 index 00000000000..fadcfb1a604 --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_required_to_itemize.py @@ -0,0 +1,15 @@ +from policyengine_us.model_api import * + + +class hi_required_to_itemize(Variable): + value_type = bool + entity = TaxUnit + label = "Required to itemize deductions on the Hawaii resident return" + documentation = ( + "The filer files a separate Hawaii return and their spouse itemizes " + "on the Hawaii return, or files a return for a period of less than " + "12 months because of a change in annual accounting period." + ) + definition_period = YEAR + defined_for = StateCode.HI + reference = "https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=15" diff --git a/policyengine_us/variables/gov/states/hi/tax/income/deductions/itemized/hi_itemized_deductions_eligible.py b/policyengine_us/variables/gov/states/hi/tax/income/deductions/itemized/hi_itemized_deductions_eligible.py new file mode 100644 index 00000000000..6fea39535fa --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/deductions/itemized/hi_itemized_deductions_eligible.py @@ -0,0 +1,16 @@ +from policyengine_us.model_api import * + + +class hi_itemized_deductions_eligible(Variable): + value_type = bool + entity = TaxUnit + label = "May itemize deductions on the Hawaii resident return" + definition_period = YEAR + defined_for = StateCode.HI + reference = "https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=15" + + def formula(tax_unit, period, parameters): + required = tax_unit("hi_required_to_itemize", period) + itemized = tax_unit("hi_itemized_deductions", period) + standard = tax_unit("hi_standard_deduction", period) + return required | (itemized > standard) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.py b/policyengine_us/variables/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.py index 8fcc21f050a..236138f4261 100644 --- a/policyengine_us/variables/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.py +++ b/policyengine_us/variables/gov/states/hi/tax/income/deductions/standard/hi_standard_deduction.py @@ -6,11 +6,19 @@ class hi_standard_deduction(Variable): entity = TaxUnit label = "Hawaii standard deduction" unit = USD - reference = "https://files.hawaii.gov/tax/forms/2022/n11ins.pdf" + reference = ( + "https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=11", + "https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=20", + ) definition_period = YEAR defined_for = StateCode.HI def formula(tax_unit, period, parameters): - p = parameters(period).gov.states.hi.tax.income.deductions.standard - filing_status = tax_unit("filing_status", period) - return p.amount[filing_status] + p = parameters(period).gov.states.hi.tax.income.deductions + status = tax_unit("filing_status", period) + regular = p.standard.amount[status] + dependent = tax_unit("head_or_spouse_is_dependent_elsewhere", period) + earned = tax_unit("standard_deduction_worksheet_earned_income", period) + limited = min_(regular, max_(p.itemized.threshold.dependent, earned)) + required = tax_unit("hi_required_to_itemize", period) + return where(required, 0, where(dependent, limited, regular)) From 5f988ca0b93f17c125d0c322e4bfcff938bfc9a3 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 01:02:44 +0000 Subject: [PATCH 03/12] Correct Virginia Schedule A deduction worksheet --- changelog.d/va-schedule-a-worksheet.fixed.md | 1 + .../itemized/medical_expense_floor.yaml | 12 +++++ .../itemized/reduction/applicable.yaml | 2 +- .../reduction/income_tax_fraction_scale.yaml | 12 +++++ .../itemized/reduction/reducible.yaml | 2 +- .../itemized/worksheet_allows_sales_tax.yaml | 13 +++++ .../deductions/va_itemized_deductions.yaml | 51 +++++++++++++++++++ .../state_and_local_sales_or_income_tax.py | 3 +- .../state_and_local_sales_tax_elected.py | 25 +++++++++ ...ped_state_and_local_sales_or_income_tax.py | 7 +++ .../deductions/va_itemized_deductions.py | 14 +++++ .../va_medical_expense_deduction.py | 19 +++++++ .../va_reduced_itemized_deductions.py | 8 +++ 13 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 changelog.d/va-schedule-a-worksheet.fixed.md create mode 100644 policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/medical_expense_floor.yaml create mode 100644 policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/income_tax_fraction_scale.yaml create mode 100644 policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/worksheet_allows_sales_tax.yaml create mode 100644 policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py create mode 100644 policyengine_us/variables/gov/states/va/tax/income/deductions/va_medical_expense_deduction.py diff --git a/changelog.d/va-schedule-a-worksheet.fixed.md b/changelog.d/va-schedule-a-worksheet.fixed.md new file mode 100644 index 00000000000..a08c28927e7 --- /dev/null +++ b/changelog.d/va-schedule-a-worksheet.fixed.md @@ -0,0 +1 @@ +Apply Virginia's Schedule A medical floor, line 5a sales tax election and proportional income tax addback. diff --git a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/medical_expense_floor.yaml b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/medical_expense_floor.yaml new file mode 100644 index 00000000000..774666d90d2 --- /dev/null +++ b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/medical_expense_floor.yaml @@ -0,0 +1,12 @@ +description: Virginia allows itemized medical expenses above this share of federal adjusted gross income. +values: + 2024-01-01: 0.10 +metadata: + unit: /1 + period: year + label: Virginia itemized medical expense floor + reference: + - title: 2024 Virginia Schedule A instructions, line 4 + href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2024-schedule-a-instructions.pdf#page=1 + - title: 2025 Virginia Schedule A instructions, line 4 + href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf#page=1 diff --git a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/applicable.yaml b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/applicable.yaml index 3f6a8818dbd..f70504197a3 100644 --- a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/applicable.yaml +++ b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/applicable.yaml @@ -1,7 +1,7 @@ description: Virginia sums up the following deductions to compute the itemized deductions reduction amount. values: 2013-01-01: - - medical_expense_deduction + - va_medical_expense_deduction - interest_deduction - charitable_deduction - real_estate_taxes diff --git a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/income_tax_fraction_scale.yaml b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/income_tax_fraction_scale.yaml new file mode 100644 index 00000000000..19a2668af3c --- /dev/null +++ b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/income_tax_fraction_scale.yaml @@ -0,0 +1,12 @@ +description: Virginia calculates the reduction fraction on line 11 of the Limited Itemized Deduction Worksheet to three decimal places. +values: + 2024-01-01: 1_000 +metadata: + unit: /1 + period: year + label: Virginia income tax addback rounding scale + reference: + - title: 2024 Virginia Limited Itemized Deduction Worksheet, line 11 + href: https://www.tax.virginia.gov/sites/default/files/taxforms/individual-income-tax/2024/schedule-2024.pdf#page=2 + - title: 2025 Virginia Limited Itemized Deduction Worksheet, line 11 + href: https://www.tax.virginia.gov/sites/default/files/taxforms/individual-income-tax/2025/schedule-2025.pdf#page=2 diff --git a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/reducible.yaml b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/reducible.yaml index 4775e39d0a3..fd16cd5d480 100644 --- a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/reducible.yaml +++ b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/reduction/reducible.yaml @@ -1,7 +1,7 @@ description: Virginia reduced the applicable itemized deductions by the following deductions to compute the itemized deductions reduction amount. values: 2013-01-01: - - medical_expense_deduction + - va_medical_expense_deduction - investment_interest_expense # Worksheet line 2: "any gambling losses included on Line 16a", which # is the deduction allowed, not the losses incurred. diff --git a/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/worksheet_allows_sales_tax.yaml b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/worksheet_allows_sales_tax.yaml new file mode 100644 index 00000000000..cee7978d474 --- /dev/null +++ b/policyengine_us/parameters/gov/states/va/tax/income/deductions/itemized/worksheet_allows_sales_tax.yaml @@ -0,0 +1,13 @@ +description: Virginia Schedule A keeps the elected general sales tax deduction and applies its separate line 5a computation. +values: + 2013-01-01: false + 2024-01-01: true +metadata: + unit: bool + period: year + label: Virginia Schedule A line 5a worksheet + reference: + - title: 2024 Virginia Schedule A instructions, lines 5a and 18 + href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2024-schedule-a-instructions.pdf#page=1 + - title: 2025 Virginia Schedule A instructions, lines 5a and 18 + href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf#page=1 diff --git a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_itemized_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_itemized_deductions.yaml index 370df6c7de4..4b963696cde 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_itemized_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/va/tax/income/deductions/va_itemized_deductions.yaml @@ -1,3 +1,54 @@ +- name: Virginia keeps elected sales tax and applies its own medical floor + period: 2024 + input: + state_code: VA + filing_status: SINGLE + adjusted_gross_income: 80_000 + itemized_medical_expenses: 12_000 + real_estate_taxes: 13_000 + charitable_deduction: 10_000 + state_sales_tax: 2_000 + state_withheld_income_tax: 1_000 + local_sales_tax: 0 + local_income_tax: 0 + output: + state_and_local_sales_tax_elected: true + medical_expense_deduction: 6_000 + va_medical_expense_deduction: 4_000 + va_itemized_deductions: 29_000 + +- name: Virginia limits line 5a and rounds the income tax reduction fraction + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: VA + filing_status: SINGLE + adjusted_gross_income: 344_800 + real_estate_taxes: 20_000 + state_and_local_sales_or_income_tax: 10_000 + state_and_local_sales_tax_elected: false + output: + va_capped_state_and_local_sales_or_income_tax: 10_000 + # Reduced by $363. The .012 worksheet fraction leaves $9,880 on line 18. + va_itemized_deductions: 19_757 + +- name: Virginia omits elected sales taxes from limited line 18 + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: VA + filing_status: SINGLE + adjusted_gross_income: 344_800 + real_estate_taxes: 20_000 + state_sales_tax: 10_000 + state_withheld_income_tax: 12_000 + local_sales_tax: 0 + local_income_tax: 0 + state_and_local_sales_tax_elected: true + output: + state_and_local_sales_or_income_tax: 10_000 + va_itemized_deductions: 29_637 + - name: 2021 Virginia itemized deduction for a single filer period: 2021 input: diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_or_income_tax.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_or_income_tax.py index 1c951eaf181..6a1ad3489ef 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_or_income_tax.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_or_income_tax.py @@ -14,4 +14,5 @@ def formula(tax_unit, period, parameters): tax_unit, period, ["state_withheld_income_tax", "local_income_tax"] ) sales_tax = add(tax_unit, period, ["state_sales_tax", "local_sales_tax"]) - return max_(income_tax, sales_tax) + elects_sales_tax = tax_unit("state_and_local_sales_tax_elected", period) + return where(elects_sales_tax, sales_tax, income_tax) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py new file mode 100644 index 00000000000..7a6abdb18c9 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py @@ -0,0 +1,25 @@ +from policyengine_us.model_api import * + + +class state_and_local_sales_tax_elected(Variable): + value_type = bool + entity = TaxUnit + label = "Elect state and local general sales taxes on federal Schedule A" + definition_period = YEAR + reference = "https://www.law.cornell.edu/uscode/text/26/164#b_5" + + def formula(tax_unit, period, parameters): + # An input with only the total has historically represented income tax + # for Virginia. A filer can supply the election with the total. + simulation = tax_unit.simulation + if any( + ("state_and_local_sales_or_income_tax", branch, period) + in simulation._user_input_keys + for branch in simulation._get_visible_branch_names() + ): + return False + income_tax = add( + tax_unit, period, ["state_withheld_income_tax", "local_income_tax"] + ) + sales_tax = add(tax_unit, period, ["state_sales_tax", "local_sales_tax"]) + return sales_tax > income_tax diff --git a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_capped_state_and_local_sales_or_income_tax.py b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_capped_state_and_local_sales_or_income_tax.py index aaaf5b0fd7f..b0a47c24f08 100644 --- a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_capped_state_and_local_sales_or_income_tax.py +++ b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_capped_state_and_local_sales_or_income_tax.py @@ -20,3 +20,10 @@ def formula(tax_unit, period, parameters): state_and_local_tax_cap - real_estate_tax, 0 ) return min_(uncapped_state_and_local_tax, cap_reduced_by_real_estate_tax) + + def formula_2024(tax_unit, period, parameters): + # Virginia caps line 5a separately from lines 5b and 5c. + return min_( + tax_unit("state_and_local_sales_or_income_tax", period), + tax_unit("salt_cap", period), + ) diff --git a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_itemized_deductions.py b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_itemized_deductions.py index 19e01ceb618..a7848eebeda 100644 --- a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_itemized_deductions.py +++ b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_itemized_deductions.py @@ -31,6 +31,20 @@ def formula(tax_unit, period, parameters): itemized_ded_reduced_by_uncapped_state_and_local = max_( va_itm_deds - uncapped_state_and_local_tax, 0 ) + if p_va.worksheet_allows_sales_tax: + medical = tax_unit("va_medical_expense_deduction", period) + federal_medical = tax_unit("medical_expense_deduction", period) + elects_sales_tax = tax_unit("state_and_local_sales_tax_elected", period) + capped_line_5a = tax_unit( + "va_capped_state_and_local_sales_or_income_tax", period + ) + itemized_ded_reduced_by_uncapped_state_and_local = max_( + itm_deds_less_salt + + (medical - federal_medical) + + uncapped_property_taxes + + where(elects_sales_tax, capped_line_5a, 0), + 0, + ) # Output if deductions are limited selected_ded_reduced_by_reduced_state_and_local = tax_unit( "va_reduced_itemized_deductions", period diff --git a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_medical_expense_deduction.py b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_medical_expense_deduction.py new file mode 100644 index 00000000000..b6b1bc24fdb --- /dev/null +++ b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_medical_expense_deduction.py @@ -0,0 +1,19 @@ +from policyengine_us.model_api import * + + +class va_medical_expense_deduction(Variable): + value_type = float + entity = TaxUnit + label = "Virginia itemized medical expense deduction" + unit = USD + definition_period = YEAR + reference = "https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf#page=1" + + def formula(tax_unit, period, parameters): + return tax_unit("medical_expense_deduction", period) + + def formula_2024(tax_unit, period, parameters): + p = parameters(period).gov.states.va.tax.income.deductions.itemized + medical_expenses = add(tax_unit, period, ["itemized_medical_expenses"]) + federal_agi = max_(tax_unit("adjusted_gross_income", period), 0) + return max_(medical_expenses - p.medical_expense_floor * federal_agi, 0) diff --git a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.py b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.py index 567c3261b23..78d3fd283ae 100644 --- a/policyengine_us/variables/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.py +++ b/policyengine_us/variables/gov/states/va/tax/income/deductions/va_reduced_itemized_deductions.py @@ -84,6 +84,9 @@ def formula(tax_unit, period, parameters): adjustment_fraction = np.zeros_like(excess_ded) mask = excess_ded != 0 adjustment_fraction[mask] = va_itm_deds_adjustment[mask] / excess_ded[mask] + if p_va.worksheet_allows_sales_tax: + scale = p_va.reduction.income_tax_fraction_scale + adjustment_fraction = np.floor(adjustment_fraction * scale + 0.5) / scale # Part B Line 13 - capped state and local income tax # Line 14 - Multiply line 11 by line 13 @@ -96,4 +99,9 @@ def formula(tax_unit, period, parameters): reduced_state_and_local_tax = max_( capped_state_and_local_tax - state_and_local_tax_adj, 0 ) + if p_va.worksheet_allows_sales_tax: + elects_sales_tax = tax_unit("state_and_local_sales_tax_elected", period) + reduced_state_and_local_tax = where( + elects_sales_tax, 0, reduced_state_and_local_tax + ) return max_(reduced_selected_ded - reduced_state_and_local_tax, 0) From 8bd06c29d6c1bc06d8927f88c3dca1394b8ecd71 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Wed, 18 Nov 2026 22:25:48 +0000 Subject: [PATCH 04/12] Apply Oregon Schedule 1-A subtractions --- .../or-schedule-1a-conformity.fixed.md | 1 + .../tax/income/subtractions/schedule_1a.yaml | 22 ++++++++++++ .../states/or/tax/income/credits/or_ctc.yaml | 14 ++++++++ .../or/tax/income/or_taxable_income.yaml | 35 +++++++++++++++++++ .../states/or/tax/income/or_taxable_income.py | 5 +++ 5 files changed, 77 insertions(+) create mode 100644 changelog.d/or-schedule-1a-conformity.fixed.md create mode 100644 policyengine_us/parameters/gov/states/or/tax/income/subtractions/schedule_1a.yaml diff --git a/changelog.d/or-schedule-1a-conformity.fixed.md b/changelog.d/or-schedule-1a-conformity.fixed.md new file mode 100644 index 00000000000..05e6453b087 --- /dev/null +++ b/changelog.d/or-schedule-1a-conformity.fixed.md @@ -0,0 +1 @@ +Apply Oregon's federal tip and overtime subtractions and its 2025 vehicle-loan interest subtraction to taxable income. diff --git a/policyengine_us/parameters/gov/states/or/tax/income/subtractions/schedule_1a.yaml b/policyengine_us/parameters/gov/states/or/tax/income/subtractions/schedule_1a.yaml new file mode 100644 index 00000000000..a10ddf511ce --- /dev/null +++ b/policyengine_us/parameters/gov/states/or/tax/income/subtractions/schedule_1a.yaml @@ -0,0 +1,22 @@ +description: Oregon subtracts these federal Schedule 1-A deductions from income on a full-year resident return. +metadata: + label: Oregon Schedule 1-A subtractions + period: year + unit: list + reference: + - title: ORS 316.048, taxable income of full-year residents + href: https://www.oregonlegislature.gov/bills_laws/ors/ors316.html + - title: 2025 Publication OR-17, federal tip, overtime and vehicle interest deductions + href: https://www.oregon.gov/dor/forms/FormsPubs/publication-or-17_101-431_2025.pdf#page=70 + - title: Oregon Laws 2026, chapter 142, sections 2 and 10 + href: https://www.oregonlegislature.gov/bills_laws/lawsstatutes/2026orlaw0142.pdf#page=1 +values: + 0001-01-01: [] + 2025-01-01: + - tip_income_deduction + - overtime_income_deduction + - auto_loan_interest_deduction + 2026-01-01: + - tip_income_deduction + - overtime_income_deduction + 2029-01-01: [] diff --git a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/credits/or_ctc.yaml b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/credits/or_ctc.yaml index 5f66e285a02..a7f2bd9eefb 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/credits/or_ctc.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/credits/or_ctc.yaml @@ -1,3 +1,17 @@ +- name: Oregon Kids Credit adds back the three Schedule 1-A subtractions + period: 2025 + input: + state_code: OR + age: 5 + is_tax_unit_dependent: true + adjusted_gross_income: 30_000 + or_federal_tax_liability_subtraction: 0 + tip_income_deduction: 1_000 + overtime_income_deduction: 2_000 + auto_loan_interest_deduction: 500 + output: + or_ctc: 325.5 + - name: $1,000 maximum in 2023. period: 2023 input: diff --git a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/or_taxable_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/or_taxable_income.yaml index f87f82684d2..d274a771d0c 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/or_taxable_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/or_taxable_income.yaml @@ -6,3 +6,38 @@ or_deductions: 1 output: or_taxable_income: 0 + +- name: Oregon subtracts tips, overtime and vehicle interest in 2025 + period: 2025 + input: + state_code: OR + or_agi: 30_000 + or_deductions: 3_000 + tip_income_deduction: 1_000 + overtime_income_deduction: 2_000 + auto_loan_interest_deduction: 500 + additional_senior_deduction: 6_000 + output: + or_taxable_income: 23_500 + +- name: Oregon disconnects from the vehicle interest deduction in 2026 + period: 2026 + input: + state_code: OR + or_agi: 30_000 + or_deductions: 3_000 + tip_income_deduction: 1_000 + overtime_income_deduction: 2_000 + auto_loan_interest_deduction: 500 + output: + or_taxable_income: 24_000 + +- name: Oregon taxable income floors at zero after its Schedule 1-A subtractions + period: 2025 + input: + state_code: OR + or_agi: 3_000 + or_deductions: 2_900 + tip_income_deduction: 500 + output: + or_taxable_income: 0 diff --git a/policyengine_us/variables/gov/states/or/tax/income/or_taxable_income.py b/policyengine_us/variables/gov/states/or/tax/income/or_taxable_income.py index 80ceba8533e..db4efbab7cf 100644 --- a/policyengine_us/variables/gov/states/or/tax/income/or_taxable_income.py +++ b/policyengine_us/variables/gov/states/or/tax/income/or_taxable_income.py @@ -12,4 +12,9 @@ class or_taxable_income(Variable): def formula(tax_unit, period, parameters): or_agi = tax_unit("or_agi", period) deductions = tax_unit("or_deductions", period) + p = parameters(period).gov.states["or"].tax.income.subtractions + schedule_1a = p.schedule_1a + if schedule_1a: + # The Oregon Kids Credit adds these subtractions back to its income base. + or_agi = or_agi - add(tax_unit, period, schedule_1a) return max_(or_agi - deductions, 0) From 4beb7fdb53585ce848bc5dc1ec2917d74a44e15a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Wed, 18 Nov 2026 22:42:37 +0000 Subject: [PATCH 05/12] Require a federal Schedule A medical claim for Vermont's deduction --- .../vt-require-federal-medical-claim.fixed.md | 1 + .../vt_medical_expense_deductions.yaml | 26 ++++++++++++++++ .../vt_medical_expense_deduction.py | 30 +++++-------------- 3 files changed, 35 insertions(+), 22 deletions(-) create mode 100644 changelog.d/vt-require-federal-medical-claim.fixed.md diff --git a/changelog.d/vt-require-federal-medical-claim.fixed.md b/changelog.d/vt-require-federal-medical-claim.fixed.md new file mode 100644 index 00000000000..9e7692d59c6 --- /dev/null +++ b/changelog.d/vt-require-federal-medical-claim.fixed.md @@ -0,0 +1 @@ +Require federal itemization to claim Vermont’s medical expense deduction. diff --git a/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/agi/subtractions/vt_medical_expense_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/agi/subtractions/vt_medical_expense_deductions.yaml index 4eee36ac234..870d631d820 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/agi/subtractions/vt_medical_expense_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/vt/tax/income/agi/subtractions/vt_medical_expense_deductions.yaml @@ -2,6 +2,7 @@ period: 2022 input: state_code: ME # Test state definition + tax_unit_itemizes: true medical_expense_deduction: 5_000 vt_standard_deduction: 1_000 vt_personal_exemptions: 1_000 @@ -12,6 +13,7 @@ period: 2022 input: state_code: VT + tax_unit_itemizes: true medical_expense_deduction: 5_000 vt_standard_deduction: 1_000 vt_personal_exemptions: 1_000 @@ -22,6 +24,7 @@ period: 2022 input: state_code: VT + tax_unit_itemizes: true medical_expense_deduction: 1_000 vt_standard_deduction: 1_000 vt_personal_exemptions: 1_000 @@ -32,8 +35,31 @@ period: 2022 input: state_code: VT + tax_unit_itemizes: true medical_expense_deduction: 2_000 vt_standard_deduction: 1_000 vt_personal_exemptions: 1_000 output: vt_medical_expense_deduction: 0 # max(0,2000-2000) = 0 + +- name: A federal standard-deduction filer cannot claim hypothetical Schedule A medical expenses + period: 2025 + input: + state_code: VT + tax_unit_itemizes: false + medical_expense_deduction: 5_000 + vt_standard_deduction: 1_000 + vt_personal_exemptions: 1_000 + output: + vt_medical_expense_deduction: 0 + +- name: The Vermont medical deduction starts in 2019 + period: 2018 + input: + state_code: VT + tax_unit_itemizes: true + medical_expense_deduction: 5_000 + vt_standard_deduction: 1_000 + vt_personal_exemptions: 1_000 + output: + vt_medical_expense_deduction: 0 diff --git a/policyengine_us/variables/gov/states/vt/tax/income/adjusted_gross_income/subtractions/vt_medical_expense_deduction.py b/policyengine_us/variables/gov/states/vt/tax/income/adjusted_gross_income/subtractions/vt_medical_expense_deduction.py index f2387f67610..b5e3f1b3f3d 100644 --- a/policyengine_us/variables/gov/states/vt/tax/income/adjusted_gross_income/subtractions/vt_medical_expense_deduction.py +++ b/policyengine_us/variables/gov/states/vt/tax/income/adjusted_gross_income/subtractions/vt_medical_expense_deduction.py @@ -8,30 +8,16 @@ class vt_medical_expense_deduction(Variable): label = "Vermont medical expense deduction" reference = ( "https://legislature.vermont.gov/statutes/section/32/151/05811", # Titl. 32 V.S.A. § 5811(21)(C)(iv) - "https://tax.vermont.gov/sites/tax/files/documents/IN-112%20Instr-2022.pdf#page=2", # Instruction for 2022 SCHEDULE IN-112 - MEDICAL DEDUCTION WORKSHEET + "https://tax.vermont.gov/medical-deduction", ) unit = USD defined_for = StateCode.VT documentation = "Vermont medical expenses deducted from taxable income." - def formula(tax_unit, period, parameters): - # Get federal medical expense deduction (Worksheet line 1a). - # This points to federal Form 1040, Schedule A, Line 4, which is the deduction itself - # (not the expenses). - # The law says "an amount equal to the itemized deduction for medical expenses - # taken at the federal level by the taxpayer" but does not state whether the filer - # must have itemized on the federal return to claim it. - # We assume they do not have to, based on the form. - federal_medical_expense_deduction = tax_unit( - "medical_expense_deduction", period - ) - # Get Vermont standard deduction plus personal exemptions (Worksheet line 2). - vt_standard_deduction = tax_unit("vt_standard_deduction", period) - vt_personal_exemptions = tax_unit("vt_personal_exemptions", period) - # Subtract standard deduction plus personal exemptions from vt allowed medical expense deduction and return (Worksheet line 3). - return max_( - 0, - federal_medical_expense_deduction - - vt_standard_deduction - - vt_personal_exemptions, - ) + def formula_2019(tax_unit, period, parameters): + # IN-112 starts from medical expenses claimed on federal Schedule A, line 4. + itemizes = tax_unit("tax_unit_itemizes", period) + medical = tax_unit("medical_expense_deduction", period) + standard = tax_unit("vt_standard_deduction", period) + exemptions = tax_unit("vt_personal_exemptions", period) + return where(itemizes, max_(0, medical - standard - exemptions), 0) From 3dbaf4a7e4b8ff26038f3009e0ad10069659bf7f Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 00:00:22 +0000 Subject: [PATCH 06/12] Apply the 2025 South Carolina SALT conformity adjustment --- changelog.d/sc-2025-salt-conformity.fixed.md | 1 + .../income/sc_salt_conformity_addback.yaml | 103 ++++++++++++++++++ ...ederal_itemized_personal_property_taxes.py | 16 +++ .../tax/income/additions/sc_obbba_addback.py | 1 + .../additions/sc_salt_conformity_addback.py | 49 +++++++++ .../income/additions/sc_state_tax_addback.py | 13 ++- 6 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 changelog.d/sc-2025-salt-conformity.fixed.md create mode 100644 policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/sc_salt_conformity_addback.yaml create mode 100644 policyengine_us/variables/gov/states/sc/tax/income/additions/sc_federal_itemized_personal_property_taxes.py create mode 100644 policyengine_us/variables/gov/states/sc/tax/income/additions/sc_salt_conformity_addback.py diff --git a/changelog.d/sc-2025-salt-conformity.fixed.md b/changelog.d/sc-2025-salt-conformity.fixed.md new file mode 100644 index 00000000000..1f9b1ff082d --- /dev/null +++ b/changelog.d/sc-2025-salt-conformity.fixed.md @@ -0,0 +1 @@ +Apply South Carolina’s pre-OBBBA SALT limit on 2025 resident returns and account for the state tax already added back. diff --git a/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/sc_salt_conformity_addback.yaml b/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/sc_salt_conformity_addback.yaml new file mode 100644 index 00000000000..a42ecf247be --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/sc/tax/income/sc_salt_conformity_addback.yaml @@ -0,0 +1,103 @@ +- name: Subtract the income taxes already added back on line a + period: 2025 + input: + state_code: SC + filing_status: SINGLE + tax_unit_itemizes: true + itemized_taxable_income_deductions: 42_000 + real_estate_taxes: 22_000 + sc_federal_itemized_personal_property_taxes: 2_000 + state_and_local_sales_or_income_tax: 12_000 + salt_deduction: 36_000 + output: + sc_state_tax_addback: 12_000 + # $36,000 of SALT less $10,000 of allowable property tax less line a. + sc_salt_conformity_addback: 14_000 + sc_obbba_addback: 14_000 + +- name: State standard deduction limits the combined addition for a joint filer + period: 2025 + input: + state_code: SC + filing_status: JOINT + tax_unit_itemizes: true + itemized_taxable_income_deductions: 35_000 + real_estate_taxes: 3_000 + state_and_local_sales_or_income_tax: 23_000 + salt_deduction: 26_000 + output: + # $35,000 less the $31,500 federal standard deduction. + sc_state_tax_addback: 3_500 + # The two additions together cannot exceed $35,000 - $30,000. + sc_salt_conformity_addback: 1_500 + +- name: Property tax conformity adjustment stops at the pre-OBBBA standard deduction + period: 2025 + input: + state_code: SC + filing_status: SINGLE + tax_unit_itemizes: true + itemized_taxable_income_deductions: 24_000 + real_estate_taxes: 20_000 + state_and_local_sales_or_income_tax: 0 + salt_deduction: 20_000 + output: + sc_state_tax_addback: 0 + # The uncapped difference is $10,000, but $24,000 - $15,000 is $9,000. + sc_salt_conformity_addback: 9_000 + +- name: Separate filers use the $5,000 prior cap and zero on worksheet line 2 + period: 2025 + input: + state_code: SC + filing_status: SEPARATE + tax_unit_itemizes: true + itemized_taxable_income_deductions: 14_000 + real_estate_taxes: 8_000 + state_and_local_sales_or_income_tax: 3_000 + salt_deduction: 11_000 + output: + sc_state_tax_addback: 3_000 + sc_salt_conformity_addback: 3_000 + +- name: Use the applicable federal cap on the state tax addback worksheet + period: 2025 + input: + state_code: SC + filing_status: SINGLE + tax_unit_itemizes: true + itemized_taxable_income_deductions: 35_000 + real_estate_taxes: 5_000 + sc_federal_itemized_personal_property_taxes: 2_000 + state_and_local_sales_or_income_tax: 6_000 + salt_cap: 10_000 + salt_deduction: 10_000 + output: + sc_state_tax_addback: 3_000 + sc_salt_conformity_addback: 0 + +- name: No itemized SALT addition when the taxpayer takes the federal standard deduction + period: 2025 + input: + state_code: SC + filing_status: SINGLE + tax_unit_itemizes: false + real_estate_taxes: 24_000 + state_and_local_sales_or_income_tax: 12_000 + salt_deduction: 36_000 + itemized_taxable_income_deductions: 42_000 + output: + sc_state_tax_addback: 0 + sc_salt_conformity_addback: 0 + sc_obbba_addback: 750 + +- name: This adjustment ends with South Carolina's 2025 tax base + period: 2026 + input: + state_code: SC + tax_unit_itemizes: true + salt_deduction: 36_000 + real_estate_taxes: 24_000 + itemized_taxable_income_deductions: 42_000 + output: + sc_salt_conformity_addback: 0 diff --git a/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_federal_itemized_personal_property_taxes.py b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_federal_itemized_personal_property_taxes.py new file mode 100644 index 00000000000..9f974a5b7cc --- /dev/null +++ b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_federal_itemized_personal_property_taxes.py @@ -0,0 +1,16 @@ +from policyengine_us.model_api import * + + +class sc_federal_itemized_personal_property_taxes(Variable): + value_type = float + entity = TaxUnit + label = "Personal property taxes reported on federal Schedule A for South Carolina" + unit = USD + definition_period = YEAR + defined_for = StateCode.SC + documentation = ( + "Federal Schedule A line 5c, separate from real estate taxes. " + "When providing the filed federal deduction, include the deductible " + "personal property tax in the federal Schedule A inputs as well." + ) + reference = "https://dor.sc.gov/sites/dor/files/forms/SC1040Instr_2025.pdf#page=4" diff --git a/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_obbba_addback.py b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_obbba_addback.py index 453f1ab70fe..3bbe34c1465 100644 --- a/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_obbba_addback.py +++ b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_obbba_addback.py @@ -41,4 +41,5 @@ def formula(tax_unit, period, parameters): + tip_deduction + overtime_deduction + auto_loan_deduction + + tax_unit("sc_salt_conformity_addback", period) ) diff --git a/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_salt_conformity_addback.py b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_salt_conformity_addback.py new file mode 100644 index 00000000000..f49e8d7fbe5 --- /dev/null +++ b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_salt_conformity_addback.py @@ -0,0 +1,49 @@ +from policyengine_us.model_api import * + + +class sc_salt_conformity_addback(Variable): + value_type = float + entity = TaxUnit + label = "South Carolina SALT conformity addition after the state tax addback" + unit = USD + definition_period = YEAR + defined_for = StateCode.SC + end = "2025-12-31" + reference = ( + "https://www.scstatehouse.gov/Archives/CodeofLaws2025/t12c006.php#12-6-1130", + "https://dor.sc.gov/income-tax-south-carolina-internal-revenue-code-conformity-update", + "https://dor.sc.gov/sites/dor/files/forms/SC1040Instr_2025.pdf#page=4", + ) + + def formula_2025(tax_unit, period, parameters): + filing_status = tax_unit("filing_status", period) + # South Carolina conforms to IRC section 164 as of December 31, 2024. + prior_cap = parameters( + "2024-12-31" + ).gov.irs.deductions.itemized.salt_and_real_estate.cap[filing_status] + property_taxes = add( + tax_unit, + period, + ["real_estate_taxes", "sc_federal_itemized_personal_property_taxes"], + ) + federal_salt = tax_unit("salt_deduction", period) + disallowed_taxes = max_(0, federal_salt - min_(property_taxes, prior_cap)) + + # Line 2 of the worksheet is zero for separate filers. Other filers + # retain the age/blind amounts and any dependent limitation. + p = parameters(period).gov.states.sc.tax.income.additions.obbba + basic = tax_unit("basic_standard_deduction", period) + standard_increase = max_( + 0, basic - p.pre_obbba_standard_deduction[filing_status] + ) + old_standard = where( + filing_status == filing_status.possible_values.SEPARATE, + 0, + tax_unit("standard_deduction", period) - standard_increase, + ) + itemized = tax_unit("itemized_taxable_income_deductions", period) + combined_addback = min_(disallowed_taxes, max_(0, itemized - old_standard)) + # SC1040 line a already restores the deductible income or sales taxes. + line_a = tax_unit("sc_state_tax_addback", period) + itemizes = tax_unit("tax_unit_itemizes", period) + return where(itemizes, max_(0, combined_addback - line_a), 0) diff --git a/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_state_tax_addback.py b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_state_tax_addback.py index 7534b333515..b92815a4c60 100644 --- a/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_state_tax_addback.py +++ b/policyengine_us/variables/gov/states/sc/tax/income/additions/sc_state_tax_addback.py @@ -8,6 +8,7 @@ class sc_state_tax_addback(Variable): unit = USD definition_period = YEAR reference = ( + "https://dor.sc.gov/sites/dor/files/forms/SC1040Instr_2025.pdf#page=4", "https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2", "https://dor.sc.gov/forms-site/Forms/SC1040inst_2022.pdf#page=2", "https://www.scstatehouse.gov/code/t12c006.php", # SECTION 12-6-1130 (2) @@ -34,11 +35,17 @@ def formula(tax_unit, period, parameters): # line 4 salt = tax_unit("state_and_local_sales_or_income_tax", period) # line 5 - real_estate_and_property_taxes = add(tax_unit, period, ["real_estate_taxes"]) + real_estate_and_property_taxes = tax_unit("real_estate_taxes", period) + if period.start.year == 2025: + limit = tax_unit("salt_cap", period) + real_estate_and_property_taxes = real_estate_and_property_taxes + tax_unit( + "sc_federal_itemized_personal_property_taxes", period + ) + else: + limit = p_us.itemized.salt_and_real_estate.cap[filing_status] less_income_amount = max_( 0, - p_us.itemized.salt_and_real_estate.cap[filing_status] - - real_estate_and_property_taxes, + limit - real_estate_and_property_taxes, ) # compare line 3,4,5. get the minimum salt_or_income = min_(salt, less_income_amount) From 237e3a89a6a0827c21ee4cda1b8003aee0026e72 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 11:57:03 +0000 Subject: [PATCH 07/12] Evaluate joint federal and state deduction elections --- .../joint-federal-state-itemization.added.md | 1 + .../joint_federal_state_itemization.yaml | 6 + .../federal_itemizers_only.yaml | 13 ++ .../resident_itemization/follows_federal.yaml | 17 ++ .../independent_states.yaml | 33 +++ .../core/test_joint_itemization_branches.py | 123 ++++++++++ .../tax_unit_joint_itemization.yaml | 99 ++++++++ .../tax/income/deductions/md_deductions.yaml | 29 +++ .../deductions/me_deductions.yaml | 18 ++ .../taxable_income/mo_taxable_income.yaml | 32 +++ ..._elects_tuition_credit_when_itemizing.yaml | 170 ++++++++++++++ .../independent_state_deduction_methods.yaml | 192 +++++++++++++++ policyengine_us/tools/state_itemization.py | 221 ++++++++++++++++++ .../state_and_local_sales_tax_elected.py | 17 +- .../deductions/tax_unit_itemizes.py | 8 + .../deductions/tax_unit_joint_itemization.py | 20 ++ .../al/tax/income/deductions/al_deductions.py | 5 +- .../income/deductions/ar_deduction_joint.py | 5 +- .../income/deductions/ar_tax_unit_itemizes.py | 4 +- .../low_income/ar_low_income_tax_joint.py | 7 + .../az/tax/income/deductions/az_deductions.py | 5 +- .../ca/tax/income/deductions/ca_itemizes.py | 5 +- .../income/deductions/de_tax_unit_itemizes.py | 4 +- .../hi/tax/income/deductions/hi_itemizes.py | 7 +- .../id/tax/income/deductions/id_itemizes.py | 6 +- .../states/ks/tax/income/ks_taxable_income.py | 5 +- .../income/deductions/ky_deductions_joint.py | 10 +- .../income/deductions/ky_tax_unit_itemizes.py | 4 +- .../md/tax/income/deductions/md_deductions.py | 7 +- .../income/taxable_income/me_deductions.py | 18 +- .../mn/tax/income/deductions/mn_itemizing.py | 4 +- .../taxable_income/mo_taxable_income.py | 7 +- .../income/deductions/ms_deductions_joint.py | 5 +- .../income/deductions/ms_tax_unit_itemizes.py | 4 +- .../deductions/nc_standard_deduction.py | 9 +- .../nc_standard_or_itemized_deductions.py | 5 +- .../ny_college_tuition_credit_eligible.py | 4 +- ...ny_elects_tuition_credit_when_itemizing.py | 27 +++ .../itemized/ny_college_tuition_deduction.py | 11 +- .../deductions/itemized/ny_itemizes.py | 17 +- .../income/taxable_income/ny_deductions.py | 16 ++ .../tax/income/state_deduction_method.py | 25 ++ 42 files changed, 1192 insertions(+), 33 deletions(-) create mode 100644 changelog.d/joint-federal-state-itemization.added.md create mode 100644 policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml create mode 100644 policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml create mode 100644 policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml create mode 100644 policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml create mode 100644 policyengine_us/tests/core/test_joint_itemization_branches.py create mode 100644 policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_deductions.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml create mode 100644 policyengine_us/tests/policy/baseline/gov/states/tax/income/independent_state_deduction_methods.yaml create mode 100644 policyengine_us/tools/state_itemization.py create mode 100644 policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.py create mode 100644 policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py create mode 100644 policyengine_us/variables/gov/states/tax/income/state_deduction_method.py diff --git a/changelog.d/joint-federal-state-itemization.added.md b/changelog.d/joint-federal-state-itemization.added.md new file mode 100644 index 00000000000..6bc11ba2344 --- /dev/null +++ b/changelog.d/joint-federal-state-itemization.added.md @@ -0,0 +1 @@ +Add an opt-in choice of federal and state deduction methods that minimizes modeled federal, state, and local tax for full-year residents in tax year 2025. diff --git a/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml b/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml new file mode 100644 index 00000000000..877217d2d9b --- /dev/null +++ b/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml @@ -0,0 +1,6 @@ +description: Choose full-year resident deduction methods for tax year 2025 by minimizing combined federal, state, and local tax liability. +metadata: + unit: bool + label: Joint federal and state itemization +values: + 0000-01-01: false diff --git a/policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml b/policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml new file mode 100644 index 00000000000..a8954500eb6 --- /dev/null +++ b/policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml @@ -0,0 +1,13 @@ +description: States where full-year residents may choose a state itemized deduction only with federal itemization, with the ordinary separate state standard option subject to state rules. +metadata: + unit: list + label: State itemization requires federal itemization + reference: + - title: 2025 Maryland resident income tax instructions + href: https://www.marylandcomptroller.gov/content/dam/mdcomp/tax/instructions/2025/resident-booklet.pdf + - title: 2025 Maine Form 1040ME instructions + href: https://www.maine.gov/revenue/sites/maine.gov.revenue/files/inline-files/25_1040me_gen_instr_w_cover_pg.pdf + - title: 2025 Missouri Form MO-1040 instructions, Schedule MO-A + href: https://dor.mo.gov/forms/MO-1040%20Instructions_2025.pdf +values: + 2025-01-01: [MD, ME, MO] diff --git a/policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml new file mode 100644 index 00000000000..3577cee20fe --- /dev/null +++ b/policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml @@ -0,0 +1,17 @@ +description: Jurisdictions with a state deduction that follows the full-year resident's federal standard or itemized deduction method. +metadata: + unit: list + label: State deduction method follows the federal return + reference: + - title: District of Columbia Code section 47-1803.04 + href: https://code.dccouncil.gov/us/dc/council/code/sections/47-1803.04 + - title: 2025 Georgia IT-511 individual income tax booklet + href: https://dor.georgia.gov/document/document/2025-it-511-individual-income-tax-booklet/download + - title: 2025 Montana Form 2 instructions + href: https://revenue.mt.gov/files/forms/Montana-Individual-Income-Tax-Return-Form-2-Instructions/2025_Montana_Individual_Income_Tax_Return_Form_2_Instructions.pdf + - title: 2025 Oklahoma Form 511 instructions + href: https://oklahoma.gov/content/dam/ok/en/tax/documents/forms/individuals/current/511-Pkt.pdf + - title: 2025 Virginia Schedule A instructions + href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf +values: + 2025-01-01: [DC, GA, MT, OK, VA] diff --git a/policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml b/policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml new file mode 100644 index 00000000000..ab0954ba38d --- /dev/null +++ b/policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml @@ -0,0 +1,33 @@ +description: States where a full-year resident may take a different standard or itemized deduction method from the federal return. +metadata: + unit: list + label: Independent resident deduction methods + reference: + - title: 2025 Alabama Form 40 instructions + href: https://www.revenue.alabama.gov/wp-content/uploads/2026/01/25f40bk.pdf + - title: 2025 Arkansas Form AR1000F instructions + href: https://www.dfa.arkansas.gov/wp-content/uploads/2025_AR1000F_and_AR1000NR_Instructions.pdf + - title: 2025 Arizona Form 140 instructions + href: https://azdor.gov/sites/default/files/document/FORMS_INDIVIDUAL_2025_140Booklet.pdf + - title: 2025 California Form 540 instructions + href: https://www.ftb.ca.gov/forms/2025/2025-540-instructions.html + - title: 2025 Delaware income tax instructions + href: https://revenuefiles.delaware.gov/2025/PITForms_Instructions/Instructions/PIT-RES_Instructions_2025-01.pdf + - title: 2025 Hawaii Form N-11 instructions + href: https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=15 + - title: 2025 Idaho Form 40 instructions + href: https://tax.idaho.gov/wp-content/uploads/forms/EIN00046/EIN00046_03-02-2026.pdf + - title: 2025 Kansas income tax instructions + href: https://www.ksrevenue.gov/incomebook25.html + - title: 2025 Kentucky Schedule A instructions + href: https://revenue.ky.gov/Forms/740%20Schedule%20A%20%282025%29.pdf + - title: 2025 Minnesota Schedule M1SA + href: https://www.revenue.state.mn.us/sites/default/files/2025-12/m1sa-25_0.pdf + - title: 2025 Mississippi resident return instructions + href: https://www.dor.ms.gov/sites/default/files/tax-forms/individual/80108258%201.pdf + - title: 2025 North Carolina individual income tax instructions + href: https://www.ncdor.gov/taxes-forms/individual-income-tax/filing-topics/north-carolina-standard-deduction-or-north-carolina-itemized-deductions + - title: New York 2025 itemized deductions + href: https://www.tax.ny.gov/pit/file/itemized-deductions-2025.htm +values: + 2025-01-01: [AL, AR, AZ, CA, DE, HI, ID, KS, KY, MN, MS, NC, NY] diff --git a/policyengine_us/tests/core/test_joint_itemization_branches.py b/policyengine_us/tests/core/test_joint_itemization_branches.py new file mode 100644 index 00000000000..ffb703fba3d --- /dev/null +++ b/policyengine_us/tests/core/test_joint_itemization_branches.py @@ -0,0 +1,123 @@ +"""Joint itemization stays isolated by branch and tax year.""" + +from math import isclose, isfinite + +import numpy as np +import pytest +from hypothesis import assume, example, given, settings, strategies as st +from policyengine_core.periods import period + +from policyengine_us import Simulation +from policyengine_us.tools.state_itemization import choose_joint_itemization + + +@settings(max_examples=32) +@given( + offsets=st.lists( + st.lists( + st.sampled_from((None, 0, 0.004, 0.009, 0.01, 0.010001, 0.018, 1)), + min_size=4, + max_size=4, + ), + min_size=3, + max_size=3, + ), + preferences=st.tuples(st.booleans(), st.booleans(), st.booleans()), +) +@example( + offsets=[[0, None, 0.018, 0.009], [None, 0, 0.018, 0], [None, None, 0, 0]], + preferences=(True, False, True), +) +def test_joint_election_uses_the_global_absolute_tie_window(offsets, preferences): + assume(all(any(offset is not None for offset in row) for row in offsets)) + # Include refunds and a large liability, where a relative tolerance could + # incorrectly admit a candidate more than one cent above the global minimum. + costs = np.array( + [ + [np.inf if offset is None else base + offset for offset in row] + for base, row in zip((-250.0, 10_000_000.0, 900.0), offsets, strict=True) + ] + ) + federal_methods = (False, False, True, True) + expected = [] + for row, preferred in zip(costs, preferences, strict=True): + minimum = min(cost for cost in row if isfinite(cost)) + tied = [ + index + for index, cost in enumerate(row) + if isclose(cost, minimum, rel_tol=0.0, abs_tol=0.01) + ] + expected.append( + min(tied, key=lambda index: (federal_methods[index] != preferred, index)) + ) + np.testing.assert_array_equal( + choose_joint_itemization(costs.T, federal_methods, preferences), expected + ) + + +def test_joint_election_requires_a_finite_choice_for_every_unit(): + with pytest.raises(ValueError, match="legal finite deduction election"): + choose_joint_itemization( + np.array([[0.0, np.inf], [1.0, np.inf]]), (False, True), [False, True] + ) + + +def test_warm_joint_choice_is_recomputed_for_a_filed_election_in_a_branch(): + # The policy examples cover the tax arithmetic. This test exercises the + # ordinary runtime after two years of results have already been cached. + years = (2024, 2025) + simulation = Simulation( + situation={ + "people": { + "person1": { + "age": dict.fromkeys(years, 40), + "employment_income": dict.fromkeys(years, 150_000), + "deductible_mortgage_interest": dict.fromkeys(years, 13_500), + } + }, + "tax_units": { + "tax_unit": { + "members": ["person1"], + "state_and_local_sales_or_income_tax": dict.fromkeys(years, 2_500), + }, + }, + "households": { + "household": { + "members": ["person1"], + "state_code": dict.fromkeys(years, "DC"), + } + }, + } + ) + simulation.tax_benefit_system.parameters.gov.simulation.joint_federal_state_itemization.update( + period=period(2025), value=True + ) + baseline_2024 = simulation.calculate("federal_state_income_tax", 2024) + + # Query the state side first. The joint choice is for both taxes, so it + # must also be available when state liability triggers the calculation. + np.testing.assert_allclose(simulation.calculate("state_income_tax", 2025), [9_875]) + np.testing.assert_array_equal( + simulation.calculate("tax_unit_itemizes", 2025), [False] + ) + np.testing.assert_array_equal( + simulation.calculate("state_deduction_method", 2025).decode_to_str(), + ["STANDARD"], + ) + + alternate = simulation.get_branch("filed_federal_itemized_return") + alternate.set_input("tax_unit_itemizes", 2025, [True]) + np.testing.assert_allclose( + alternate.calculate("state_income_tax", 2025), [10_002.50] + ) + np.testing.assert_array_equal( + alternate.calculate("state_deduction_method", 2025).decode_to_str(), + ["ITEMIZED"], + ) + np.testing.assert_allclose(alternate.calculate("income_tax", 2025), [25_007]) + np.testing.assert_allclose( + simulation.calculate("federal_state_income_tax", 2025), [34_942] + ) + np.testing.assert_array_equal( + alternate.calculate("federal_state_income_tax", 2024), baseline_2024 + ) diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml new file mode 100644 index 00000000000..ede3e3cb91c --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml @@ -0,0 +1,99 @@ +- name: Case 1, legal joint deduction choices in a mixed resident population. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: [DC, GA, OR, GA] + age: [40, 40, 40, 40] + employment_income: [150_000, 145_000, 149_500, 150_000] + filing_status: [SINGLE, SINGLE, SINGLE, SEPARATE] + separate_filer_itemizes: [false, false, false, true] + deductible_mortgage_interest: [13_500, 15_000, 10_000, 0] + state_and_local_sales_or_income_tax: [2_500, 0, 0, 0] + or_tax_before_credits_in_prior_year: [0, 0, 0, 0] + output: + # DC Act 26-214 sets a $15,000 single standard deduction. D-40 requires + # the federal method and excludes the $2,500 income tax from Schedule I. + # Federal itemization saves $60 but costs $127.50 in the District. + # https://code.dccouncil.gov/us/dc/council/acts/26-214 + # https://otr.cfo.dc.gov/publication/2025-d-40-booklet + # GA 500 lines 11–12 and 19 require the federal method. Itemizing costs + # $180 federally and saves $155.70 plus the $300 GA itemizer credit. + # A separate filer with an itemizing spouse must itemize, even at zero. + # https://dor.georgia.gov/document/document/2025-it-511-individual-income-tax-booklet/download#page=18 + # ORS 316.695(1)(c)(A) requires the larger Oregon deduction, so Oregon + # itemizes $10,000 instead of $2,835 even when the federal method is standard. + # https://www.oregonlegislature.gov/bills_laws/ors/ors316.html + # https://www.oregon.gov/dor/forms/FormsPubs/form-or-40-inst_101-040-1_2025.pdf + # IRS Form 1040 tax computation uses $15,750 for the 2025 single standard + # deduction and a 24% marginal rate at each taxable income in this case. + # https://www.irs.gov/instructions/i1040gi + tax_unit_itemizes: [false, true, false, true] + state_deduction_method: [STANDARD, ITEMIZED, ITEMIZED, ITEMIZED] + dc_deduction_joint: [15_000, 0, 0, 0] + ga_deductions: [0, 15_000, 0, 0] + or_deductions: [0, 0, 10_000, 0] + income_tax: [25_067, 24_047, 24_947, 28_847] + state_income_tax: [9_875, 6_447, 12_063, 7_485] + federal_state_income_tax: [34_942, 30_494, 37_010, 36_332] + +- name: Case 2, the larger Oregon deduction is its standard deduction. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: OR + age: 40 + employment_income: 149_500 + deductible_mortgage_interest: 1_000 + state_and_local_sales_or_income_tax: 0 + or_tax_before_credits_in_prior_year: 0 + state_deduction_method: STANDARD + output: + tax_unit_itemizes: false + state_deduction_method: STANDARD + or_deductions: 2_835 + income_tax: 24_947 + +- name: Case 3, an explicitly filed federal itemized deduction limits the available pairs. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: OR + age: 40 + employment_income: 149_500 + deductible_mortgage_interest: 10_000 + state_and_local_sales_or_income_tax: 0 + or_tax_before_credits_in_prior_year: 0 + tax_unit_itemizes: true + output: + state_deduction_method: ITEMIZED + or_deductions: 10_000 + income_tax: 26_327 + state_income_tax: 12_063 + +- name: Case 4, California residents can use each of the four federal and state deduction pairs. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: [CA, CA, CA, CA] + age: [40, 40, 40, 40] + employment_income: [150_000, 150_000, 150_000, 150_000] + deductible_mortgage_interest: [1_000, 9_750, 4_000, 19_500] + real_estate_taxes: [0, 250, 0, 500] + state_and_local_sales_or_income_tax: [0, 0, 12_000, 12_000] + output: + # Federal Schedule A amounts are $1,000, $10,000, $16,000, and + # $32,000. California excludes the state and local income tax on + # Schedule CA (540), Part II, line 5a. Its single standard is $5,706. + # https://www.ftb.ca.gov/forms/2025/2025-540-instructions.html + # https://www.ftb.ca.gov/forms/2025/2025-540-ca-instructions.html + tax_unit_itemizes: [false, false, true, true] + state_deduction_method: [STANDARD, ITEMIZED, STANDARD, ITEMIZED] + ca_itemizes: [false, true, false, true] + ca_deductions: [5_706, 10_000, 5_706, 20_000] + ca_taxable_income: [144_294, 140_000, 144_294, 130_000] + # Schedule P Part I lines 2–5 add back the property tax for these + # state itemizers. Line 6 adds back the standard for California standard + # filers. Acquisition mortgage interest needs no AMT add-back here. + # https://www.ftb.ca.gov/forms/2025/2025-540-p.pdf#page=1 + ca_amti_adjustments: [5_706, 250, 5_706, 500] + income_tax: [25_067, 25_067, 25_007, 21_167] diff --git a/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_deductions.yaml new file mode 100644 index 00000000000..a8e93d10c64 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_deductions.yaml @@ -0,0 +1,29 @@ +- name: A federal itemizer can elect the smaller Maryland standard deduction + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: MD + county_str: ALLEGANY_COUNTY_MD + tax_unit_itemizes: true + state_deduction_method: STANDARD + md_standard_deduction: 2_000 + md_itemized_deductions: 5_000 + md_agi: 10_000 + md_exemptions: 0 + output: + md_deductions: 2_000 + md_taxable_income: 8_000 + # 20 + 30 + 40 + 4.75% of 5,000; county tax is 3.03% of 8,000. + md_income_tax_before_credits: 327.5 + md_local_income_tax_before_credits: 242.4 + +- name: Federal standard bars Maryland itemization + period: 2025 + input: + state_code: MD + tax_unit_itemizes: false + state_deduction_method: ITEMIZED + md_standard_deduction: 2_000 + md_itemized_deductions: 5_000 + output: + md_deductions: 2_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_deductions.yaml index 4e903bd9abd..35c5bc830f7 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_deductions.yaml @@ -66,3 +66,21 @@ me_deductions: 15_000 me_taxable_income: 72_785 me_income_tax: 4_695 + +- name: A federal itemizer can elect Maine itemized expenses below the state standard + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: ME + tax_unit_itemizes: true + state_deduction_method: ITEMIZED + me_standard_deduction: 15_000 + me_itemized_deductions_pre_phaseout: 10_000 + me_deduction_phaseout_percentage: 0.25 + me_agi: 17_500 + me_exemptions: 0 + output: + # Deduct 75% of the selected 10,000. Maine's first rate is 5.8%. + me_deductions: 7_500 + me_taxable_income: 10_000 + me_income_tax_before_credits: 580 diff --git a/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_taxable_income.yaml b/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_taxable_income.yaml index c62421bf7f6..fdfeefb579c 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_taxable_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_taxable_income.yaml @@ -89,3 +89,35 @@ # They add their columns on Line 6 to get 15,000. Without deductions, # spouse 2 reports all 15,000 as taxable income on Line 26. mo_taxable_income: [0, 15_000] + +- name: A voluntary federal itemizer can take the smaller Missouri standard deduction + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: MO + tax_unit_itemizes: true + state_deduction_method: STANDARD + standard_deduction: 15_750 + mo_itemized_deductions: 18_000 + mo_adjusted_gross_income: 18_950 + mo_federal_income_tax_deduction: 1_000 + output: + mo_taxable_income: 2_200 + # Only 2,200 less the 1,313 zero bracket is taxed, at 2%. + mo_income_tax_before_credits: 17.74 + +- name: Missouri requires state itemization for a separate filer whose spouse itemizes + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: MO + filing_status: SEPARATE + separate_filer_itemizes: true + output: + # With no expenses or tax the two state amounts tie at zero. MO-A Part 2 + # requires Missouri itemization when the federal return must itemize. + # https://dor.mo.gov/forms/MO-1040%20Instructions_2025.pdf#page=16 + standard_deduction: 0 + tax_unit_itemizes: true + state_deduction_method: ITEMIZED + mo_taxable_income: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml new file mode 100644 index 00000000000..9dbafce28f4 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml @@ -0,0 +1,170 @@ +# Form IT-272: an itemizer may choose either tuition benefit but cannot take both. +- name: Federal standard and New York itemized with the tuition credit + period: 2025 + input: + state_code: NY + tax_unit_itemizes: false + ny_itemizes: true + ny_elects_tuition_credit_when_itemizing: true + qualified_tuition_expenses: 6_000 + output: + ny_college_tuition_credit: 240 + ny_college_tuition_deduction: 0 + +- name: Federal itemized and New York itemized with the tuition deduction + period: 2025 + input: + state_code: NY + tax_unit_itemizes: true + ny_itemizes: true + ny_elects_tuition_credit_when_itemizing: false + qualified_tuition_expenses: 6_000 + output: + ny_college_tuition_credit: 0 + ny_college_tuition_deduction: 6_000 + +- name: A state standard filer can take the credit without an itemizer election + period: 2025 + input: + state_code: NY + ny_itemizes: false + ny_elects_tuition_credit_when_itemizing: false + qualified_tuition_expenses: 6_000 + output: + ny_college_tuition_credit: 240 + ny_deductions: 8_000 + +- name: New York itemized filing can preserve other deductions and claim the tuition credit + period: 2025 + input: + state_code: NY + ny_itemizes: true + ny_elects_tuition_credit_when_itemizing: true + ny_agi: 18_000 + ny_exemptions: 1_000 + deductible_mortgage_interest: 16_000 + qualified_tuition_expenses: 2_000 + state_sales_tax: 0 + local_sales_tax: 0 + output: + ny_deductions: 16_000 + ny_taxable_income: 1_000 + ny_college_tuition_deduction: 0 + ny_college_tuition_credit: 200 + +- name: A New York filer claimed elsewhere cannot take the tuition credit + period: 2025 + input: + state_code: NY + claimed_as_dependent_on_another_return: true + qualified_tuition_expenses: 6_000 + ny_itemizes: true + ny_elects_tuition_credit_when_itemizing: true + output: + ny_college_tuition_credit: 0 + ny_college_tuition_deduction: 0 + +- name: The tuition deduction is unavailable above one million of New York AGI + period: 2025 + input: + state_code: NY + ny_agi: 1_000_001 + ny_itemizes: true + ny_elects_tuition_credit_when_itemizing: false + qualified_tuition_expenses: 6_000 + output: + ny_college_tuition_deduction: 0 + +- name: New York permits itemizing after a federal standard election in 2025. + period: 2025 + input: + state_code: NY + tax_unit_itemizes: false + state_deduction_method: ITEMIZED + ny_standard_deduction: 8_000 + deductible_mortgage_interest: 12_000 + qualified_tuition_expenses: 2_000 + ny_elects_tuition_credit_when_itemizing: true + output: + ny_itemizes: true + ny_deductions: 12_000 + ny_college_tuition_credit: 200 + ny_college_tuition_deduction: 0 + +- name: New York permits claiming standard even when the itemized amount is larger. + period: 2025 + input: + state_code: NY + tax_unit_itemizes: true + state_deduction_method: STANDARD + ny_standard_deduction: 8_000 + deductible_mortgage_interest: 14_000 + qualified_tuition_expenses: 2_000 + output: + ny_itemizes: false + ny_deductions: 8_000 + ny_college_tuition_credit: 200 + +- name: Under section 613 a smaller New York itemized election is recomputed with the standard. + period: 2025 + input: + state_code: NY + tax_unit_itemizes: true + state_deduction_method: ITEMIZED + ny_standard_deduction: 8_000 + ny_itemized_deductions: 7_999 + qualified_tuition_expenses: 2_000 + output: + ny_itemizes: false + ny_deductions: 8_000 + ny_college_tuition_credit: 200 + +- name: Choosing automatic with the optimizer off preserves New York's historic larger deduction. + period: 2025 + input: + state_code: NY + tax_unit_itemizes: false + state_deduction_method: AUTOMATIC + ny_standard_deduction: 8_000 + ny_itemized_deductions: 12_000 + output: + ny_deductions: 12_000 + +- name: Joint New York election compares the tuition credit with a deduction at different marginal rates. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: [NY, NY] + tax_unit_itemizes: [false, false] + ny_agi: [18_000, 90_000] + ny_exemptions: [1_000, 0] + deductible_mortgage_interest: [16_000, 16_000] + qualified_tuition_expenses: [2_000, 6_000] + state_sales_tax: [0, 0] + local_sales_tax: [0, 0] + output: + # At $18,000 of AGI the credit pays $200 and the tuition deduction + # eliminates only $40 of state tax. At $90,000 the $6,000 deduction + # saves more state income tax than a $240 credit. + state_deduction_method: [ITEMIZED, ITEMIZED] + ny_itemizes: [true, true] + ny_elects_tuition_credit_when_itemizing: [true, false] + ny_college_tuition_credit: [200, 0] + ny_college_tuition_deduction: [0, 6_000] + ny_deductions: [16_000, 22_000] + +- name: A filed New York standard election stays binding in the joint calculation. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: NY + tax_unit_itemizes: false + ny_itemizes: false + ny_agi: 90_000 + deductible_mortgage_interest: 16_000 + qualified_tuition_expenses: 6_000 + output: + state_deduction_method: STANDARD + ny_itemizes: false + ny_deductions: 8_000 + ny_college_tuition_credit: 240 diff --git a/policyengine_us/tests/policy/baseline/gov/states/tax/income/independent_state_deduction_methods.yaml b/policyengine_us/tests/policy/baseline/gov/states/tax/income/independent_state_deduction_methods.yaml new file mode 100644 index 00000000000..57bacf4416b --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/tax/income/independent_state_deduction_methods.yaml @@ -0,0 +1,192 @@ +- name: Alabama's standard election keeps the federal tax deduction and exemptions. + period: 2025 + input: + state_code: AL + state_deduction_method: STANDARD + al_standard_deduction: 3_000 + al_itemized_deductions: 7_000 + al_federal_income_tax_deduction: 1_000 + al_personal_exemption: 1_500 + al_dependent_exemption: 0 + al_529_plan_deduction: 500 + output: + al_deductions: 6_000 + +- name: Arizona uses the filed state itemized amount after a federal standard election. + period: 2025 + input: + state_code: AZ + tax_unit_itemizes: false + state_deduction_method: ITEMIZED + az_standard_deduction: 15_000 + az_itemized_deductions: 11_000 + output: + az_deductions: 11_000 + +- name: Arkansas itemization reaches both columns and excludes the low-income schedule. + period: 2025 + input: + state_code: AR + filing_status: SINGLE + state_deduction_method: ITEMIZED + ar_standard_deduction_joint: 2_470 + ar_itemized_deductions_joint: 1_000 + ar_standard_deduction_indiv: 2_470 + ar_itemized_deductions_indiv: 1_000 + ar_agi_joint: 14_000 + output: + ar_deduction_joint: 1_000 + ar_deduction_indiv: 1_000 + ar_uses_low_income_tax_tables: false + +- name: A standard-filing Arkansas resident can still receive the embedded low-income standard. + period: 2025 + input: + state_code: AR + filing_status: SINGLE + state_deduction_method: STANDARD + ar_standard_deduction_joint: 2_470 + ar_itemized_deductions_joint: 3_000 + ar_agi_joint: 14_000 + output: + ar_deduction_joint: 2_470 + ar_uses_low_income_tax_tables: true + +- name: Delaware uses one filed method in both separate and joint calculations. + period: 2025 + input: + state_code: DE + state_deduction_method: STANDARD + de_itemized_deductions_unit: 10_000 + de_itemized_deductions_joint: 10_000 + de_itemized_deductions_indv: 10_000 + de_standard_deduction_joint: 3_250 + de_standard_deduction_indv: 3_250 + output: + de_tax_unit_itemizes: false + de_deduction_indv: 3_250 + de_deduction_joint: 3_250 + +- name: An Idaho itemizer removes the medical premium overlap on Form 39R. + period: 2025 + input: + state_code: ID + state_deduction_method: ITEMIZED + standard_deduction: 16_100 + id_itemized_deductions: 17_000 + id_qualified_health_insurance_premiums: 6_000 + id_health_insurance_premiums_medical_deduction: 2_000 + output: + id_itemizes: true + id_deductions: 17_000 + id_health_insurance_premiums_subtraction: 4_000 + +- name: Idaho's obligatory spouse rule overrides an unavailable standard deduction. + period: 2025 + input: + state_code: ID + state_deduction_method: STANDARD + separate_filer_itemizes: true + id_itemized_deductions: 3_000 + standard_deduction: 5_000 + output: + id_itemizes: true + id_deductions: 3_000 + +- name: Kansas permits a state itemized election on a 2025 federal-standard return. + period: 2025 + input: + state_code: KS + state_deduction_method: ITEMIZED + tax_unit_itemizes: false + ks_agi: 40_000 + ks_exemptions: 0 + ks_standard_deduction: 5_000 + ks_itemized_deductions: 3_000 + output: + ks_taxable_income: 37_000 + +- name: Kansas keeps the 2020 federal itemization requirement. + period: 2020 + input: + state_code: KS + state_deduction_method: ITEMIZED + tax_unit_itemizes: false + ks_agi: 40_000 + ks_exemptions: 0 + ks_standard_deduction: 5_000 + ks_itemized_deductions: 8_000 + output: + ks_taxable_income: 35_000 + +- name: Kentucky's standard election reaches the joint and separate-column deductions. + period: 2025 + input: + state_code: KY + state_deduction_method: STANDARD + ky_standard_deduction_joint: 3_000 + ky_itemized_deductions_joint: 4_000 + ky_standard_deduction_indiv: 3_000 + ky_itemized_deductions_indiv: 4_500 + output: + ky_deductions_joint: 3_000 + ky_deductions_indiv: 3_000 + +- name: Minnesota's standard election also activates its nonitemizer charitable subtraction. + period: 2025 + input: + state_code: MN + state_deduction_method: STANDARD + mn_standard_deduction: 15_000 + mn_itemized_deductions: 16_000 + mn_charitable_deduction: 1_500 + output: + mn_itemizing: false + mn_deductions: 15_000 + mn_charity_subtraction: 500 + +- name: Mississippi applies the state itemized election on either filing arrangement. + period: 2025 + input: + state_code: MS + state_deduction_method: ITEMIZED + ms_standard_deduction_joint: 3_000 + ms_itemized_deductions_joint: 2_000 + ms_standard_deduction_indiv: 3_000 + ms_itemized_deductions_indiv: 2_500 + output: + ms_deductions_joint: 2_000 + ms_deductions_indiv: 2_500 + +- name: A North Carolina standard filer preserves the separate child deduction. + period: 2025 + input: + state_code: NC + state_deduction_method: STANDARD + nc_standard_deduction: 12_750 + nc_itemized_deductions: 15_000 + nc_child_deduction: 2_000 + output: + nc_standard_or_itemized_deductions: 12_750 + nc_deductions: 14_750 + +- name: Oregon always grants the greater state deduction under ORS 316.695. + period: 2025 + input: + state_code: OR + tax_unit_itemizes: false + or_standard_deduction: 2_800 + or_itemized_deductions: 4_000 + output: + or_deductions: 4_000 + +- name: North Carolina imports the federal spouse-itemization exclusion for separate filers. + period: 2025 + input: + state_code: [NC, NC, NC] + filing_status: [SEPARATE, SEPARATE, SINGLE] + separate_filer_itemizes: [true, false, false] + nc_itemized_deductions: [1_500, 1_500, 1_500] + output: + nc_standard_deduction: [0, 12_750, 12_750] + nc_standard_or_itemized_deductions: [1_500, 12_750, 12_750] diff --git a/policyengine_us/tools/state_itemization.py b/policyengine_us/tools/state_itemization.py new file mode 100644 index 00000000000..9d2b461823f --- /dev/null +++ b/policyengine_us/tools/state_itemization.py @@ -0,0 +1,221 @@ +from itertools import product + +import numpy as np + +from policyengine_us.tools.period_branch import get_override_branch, has_input +from policyengine_us.variables.gov.states.tax.income.state_deduction_method import ( + StateDeductionMethod, +) + +STANDARD = StateDeductionMethod.STANDARD.index +ITEMIZED = StateDeductionMethod.ITEMIZED.index +AUTOMATIC = StateDeductionMethod.AUTOMATIC.index +STATE_METHOD_COUNT = len(StateDeductionMethod) +JOINT_METHOD_COUNT = 2 * STATE_METHOD_COUNT +CENT = 0.01 +NATIVE_STATE_ELECTION_INPUTS = { + "AR": "ar_tax_unit_itemizes", + "CA": "ca_itemizes", + "DE": "de_tax_unit_itemizes", + "HI": "hi_itemizes", + "ID": "id_itemizes", + "KY": "ky_tax_unit_itemizes", + "MN": "mn_itemizing", + "MS": "ms_tax_unit_itemizes", + "NY": "ny_itemizes", +} + + +def joint_itemization_is_enabled(period, parameters): + """The resident election rules have been verified for tax year 2025.""" + return ( + period.start.year == 2025 + and parameters(period).gov.simulation.joint_federal_state_itemization + ) + + +def joint_federal_itemizes(choices): + return choices % JOINT_METHOD_COUNT >= STATE_METHOD_COUNT + + +def state_itemization_uses_itemized(method, automatic): + """Resolve a state method with the jurisdiction's usual calculation.""" + return np.where( + method == StateDeductionMethod.AUTOMATIC, + automatic, + method == StateDeductionMethod.ITEMIZED, + ) + + +def choose_joint_itemization(costs, federal_methods, prefer_federal_itemized): + """Choose within a cent of the global minimum, then prefer the federal tie rule.""" + minimum = np.min(costs, axis=0) + if not np.isfinite(minimum).all(): + raise ValueError("Every tax unit needs a legal finite deduction election.") + within_cent = costs - minimum <= CENT + same_as_preferred = np.asarray(federal_methods)[:, None] == prefer_federal_itemized + preferred = within_cent & same_as_preferred + return np.where(preferred.any(axis=0), preferred, within_cent).argmax(axis=0) + + +def joint_itemization(tax_unit, period, parameters): + """Evaluate 2025 full-year resident deduction elections on isolated branches.""" + if not tax_unit.count: + return np.empty(0, dtype=np.int32) + sim = tax_unit.simulation + state = tax_unit.household("state_code_str", period) + p = parameters(period).gov.simulation.resident_itemization + independent = np.isin(state, p.independent_states) + federal_itemizers_only = np.isin(state, p.federal_itemizers_only) + follows_federal = np.isin(state, p.follows_federal) + elected_state = independent | federal_itemizers_only + status = tax_unit("filing_status", period) + requires_federal_itemizing = (status == status.possible_values.SEPARATE) & tax_unit( + "separate_filer_itemizes", period + ) + forced_federal = ( + tax_unit("tax_unit_itemizes", period) + if has_input(sim, "tax_unit_itemizes", period) + else None + ) + state_supplied = has_input(sim, "state_deduction_method", period) + forced_state = ( + np.asarray(tax_unit("state_deduction_method", period)) + if state_supplied + else np.full(tax_unit.count, AUTOMATIC) + ) + keep_automatic = state_supplied & (forced_state == AUTOMATIC) + native_supplied = np.full(tax_unit.count, AUTOMATIC) + for jurisdiction, variable in NATIVE_STATE_ELECTION_INPUTS.items(): + residents = state == jurisdiction + if residents.any() and has_input(sim, variable, period): + declared = np.where(tax_unit(variable, period), ITEMIZED, STANDARD) + native_supplied = np.where(residents, declared, native_supplied) + fixed_tuition = has_input(sim, "ny_elects_tuition_credit_when_itemizing", period) + fixed_salt = has_input(sim, "state_and_local_sales_tax_elected", period) + known_salt_components = not has_input( + sim, "state_and_local_sales_or_income_tax", period + ) + choices = [] + federal_methods = [] + costs = [] + prefer_federal_itemized = None + for federal_itemizes, state_method, alternative in product( + (False, True), (STANDARD, ITEMIZED), (False, True) + ): + allowable = federal_itemizes | ~requires_federal_itemizing + if forced_federal is not None: + allowable &= forced_federal == federal_itemizes + methods = np.where(elected_state, state_method, AUTOMATIC) + if state_method == STANDARD: + linked_method = ITEMIZED if federal_itemizes else STANDARD + methods = np.where(follows_federal, linked_method, methods) + allowable &= ~( + np.isin(state, ("ID", "MO", "NC")) + & requires_federal_itemizing + & ~keep_automatic + ) + else: + allowable &= independent | (federal_itemizes & federal_itemizers_only) + allowable &= ~keep_automatic + methods = np.where(keep_automatic, AUTOMATIC, methods) + + if alternative: + # NY can take an education credit on an itemized return. VA + # Schedule A responds to the federal choice of income or sales tax. + allowable &= ( + (state == "NY") & (state_method == ITEMIZED) & (not fixed_tuition) + ) | ( + (state == "VA") + & federal_itemizes + & (state_method == STANDARD) + & (not fixed_salt) + & known_salt_components + ) + if not allowable.any(): + continue + + method_code = STATE_METHOD_COUNT * federal_itemizes + if alternative: + method_code += JOINT_METHOD_COUNT + branch_name = ( + f"resident_itemization_{period.start.year}_{method_code}_{state_method}" + ) + branch = get_override_branch( + sim, + branch_name, + period, + { + "tax_unit_itemizes": np.full(tax_unit.count, federal_itemizes), + "state_deduction_method": methods, + "tax_unit_joint_itemization": method_code + methods, + }, + inherit_calculated=False, + ) + try: + if (state == "HI").any(): + eligibility = branch.calculate( + "hi_itemized_deductions_eligible" + if state_method == ITEMIZED + else "hi_required_to_itemize", + period, + ) + allowable &= (state != "HI") | ( + eligibility + if state_method == ITEMIZED + else (keep_automatic | ~eligibility) + ) + if state_method == ITEMIZED and (state == "NY").any(): + # N.Y. Tax Law §613 requires the standard deduction when the + # elected itemized amount is smaller, including the tuition option. + allowable &= (state != "NY") | ( + branch.calculate("ny_itemized_deductions", period) + >= branch.calculate("ny_standard_deduction", period) + ) + # Local liability differs from the Schedule A measure of taxes paid. + total = np.asarray(branch.calculate("income_tax", period), dtype=float) + total = total + branch.calculate("state_income_tax", period) + total += branch.calculate("local_tax", period) + if prefer_federal_itemized is None: + prefer_federal_itemized = branch.calculate( + "itemized_taxable_income_deductions", period + ) > branch.calculate("standard_deduction", period) + methods = resolved_state_methods( + branch, period, state, methods, federal_itemizes + ) + finally: + sim.branches.pop(branch_name) + del branch + methods = np.where(keep_automatic, AUTOMATIC, methods) + allowable &= (forced_state == AUTOMATIC) | (forced_state == methods) + allowable &= ( + keep_automatic + | (native_supplied == AUTOMATIC) + | (native_supplied == methods) + ) + choices.append(method_code + methods) + federal_methods.append(federal_itemizes) + costs.append(np.where(allowable, total, np.inf)) + + if not choices: + raise ValueError("Every tax unit needs a legal deduction election.") + selected = choose_joint_itemization( + np.stack(costs), federal_methods, prefer_federal_itemized + ) + return np.stack(choices)[selected, np.arange(tax_unit.count)] + + +def resolved_state_methods(branch, period, state, methods, federal_itemizes): + """Report the actual method where a jurisdiction requires the larger amount.""" + for name in ("OR", "NE"): + residents = state == name + if residents.any(): + prefix = name.lower() + if name == "NE" and not federal_itemizes: + resolved = STANDARD + else: + itemized = branch.calculate(f"{prefix}_itemized_deductions", period) + standard = branch.calculate(f"{prefix}_standard_deduction", period) + resolved = np.where(itemized > standard, ITEMIZED, STANDARD) + methods = np.where(residents, resolved, methods) + return methods diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py index 7a6abdb18c9..b99dbbdc8e9 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py @@ -1,4 +1,9 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import ( + JOINT_METHOD_COUNT, + joint_federal_itemizes, + joint_itemization_is_enabled, +) class state_and_local_sales_tax_elected(Variable): @@ -22,4 +27,14 @@ def formula(tax_unit, period, parameters): tax_unit, period, ["state_withheld_income_tax", "local_income_tax"] ) sales_tax = add(tax_unit, period, ["state_sales_tax", "local_sales_tax"]) - return sales_tax > income_tax + default = sales_tax > income_tax + if joint_itemization_is_enabled(period, parameters): + virginia = tax_unit.household("state_code", period) == StateCode.VA + if virginia.any(): + choices = tax_unit("tax_unit_joint_itemization", period) + return where( + virginia & joint_federal_itemizes(choices), + choices >= JOINT_METHOD_COUNT, + default, + ) + return default diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.py index ad55ecc92d7..47c17577b9c 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.py @@ -1,4 +1,8 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import ( + joint_federal_itemizes, + joint_itemization_is_enabled, +) class tax_unit_itemizes(Variable): @@ -10,6 +14,10 @@ class tax_unit_itemizes(Variable): definition_period = YEAR def formula(tax_unit, period, parameters): + if joint_itemization_is_enabled(period, parameters): + return joint_federal_itemizes( + tax_unit("tax_unit_joint_itemization", period) + ) p = parameters(period).gov.irs limitation = p.deductions.itemized.limitation if "charitable_contributions_ald" in p.ald.deductions: diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.py new file mode 100644 index 00000000000..9eadb0f6451 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.py @@ -0,0 +1,20 @@ +from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import ( + STATE_METHOD_COUNT, + joint_itemization, + joint_itemization_is_enabled, +) + + +class tax_unit_joint_itemization(Variable): + value_type = int + entity = TaxUnit + label = "Joint federal and state deduction election" + definition_period = YEAR + + def formula(tax_unit, period, parameters): + if joint_itemization_is_enabled(period, parameters): + return joint_itemization(tax_unit, period, parameters) + return STATE_METHOD_COUNT * tax_unit("tax_unit_itemizes", period) + np.asarray( + tax_unit("state_deduction_method", period) + ) diff --git a/policyengine_us/variables/gov/states/al/tax/income/deductions/al_deductions.py b/policyengine_us/variables/gov/states/al/tax/income/deductions/al_deductions.py index f3aadba75ae..9995be90cf4 100644 --- a/policyengine_us/variables/gov/states/al/tax/income/deductions/al_deductions.py +++ b/policyengine_us/variables/gov/states/al/tax/income/deductions/al_deductions.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class al_deductions(Variable): @@ -13,7 +14,9 @@ class al_deductions(Variable): def formula(tax_unit, period, parameters): itm_ded = tax_unit("al_itemized_deductions", period) std_ded = tax_unit("al_standard_deduction", period) - al_ded = max_(itm_ded, std_ded) + method = tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itm_ded > std_ded) + al_ded = where(itemizes, itm_ded, std_ded) federal_ded = tax_unit("al_federal_income_tax_deduction", period) exemptions = add( tax_unit, diff --git a/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_deduction_joint.py b/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_deduction_joint.py index f24a8a232c9..b6f936dfdfb 100644 --- a/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_deduction_joint.py +++ b/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_deduction_joint.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ar_deduction_joint(Variable): @@ -13,4 +14,6 @@ class ar_deduction_joint(Variable): def formula(person, period, parameters): itemized = person("ar_itemized_deductions_joint", period) standard = person("ar_standard_deduction_joint", period) - return max_(itemized, standard) + method = person.tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itemized > standard) + return where(itemizes, itemized, standard) diff --git a/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_tax_unit_itemizes.py b/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_tax_unit_itemizes.py index 86eca60a3e7..05be663fa11 100644 --- a/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_tax_unit_itemizes.py +++ b/policyengine_us/variables/gov/states/ar/tax/income/deductions/ar_tax_unit_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ar_tax_unit_itemizes(Variable): @@ -11,4 +12,5 @@ class ar_tax_unit_itemizes(Variable): def formula(tax_unit, period, parameters): itemized_ded = add(tax_unit, period, ["ar_itemized_deductions_indiv"]) standard_ded = add(tax_unit, period, ["ar_standard_deduction_indiv"]) - return itemized_ded > standard_ded + method = tax_unit("state_deduction_method", period) + return state_itemization_uses_itemized(method, itemized_ded > standard_ded) diff --git a/policyengine_us/variables/gov/states/ar/tax/income/low_income/ar_low_income_tax_joint.py b/policyengine_us/variables/gov/states/ar/tax/income/low_income/ar_low_income_tax_joint.py index aa09e2934a9..69eb687f7dd 100644 --- a/policyengine_us/variables/gov/states/ar/tax/income/low_income/ar_low_income_tax_joint.py +++ b/policyengine_us/variables/gov/states/ar/tax/income/low_income/ar_low_income_tax_joint.py @@ -1,4 +1,7 @@ from policyengine_us.model_api import * +from policyengine_us.variables.gov.states.tax.income.state_deduction_method import ( + StateDeductionMethod, +) class ar_low_income_tax_joint(Variable): @@ -36,8 +39,11 @@ def formula(person, period, parameters): dependents = where( filer_is_dependent, 0, person.tax_unit("tax_unit_dependents", period) ) + method = person.tax_unit("state_deduction_method", period) return select( [ + # The low-income table already includes the standard deduction. + method == StateDeductionMethod.ITEMIZED, filing_status_separate == status.SINGLE, (filing_status_separate == status.HEAD_OF_HOUSEHOLD) & (dependents <= 1), @@ -49,6 +55,7 @@ def formula(person, period, parameters): (filing_status_separate == status.JOINT) & (dependents > 1), ], [ + np.inf, p.single.calc(agi_attributed_to_head, right=True), p.head_of_household.no_or_one_dependent.calc( agi_attributed_to_head, right=True diff --git a/policyengine_us/variables/gov/states/az/tax/income/deductions/az_deductions.py b/policyengine_us/variables/gov/states/az/tax/income/deductions/az_deductions.py index 79e802eb547..d60d63ac39a 100644 --- a/policyengine_us/variables/gov/states/az/tax/income/deductions/az_deductions.py +++ b/policyengine_us/variables/gov/states/az/tax/income/deductions/az_deductions.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class az_deductions(Variable): @@ -13,4 +14,6 @@ class az_deductions(Variable): def formula(tax_unit, period, parameters): itemized_ded = tax_unit("az_itemized_deductions", period) standard_ded = tax_unit("az_standard_deduction", period) - return max_(itemized_ded, standard_ded) + method = tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itemized_ded > standard_ded) + return where(itemizes, itemized_ded, standard_ded) diff --git a/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py b/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py index a97797fcc31..8a2b7ce2617 100644 --- a/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py +++ b/policyengine_us/variables/gov/states/ca/tax/income/deductions/ca_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ca_itemizes(Variable): @@ -12,4 +13,6 @@ class ca_itemizes(Variable): def formula(tax_unit, period, parameters): itemized = tax_unit("ca_itemized_deductions", period) standard = tax_unit("ca_standard_deduction", period) - return itemized > standard + return state_itemization_uses_itemized( + tax_unit("state_deduction_method", period), itemized > standard + ) diff --git a/policyengine_us/variables/gov/states/de/tax/income/deductions/de_tax_unit_itemizes.py b/policyengine_us/variables/gov/states/de/tax/income/deductions/de_tax_unit_itemizes.py index 4bb075d89db..59d47128f24 100644 --- a/policyengine_us/variables/gov/states/de/tax/income/deductions/de_tax_unit_itemizes.py +++ b/policyengine_us/variables/gov/states/de/tax/income/deductions/de_tax_unit_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class de_tax_unit_itemizes(Variable): @@ -11,4 +12,5 @@ class de_tax_unit_itemizes(Variable): def formula(tax_unit, period, parameters): itemized_ded = tax_unit("de_itemized_deductions_unit", period) standard_ded = add(tax_unit, period, ["de_standard_deduction_indv"]) - return itemized_ded > standard_ded + method = tax_unit("state_deduction_method", period) + return state_itemization_uses_itemized(method, itemized_ded > standard_ded) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py index 7514a98c0bb..a36c3b716a1 100644 --- a/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py +++ b/policyengine_us/variables/gov/states/hi/tax/income/deductions/hi_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class hi_itemizes(Variable): @@ -18,4 +19,8 @@ def formula(tax_unit, period, parameters): itemized = tax_unit("hi_itemized_deductions", period) standard = tax_unit("hi_standard_deduction", period) nonitemizer_charity = tax_unit("charitable_deduction_for_non_itemizers", period) - return required | (eligible & (itemized > standard + nonitemizer_charity)) + itemizes = state_itemization_uses_itemized( + tax_unit("state_deduction_method", period), + itemized > standard + nonitemizer_charity, + ) + return required | (eligible & itemizes) diff --git a/policyengine_us/variables/gov/states/id/tax/income/deductions/id_itemizes.py b/policyengine_us/variables/gov/states/id/tax/income/deductions/id_itemizes.py index 0b719d1bf76..4b2a81ae5cc 100644 --- a/policyengine_us/variables/gov/states/id/tax/income/deductions/id_itemizes.py +++ b/policyengine_us/variables/gov/states/id/tax/income/deductions/id_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class id_itemizes(Variable): @@ -28,4 +29,7 @@ def formula(tax_unit, period, parameters): itemized = tax_unit("id_itemized_deductions", period) standard = tax_unit("standard_deduction", period) mandatory = tax_unit("separate_filer_itemizes", period) - return mandatory | (itemized > standard + overlap) + method = tax_unit("state_deduction_method", period) + return mandatory | state_itemization_uses_itemized( + method, itemized > standard + overlap + ) diff --git a/policyengine_us/variables/gov/states/ks/tax/income/ks_taxable_income.py b/policyengine_us/variables/gov/states/ks/tax/income/ks_taxable_income.py index f690bf4a6c3..c69b0db0792 100644 --- a/policyengine_us/variables/gov/states/ks/tax/income/ks_taxable_income.py +++ b/policyengine_us/variables/gov/states/ks/tax/income/ks_taxable_income.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ks_taxable_income(Variable): @@ -23,6 +24,8 @@ def formula(tax_unit, period, parameters): may_itemize = True if p.federal_itemization_required: may_itemize = tax_unit("tax_unit_itemizes", period) - deductions = where(may_itemize & (itm_ded > std_ded), itm_ded, std_ded) + method = tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itm_ded > std_ded) + deductions = where(may_itemize & itemizes, itm_ded, std_ded) exemptions = tax_unit("ks_exemptions", period) return max_(0, tax_unit("ks_agi", period) - deductions - exemptions) diff --git a/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_deductions_joint.py b/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_deductions_joint.py index 0db4f151e0b..27d9471d7ab 100644 --- a/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_deductions_joint.py +++ b/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_deductions_joint.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ky_deductions_joint(Variable): @@ -11,7 +12,8 @@ class ky_deductions_joint(Variable): defined_for = StateCode.KY def formula(person, period, parameters): - return max_( - person("ky_itemized_deductions_joint", period), - person("ky_standard_deduction_joint", period), - ) + itemized = person("ky_itemized_deductions_joint", period) + standard = person("ky_standard_deduction_joint", period) + method = person.tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itemized > standard) + return where(itemizes, itemized, standard) diff --git a/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_tax_unit_itemizes.py b/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_tax_unit_itemizes.py index e1b6fc1d50c..1a09aae1b7d 100644 --- a/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_tax_unit_itemizes.py +++ b/policyengine_us/variables/gov/states/ky/tax/income/deductions/ky_tax_unit_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ky_tax_unit_itemizes(Variable): @@ -11,4 +12,5 @@ class ky_tax_unit_itemizes(Variable): def formula(tax_unit, period, parameters): itemized_ded = add(tax_unit, period, ["ky_itemized_deductions_indiv"]) standard_ded = add(tax_unit, period, ["ky_standard_deduction_indiv"]) - return itemized_ded > standard_ded + method = tax_unit("state_deduction_method", period) + return state_itemization_uses_itemized(method, itemized_ded > standard_ded) diff --git a/policyengine_us/variables/gov/states/md/tax/income/deductions/md_deductions.py b/policyengine_us/variables/gov/states/md/tax/income/deductions/md_deductions.py index 5b0cc997121..065f3a2bc54 100644 --- a/policyengine_us/variables/gov/states/md/tax/income/deductions/md_deductions.py +++ b/policyengine_us/variables/gov/states/md/tax/income/deductions/md_deductions.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class md_deductions(Variable): @@ -27,4 +28,8 @@ def formula(tax_unit, period, parameters): # on your federal return, you may figure your tax using # both deduction methods to determine which is best for you. federal_itemizer = tax_unit("tax_unit_itemizes", period) - return where(federal_itemizer, max_(md_stdded, md_itmded), md_stdded) + method = tax_unit("state_deduction_method", period) + itemizes = federal_itemizer & state_itemization_uses_itemized( + method, md_itmded > md_stdded + ) + return where(itemizes, md_itmded, md_stdded) diff --git a/policyengine_us/variables/gov/states/me/tax/income/taxable_income/me_deductions.py b/policyengine_us/variables/gov/states/me/tax/income/taxable_income/me_deductions.py index 7d7f80b69bf..de67bce5605 100644 --- a/policyengine_us/variables/gov/states/me/tax/income/taxable_income/me_deductions.py +++ b/policyengine_us/variables/gov/states/me/tax/income/taxable_income/me_deductions.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class me_deductions(Variable): @@ -23,17 +24,18 @@ def formula(tax_unit, period, parameters): # its own standard deduction amounts for tax years 2025 and 2026 under # 36 M.R.S. Sec. 5124-C(1-B) and (1-C), and follows the federal standard # deduction from 2027 under Sec. 5124-C(1-D). - itemizes = tax_unit("tax_unit_itemizes", period) - standard_deduction = tax_unit("me_standard_deduction", period) - larger_deduction = max_( - tax_unit("me_itemized_deductions_pre_phaseout", period), - standard_deduction, + federal_itemizer = tax_unit("tax_unit_itemizes", period) + standard = tax_unit("me_standard_deduction", period) + itemized = tax_unit("me_itemized_deductions_pre_phaseout", period) + method = tax_unit("state_deduction_method", period) + itemizes = federal_itemizer & state_itemization_uses_itemized( + method, itemized > standard ) - max_deduction = where(itemizes, larger_deduction, standard_deduction) + selected_deduction = where(itemizes, itemized, standard) # Calculate the phaseout amount (Line 7). - phaseout_amount = max_deduction * phaseout_percent + phaseout_amount = selected_deduction * phaseout_percent # Calculate the deduction after phaseout (Line 8). # Note this cannot be negative because phaseout_percent is capped at 1. - return max_deduction - phaseout_amount + return selected_deduction - phaseout_amount diff --git a/policyengine_us/variables/gov/states/mn/tax/income/deductions/mn_itemizing.py b/policyengine_us/variables/gov/states/mn/tax/income/deductions/mn_itemizing.py index 8bf68fd29e0..bf64562f89f 100644 --- a/policyengine_us/variables/gov/states/mn/tax/income/deductions/mn_itemizing.py +++ b/policyengine_us/variables/gov/states/mn/tax/income/deductions/mn_itemizing.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class mn_itemizing(Variable): @@ -18,4 +19,5 @@ class mn_itemizing(Variable): def formula(tax_unit, period, parameters): std_ded = tax_unit("mn_standard_deduction", period) itm_ded = tax_unit("mn_itemized_deductions", period) - return itm_ded > std_ded + method = tax_unit("state_deduction_method", period) + return state_itemization_uses_itemized(method, itm_ded > std_ded) diff --git a/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_taxable_income.py b/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_taxable_income.py index 527757a2997..9b3d793aab9 100644 --- a/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_taxable_income.py +++ b/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_taxable_income.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class mo_taxable_income(Variable): @@ -36,7 +37,11 @@ def formula(person, period, parameters): federal_itemizer = tax_unit("tax_unit_itemizes", period) itmded = tax_unit("mo_itemized_deductions", period) stdded = tax_unit("standard_deduction", period) # same as federal - mo_deduction = where(federal_itemizer, max_(itmded, stdded), stdded) + method = tax_unit("state_deduction_method", period) + itemizes = federal_itemizer & state_itemization_uses_itemized( + method, itmded > stdded + ) + mo_deduction = where(itemizes, itmded, stdded) unit_mo_deductions = ( mo_deduction + tax_unit("mo_federal_income_tax_deduction", period) diff --git a/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_deductions_joint.py b/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_deductions_joint.py index 8d9138591ce..9031e97b5d3 100644 --- a/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_deductions_joint.py +++ b/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_deductions_joint.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ms_deductions_joint(Variable): @@ -16,4 +17,6 @@ class ms_deductions_joint(Variable): def formula(person, period, parameters): itemized = person("ms_itemized_deductions_joint", period) standard = person("ms_standard_deduction_joint", period) - return max_(itemized, standard) + method = person.tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itemized > standard) + return where(itemizes, itemized, standard) diff --git a/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_tax_unit_itemizes.py b/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_tax_unit_itemizes.py index 663c2a6096d..fa4013082d7 100644 --- a/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_tax_unit_itemizes.py +++ b/policyengine_us/variables/gov/states/ms/tax/income/deductions/ms_tax_unit_itemizes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ms_tax_unit_itemizes(Variable): @@ -11,4 +12,5 @@ class ms_tax_unit_itemizes(Variable): def formula(tax_unit, period, parameters): itemized_ded = add(tax_unit, period, ["ms_itemized_deductions_indiv"]) standard_ded = add(tax_unit, period, ["ms_standard_deduction_indiv"]) - return itemized_ded > standard_ded + method = tax_unit("state_deduction_method", period) + return state_itemization_uses_itemized(method, itemized_ded > standard_ded) diff --git a/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_deduction.py b/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_deduction.py index 8c1b4980546..44eff89fe15 100644 --- a/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_deduction.py +++ b/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_deduction.py @@ -7,9 +7,16 @@ class nc_standard_deduction(Variable): label = "North Carolina standard deduction" unit = USD definition_period = YEAR + reference = "https://www.ncleg.gov/EnactedLegislation/Statutes/HTML/BySection/Chapter_105/GS_105-153.5.html" defined_for = StateCode.NC def formula(tax_unit, period, parameters): filing_status = tax_unit("filing_status", period) p = parameters(period).gov.states.nc.tax.income - return p.deductions.standard.amount[filing_status] + # North Carolina imports eligibility for the federal standard deduction. + # A separate filer whose spouse itemizes federally has a zero amount. + spouse_itemizes = tax_unit("separate_filer_itemizes", period) + separate = filing_status == filing_status.possible_values.SEPARATE + return where( + separate & spouse_itemizes, 0, p.deductions.standard.amount[filing_status] + ) diff --git a/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_or_itemized_deductions.py b/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_or_itemized_deductions.py index 60b67262ac3..698e687e873 100644 --- a/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_or_itemized_deductions.py +++ b/policyengine_us/variables/gov/states/nc/tax/income/deductions/nc_standard_or_itemized_deductions.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class nc_standard_or_itemized_deductions(Variable): @@ -22,4 +23,6 @@ def formula(tax_unit, period, parameters): # N.C. standard deduction. stded = tax_unit("nc_standard_deduction", period) itded = tax_unit("nc_itemized_deductions", period) - return max_(stded, itded) + method = tax_unit("state_deduction_method", period) + itemizes = state_itemization_uses_itemized(method, itded > stded) + return where(itemizes, itded, stded) diff --git a/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_college_tuition_credit_eligible.py b/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_college_tuition_credit_eligible.py index 80fd74a342b..c755d155fc2 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_college_tuition_credit_eligible.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_college_tuition_credit_eligible.py @@ -10,4 +10,6 @@ class ny_college_tuition_credit_eligible(Variable): defined_for = StateCode.NY def formula(tax_unit, period, parameters): - return ~tax_unit("ny_itemizes", period) + itemizes = tax_unit("ny_itemizes", period) + elects_credit = tax_unit("ny_elects_tuition_credit_when_itemizing", period) + return ~itemizes | elects_credit diff --git a/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py b/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py new file mode 100644 index 00000000000..4ffd3574fc7 --- /dev/null +++ b/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py @@ -0,0 +1,27 @@ +from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import ( + JOINT_METHOD_COUNT, + joint_itemization_is_enabled, +) + + +class ny_elects_tuition_credit_when_itemizing(Variable): + value_type = bool + entity = TaxUnit + label = "Elects the New York college tuition credit when itemizing" + definition_period = YEAR + defined_for = StateCode.NY + documentation = ( + "A New York itemizer may claim the tuition credit while itemizing other " + "deductions. Set this election to the method used on the state return." + ) + reference = ( + "https://www.nysenate.gov/legislation/laws/TAX/606", # (t)(6) + "https://www.nysenate.gov/legislation/laws/TAX/615", # (d)(4) + "https://www.tax.ny.gov/forms/html-instructions/2025/it/it272i-2025.htm", + ) + + def formula(tax_unit, period, parameters): + if joint_itemization_is_enabled(period, parameters): + return tax_unit("tax_unit_joint_itemization", period) >= JOINT_METHOD_COUNT + return False diff --git a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_college_tuition_deduction.py b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_college_tuition_deduction.py index 288ed0f4438..a8f9352284b 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_college_tuition_deduction.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_college_tuition_deduction.py @@ -18,4 +18,13 @@ def formula(tax_unit, period, parameters): period ).gov.states.ny.tax.income.deductions.itemized.college_tuition allowable_expenses = tax_unit("ny_allowable_college_tuition_expenses", period) - return allowable_expenses * p.applicable_percentage + elects_credit = tax_unit("ny_elects_tuition_credit_when_itemizing", period) + charity_only = tax_unit( + "ny_itemized_deductions_reduction_based_on_charitable_deduction_applies", + period, + ) + return where( + elects_credit | charity_only, + 0, + allowable_expenses * p.applicable_percentage, + ) diff --git a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py index 8d56ce1f45b..653d63c85dc 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py @@ -1,11 +1,16 @@ from policyengine_us.model_api import * +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ny_itemizes(Variable): value_type = bool entity = TaxUnit label = "Itemizes New York deductions" - documentation = "Tax units who itemize their federal deductions can opt to itemize their New York deductions. However, if a standard deduction causes a lower tax liability, they must choose that." + documentation = ( + "New York allows an independent state election from 2018. Under Tax " + "Law section 613 the department recomputes a smaller itemized " + "deduction using the standard deduction." + ) definition_period = YEAR defined_for = StateCode.NY reference = "https://www.nysenate.gov/legislation/laws/TAX/613" @@ -15,3 +20,13 @@ def formula(tax_unit, period, parameters): standard_deduction = tax_unit("ny_standard_deduction", period) itemized_deductions = tax_unit("ny_itemized_deductions", period) return federal_itemizes & (itemized_deductions >= standard_deduction) + + def formula_2018(tax_unit, period, parameters): + federal = tax_unit("tax_unit_itemizes", period) + standard = tax_unit("ny_standard_deduction", period) + itemized = tax_unit("ny_itemized_deductions", period) + method = tax_unit("state_deduction_method", period) + # Preserve the legacy automatic choice. A filed state method and the + # joint optimizer can select itemization after either federal method. + elects_itemized = state_itemization_uses_itemized(method, federal) + return elects_itemized & (itemized >= standard) diff --git a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py index 84554be017e..e408e0b256a 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py @@ -1,4 +1,6 @@ from policyengine_us.model_api import * +from policyengine_us.tools.period_branch import has_input +from policyengine_us.tools.state_itemization import state_itemization_uses_itemized class ny_deductions(Variable): @@ -15,3 +17,17 @@ def formula(tax_unit, period, parameters): tax_unit("ny_itemized_deductions", period), tax_unit("ny_standard_deduction", period), ) + + def formula_2018(tax_unit, period, parameters): + itemized = tax_unit("ny_itemized_deductions", period) + standard = tax_unit("ny_standard_deduction", period) + # Retain the historic automatic larger-amount calculation unless a + # state election was filed. Section 613 recomputes smaller items. + automatic = ( + tax_unit("ny_itemizes", period) + if has_input(tax_unit.simulation, "ny_itemizes", period) + else itemized >= standard + ) + method = tax_unit("state_deduction_method", period) + use_items = state_itemization_uses_itemized(method, automatic) + return where(use_items, max_(itemized, standard), standard) diff --git a/policyengine_us/variables/gov/states/tax/income/state_deduction_method.py b/policyengine_us/variables/gov/states/tax/income/state_deduction_method.py new file mode 100644 index 00000000000..7488ed3e98b --- /dev/null +++ b/policyengine_us/variables/gov/states/tax/income/state_deduction_method.py @@ -0,0 +1,25 @@ +from policyengine_us.model_api import * + + +class StateDeductionMethod(Enum): + STANDARD = "Standard deduction" + ITEMIZED = "Itemized deductions" + AUTOMATIC = "State's usual calculation" + + +class state_deduction_method(Variable): + value_type = Enum + possible_values = StateDeductionMethod + default_value = StateDeductionMethod.AUTOMATIC + entity = TaxUnit + label = "State deduction method" + definition_period = YEAR + + def formula(tax_unit, period, parameters): + if ( + period.start.year == 2025 + and parameters(period).gov.simulation.joint_federal_state_itemization + ): + choices = tax_unit("tax_unit_joint_itemization", period) + return choices % len(StateDeductionMethod) + return np.full(tax_unit.count, StateDeductionMethod.AUTOMATIC.index) From 94770db0b8425e5e099c426a7412b1846029122f Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 12:07:10 +0000 Subject: [PATCH 08/12] Replay claim-of-right relief from the winning joint election --- .../tax_unit_joint_itemization.yaml | 30 +++++++++++++++++++ policyengine_us/tools/state_itemization.py | 15 +++++++++- .../claim_of_right_credit_applies.py | 14 +++++++++ .../state_and_local_sales_tax_elected.py | 4 +-- ...ny_elects_tuition_credit_when_itemizing.py | 6 ++-- 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml index ede3e3cb91c..d747be36a15 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml @@ -97,3 +97,33 @@ # https://www.ftb.ca.gov/forms/2025/2025-540-p.pdf#page=1 ca_amti_adjustments: [5_706, 250, 5_706, 500] income_tax: [25_067, 25_067, 25_007, 21_167] + +- name: Case 5, the chosen filing methods retain the section 1341 repayment deduction. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: GA + age: 40 + employment_income: 145_000 + deductible_mortgage_interest: 10_000 + state_and_local_sales_or_income_tax: 0 + claim_of_right_repayment: 5_000 + claim_of_right_prior_year_tax_decrease: 0 + output: + # Under 26 USC 1341(a)(4)–(5), use the less expensive tax calculation + # for the filed return. With itemization, the $5,000 repayment deduction + # saves federal tax while the alternate method grants no credit. + # https://www.govinfo.gov/content/pkg/USCODE-2024-title26/html/USCODE-2024-title26-subtitleA-chap1-subchapQ-partV-sec1341.htm + # Georgia follows federal itemization and carries the $15,000 federal + # itemized deductions. Its tax is $130,000 x 5.19% minus $300 = $6,447. + # https://dor.georgia.gov/document/document/2025-it-511-individual-income-tax-booklet/download#page=18 + # Federal tax on $130,000 taxable income is $24,047. The combined bill + # of $30,494 is less than under the two standard deductions ($30,769.70). + # https://www.irs.gov/instructions/i1040gi + tax_unit_itemizes: true + state_deduction_method: ITEMIZED + claim_of_right_credit_applies: false + claim_of_right_deduction: 5_000 + income_tax: 24_047 + state_income_tax: 6_447 + federal_state_income_tax: 30_494 diff --git a/policyengine_us/tools/state_itemization.py b/policyengine_us/tools/state_itemization.py index 9d2b461823f..57d3543e936 100644 --- a/policyengine_us/tools/state_itemization.py +++ b/policyengine_us/tools/state_itemization.py @@ -12,6 +12,7 @@ AUTOMATIC = StateDeductionMethod.AUTOMATIC.index STATE_METHOD_COUNT = len(StateDeductionMethod) JOINT_METHOD_COUNT = 2 * STATE_METHOD_COUNT +JOINT_FILING_CHOICE_COUNT = 2 * JOINT_METHOD_COUNT CENT = 0.01 NATIVE_STATE_ELECTION_INPUTS = { "AR": "ar_tax_unit_itemizes", @@ -38,6 +39,10 @@ def joint_federal_itemizes(choices): return choices % JOINT_METHOD_COUNT >= STATE_METHOD_COUNT +def joint_uses_alternative(choices): + return choices % JOINT_FILING_CHOICE_COUNT >= JOINT_METHOD_COUNT + + def state_itemization_uses_itemized(method, automatic): """Resolve a state method with the jurisdiction's usual calculation.""" return np.where( @@ -96,6 +101,7 @@ def joint_itemization(tax_unit, period, parameters): known_salt_components = not has_input( sim, "state_and_local_sales_or_income_tax", period ) + any_claim_of_right = tax_unit("claim_of_right_section_1341_eligible", period).any() choices = [] federal_methods = [] costs = [] @@ -176,6 +182,11 @@ def joint_itemization(tax_unit, period, parameters): total = np.asarray(branch.calculate("income_tax", period), dtype=float) total = total + branch.calculate("state_income_tax", period) total += branch.calculate("local_tax", period) + claim_of_right_credit = ( + branch.calculate("claim_of_right_credit_applies", period) + if any_claim_of_right + else False + ) if prefer_federal_itemized is None: prefer_federal_itemized = branch.calculate( "itemized_taxable_income_deductions", period @@ -193,7 +204,9 @@ def joint_itemization(tax_unit, period, parameters): | (native_supplied == AUTOMATIC) | (native_supplied == methods) ) - choices.append(method_code + methods) + choices.append( + method_code + methods + JOINT_FILING_CHOICE_COUNT * claim_of_right_credit + ) federal_methods.append(federal_itemizes) costs.append(np.where(allowable, total, np.inf)) diff --git a/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_credit_applies.py b/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_credit_applies.py index 7c46719ad72..59a6c621f5d 100644 --- a/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_credit_applies.py +++ b/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_credit_applies.py @@ -1,4 +1,9 @@ from policyengine_us.model_api import * +from policyengine_us.tools.period_branch import has_input +from policyengine_us.tools.state_itemization import ( + JOINT_FILING_CHOICE_COUNT, + joint_itemization_is_enabled, +) class claim_of_right_credit_applies(Variable): @@ -31,6 +36,15 @@ def formula(tax_unit, period, parameters): # Comparing the two methods takes two more tax computations; # skip them when no tax unit repays more than the threshold. return np.zeros(tax_unit.count, dtype=bool) + if joint_itemization_is_enabled(period, parameters) and not has_input( + tax_unit.simulation, "tax_unit_joint_itemization", period + ): + # The joint comparison fixes the federal method on each branch, + # computes section 1341 there, and keeps the winning branch's result. + return eligible & ( + tax_unit("tax_unit_joint_itemization", period) + >= JOINT_FILING_CHOICE_COUNT + ) tax_if_credit = tax_unit("income_tax_if_claiming_claim_of_right_credit", period) tax_if_deduction = tax_unit( "income_tax_if_claiming_claim_of_right_deduction", period diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py index b99dbbdc8e9..5a52b9ba857 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py @@ -1,8 +1,8 @@ from policyengine_us.model_api import * from policyengine_us.tools.state_itemization import ( - JOINT_METHOD_COUNT, joint_federal_itemizes, joint_itemization_is_enabled, + joint_uses_alternative, ) @@ -34,7 +34,7 @@ def formula(tax_unit, period, parameters): choices = tax_unit("tax_unit_joint_itemization", period) return where( virginia & joint_federal_itemizes(choices), - choices >= JOINT_METHOD_COUNT, + joint_uses_alternative(choices), default, ) return default diff --git a/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py b/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py index 4ffd3574fc7..6a6f05f9892 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/credits/college_tuition/ny_elects_tuition_credit_when_itemizing.py @@ -1,7 +1,7 @@ from policyengine_us.model_api import * from policyengine_us.tools.state_itemization import ( - JOINT_METHOD_COUNT, joint_itemization_is_enabled, + joint_uses_alternative, ) @@ -23,5 +23,7 @@ class ny_elects_tuition_credit_when_itemizing(Variable): def formula(tax_unit, period, parameters): if joint_itemization_is_enabled(period, parameters): - return tax_unit("tax_unit_joint_itemization", period) >= JOINT_METHOD_COUNT + return joint_uses_alternative( + tax_unit("tax_unit_joint_itemization", period) + ) return False From d2fc1eb549a1d321e63b01343a935401e8ac2be7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 12:18:43 +0000 Subject: [PATCH 09/12] Test decisions that turn on Virginia and New York City tax --- .../tax_unit_joint_itemization.yaml | 31 +++++++++++++++++++ ..._elects_tuition_credit_when_itemizing.yaml | 25 +++++++++++++++ ...thods.yaml => state_deduction_method.yaml} | 0 3 files changed, 56 insertions(+) rename policyengine_us/tests/policy/baseline/gov/states/tax/income/{independent_state_deduction_methods.yaml => state_deduction_method.yaml} (100%) diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml index d747be36a15..85fe89a73e2 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml @@ -127,3 +127,34 @@ income_tax: 24_047 state_income_tax: 6_447 federal_state_income_tax: 30_494 + +- name: Case 6, the Virginia sales tax election minimizes combined income tax. + period: 2025 + absolute_error_margin: 0.01 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: VA + age: 40 + employment_income: 150_000 + deductible_mortgage_interest: 20_000 + state_withheld_income_tax: 8_000 + state_sales_tax: 7_800 + local_sales_tax: 0 + output: + # Federal Schedule A line 5a allows either tax. Income taxes would + # lower the federal bill by $48, to $22,127. + # https://www.irs.gov/instructions/i1040sca + # Virginia Schedule A subtracts income taxes on line 18 and retains + # sales taxes. The extra $7,800 deduction saves $448.50 at 5.75%. + # https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf + # https://law.lis.virginia.gov/vacode/title58.1/section58.1-320/ + tax_unit_itemizes: true + state_deduction_method: ITEMIZED + state_and_local_sales_tax_elected: true + state_and_local_sales_or_income_tax: 7_800 + itemized_taxable_income_deductions: 27_800 + va_deductions: 27_800 + va_taxable_income: 121_270 + income_tax: 22_175 + state_income_tax: 6_715.525 + federal_state_income_tax: 28_890.525 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml index 9dbafce28f4..7183d93210a 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml @@ -168,3 +168,28 @@ ny_itemizes: false ny_deductions: 8_000 ny_college_tuition_credit: 240 + +# IT-272 Part 2 caps the credit at $200 for $3,000 of qualified tuition. +# IT-201 lines 47–49 use state taxable income to compute NYC resident tax. +# https://www.tax.ny.gov/pdf/2025/inc/it272_2025_fill_in.pdf#page=2 +# https://www.tax.ny.gov/forms/html-instructions/2025/it/it201i-2025.htm +- name: New York City's local income tax can change a resident's IT-272 tuition election. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: [NY, NY] + in_nyc: [false, true] + age: [40, 40] + tax_unit_itemizes: [false, false] + ny_agi: [60_000, 60_000] + ny_exemptions: [0, 0] + deductible_mortgage_interest: [16_000, 16_000] + qualified_tuition_expenses: [3_000, 3_000] + state_sales_tax: [0, 0] + local_sales_tax: [0, 0] + output: + state_deduction_method: [ITEMIZED, ITEMIZED] + ny_elects_tuition_credit_when_itemizing: [true, false] + ny_college_tuition_credit: [200, 0] + ny_college_tuition_deduction: [0, 3_000] + ny_taxable_income: [44_000, 41_000] diff --git a/policyengine_us/tests/policy/baseline/gov/states/tax/income/independent_state_deduction_methods.yaml b/policyengine_us/tests/policy/baseline/gov/states/tax/income/state_deduction_method.yaml similarity index 100% rename from policyengine_us/tests/policy/baseline/gov/states/tax/income/independent_state_deduction_methods.yaml rename to policyengine_us/tests/policy/baseline/gov/states/tax/income/state_deduction_method.yaml From cd6caf0cbebaacad9e629686d4d3d62b1c296707 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 12:50:32 +0000 Subject: [PATCH 10/12] Apply state-specific sales tax and tuition elections consistently --- .../joint_federal_state_itemization.yaml | 2 +- .../core/test_joint_itemization_branches.py | 12 +++- ...st_joint_itemization_mixed_alternatives.py | 63 ++++++++++++++++ .../tax_unit_joint_itemization.yaml | 32 +++++++++ .../deductions/md_itemized_deductions.yaml | 23 ++++++ .../deductions/mo_itemized_deductions.yaml | 37 ++++++++++ .../deductions/ne_itemized_deductions.yaml | 56 +++++++++++++++ ..._elects_tuition_credit_when_itemizing.yaml | 20 ++++++ policyengine_us/tools/state_itemization.py | 56 ++++++++------- .../state_and_local_sales_tax_elected.py | 30 +++++--- .../deductions/md_itemized_deductions.py | 71 +++++++++++-------- .../mo_net_state_income_taxes.py | 30 ++++++++ .../deductions/ne_itemized_deductions.py | 12 ++++ .../deductions/itemized/ny_itemizes.py | 15 ++-- .../income/taxable_income/ny_deductions.py | 9 ++- 15 files changed, 394 insertions(+), 74 deletions(-) create mode 100644 policyengine_us/tests/core/test_joint_itemization_mixed_alternatives.py diff --git a/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml b/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml index 877217d2d9b..fc1c77fcddc 100644 --- a/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml +++ b/policyengine_us/parameters/gov/simulation/joint_federal_state_itemization.yaml @@ -1,4 +1,4 @@ -description: Choose full-year resident deduction methods for tax year 2025 by minimizing combined federal, state, and local tax liability. +description: Choose among modeled full-year resident deduction elections for tax year 2025 by minimizing combined federal, state, and local tax liability. metadata: unit: bool label: Joint federal and state itemization diff --git a/policyengine_us/tests/core/test_joint_itemization_branches.py b/policyengine_us/tests/core/test_joint_itemization_branches.py index ffb703fba3d..c759abb8bd7 100644 --- a/policyengine_us/tests/core/test_joint_itemization_branches.py +++ b/policyengine_us/tests/core/test_joint_itemization_branches.py @@ -5,7 +5,7 @@ import numpy as np import pytest from hypothesis import assume, example, given, settings, strategies as st -from policyengine_core.periods import period +from policyengine_core.reforms import Reform from policyengine_us import Simulation from policyengine_us.tools.state_itemization import choose_joint_itemization @@ -89,9 +89,15 @@ def test_warm_joint_choice_is_recomputed_for_a_filed_election_in_a_branch(): }, } ) - simulation.tax_benefit_system.parameters.gov.simulation.joint_federal_state_itemization.update( - period=period(2025), value=True + simulation.apply_reform( + Reform.from_dict( + {"gov.simulation.joint_federal_state_itemization": {"2025": True}} + ) + ) + default_policy = Simulation.default_tax_benefit_system_instance.parameters( + "2025-01-01" ) + assert not default_policy.gov.simulation.joint_federal_state_itemization baseline_2024 = simulation.calculate("federal_state_income_tax", 2024) # Query the state side first. The joint choice is for both taxes, so it diff --git a/policyengine_us/tests/core/test_joint_itemization_mixed_alternatives.py b/policyengine_us/tests/core/test_joint_itemization_mixed_alternatives.py new file mode 100644 index 00000000000..b70904f935d --- /dev/null +++ b/policyengine_us/tests/core/test_joint_itemization_mixed_alternatives.py @@ -0,0 +1,63 @@ +"""Resident-specific elections in a mixed federal-itemizer population.""" + +import numpy as np +from policyengine_core.reforms import Reform + +from policyengine_us import Simulation + + +def test_new_york_tuition_and_virginia_sales_elections_share_a_population(): + year = 2025 + # Each column represents a separate resident return. + situation = { + "state_code": {year: ["NY", "NY", "VA"]}, + "in_nyc": {year: [False, True, False]}, + "age": {year: [40, 40, 40]}, + "employment_income": {year: [60_000, 60_000, 150_000]}, + "deductible_mortgage_interest": {year: [16_000, 16_000, 20_000]}, + "qualified_tuition_expenses": {year: [3_000, 3_000, 0]}, + "tax_unit_itemizes": {year: [True, True, True]}, + "state_withheld_income_tax": {year: [8_000, 8_000, 8_000]}, + "state_sales_tax": {year: [0, 0, 7_800]}, + "local_sales_tax": {year: [0, 0, 0]}, + } + bills = ("income_tax", "state_income_tax", "local_tax") + + # Price the filed alternatives on fresh simulations with the optimizer off. + def filed_bills(tuition_credit, sales_tax): + filed = Simulation(situation=situation) + filed.set_input("state_deduction_method", year, ["ITEMIZED"] * 3) + filed.set_input("ny_elects_tuition_credit_when_itemizing", year, tuition_credit) + filed.set_input("state_and_local_sales_tax_elected", year, sales_tax) + return np.array([filed.calculate(name, year) for name in bills]) + + # Only the upstate filer elects the tuition credit. NYC resident tax makes + # the tuition deduction preferable in the city. Virginia keeps sales tax + # on its Schedule A and subtracts income tax on the competing return. + tuition = [True, False, False] + sales = [False, False, True] + expected = filed_bills(tuition, sales) + competing = filed_bills([False, True, False], [False, False, False]) + assert (expected.sum(axis=0) < competing.sum(axis=0)).all() + assert expected[2, 1] > 0 + + joint = Simulation(situation=situation) + joint.apply_reform( + Reform.from_dict( + {"gov.simulation.joint_federal_state_itemization": {"2025": True}} + ) + ) + np.testing.assert_array_equal( + joint.calculate("ny_elects_tuition_credit_when_itemizing", year), tuition + ) + np.testing.assert_array_equal( + joint.calculate("state_and_local_sales_tax_elected", year), sales + ) + np.testing.assert_array_equal( + joint.calculate("state_deduction_method", year).decode_to_str(), + ["ITEMIZED"] * 3, + ) + for name, expected_bill in zip(bills, expected, strict=True): + np.testing.assert_allclose( + joint.calculate(name, year), expected_bill, rtol=0, atol=0.01 + ) diff --git a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml index 85fe89a73e2..fb0f62a6cce 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_joint_itemization.yaml @@ -158,3 +158,35 @@ income_tax: 22_175 state_income_tax: 6_715.525 federal_state_income_tax: 28_890.525 + +- name: Case 7, Nebraska keeps the smaller sales tax election when the federal SALT cap binds. + period: 2025 + absolute_error_margin: 0.02 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: NE + age: 40 + employment_income: 700_000 + real_estate_taxes: 8_000 + deductible_mortgage_interest: 20_000 + state_withheld_income_tax: 35_000 + local_income_tax: 0 + state_sales_tax: 4_000 + local_sales_tax: 0 + output: + # Either line 5a election reaches the $10,000 federal SALT floor and gives + # $30,000 in federal itemized deductions. Nebraska retains the sales tax. + # With income taxes it removes $35,000 and uses the $8,600 state standard. + # The single filer's Nebraska marginal rate is 5.2%. + # https://revenue.nebraska.gov/sites/default/files/doc/tax-forms/2025/f_Individual_Income_Tax_Booklet.pdf#page=14 + tax_unit_itemizes: true + state_deduction_method: ITEMIZED + state_and_local_sales_tax_elected: true + state_and_local_sales_or_income_tax: 4_000 + salt_deduction: 10_000 + itemized_taxable_income_deductions: 30_000 + ne_itemized_deductions: 30_000 + ne_taxable_income: 670_000 + income_tax: 204_920.25 + state_income_tax: 34_191.032 + federal_state_income_tax: 239_111.282 diff --git a/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_itemized_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_itemized_deductions.yaml index 236461760b2..a274a7fafe3 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_itemized_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/md/tax/income/deductions/md_itemized_deductions.yaml @@ -217,3 +217,26 @@ capped_property_taxes: 0 output: md_itemized_deductions: 0 + +- name: Maryland retains capped general sales taxes under the federal Schedule A election. + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: [MD, MD, MD, MD] + filing_status: [SINGLE, SINGLE, SINGLE, SINGLE] + adjusted_gross_income: [205_000, 205_000, 550_000, 550_000] + itemized_deductions_less_salt: [20_000, 20_000, 20_000, 20_000] + real_estate_taxes: [35_000, 35_000, 35_000, 35_000] + state_and_local_sales_or_income_tax: [7_800, 8_000, 1_000, 30_000] + state_and_local_sales_tax_elected: [true, false, true, false] + output: + # Form 502 line 17a starts with capped federal deductions. Line 17b + # removes income tax and permits applying the SALT cap to property first. + # The $40,000 cap falls to $25,000 at $550,000 AGI (IRS Schedule A 5e). + # Maryland worksheet 14A then reduces deductions by $375 or $26,250. + # https://www.irs.gov/instructions/i1040sca + # https://www.marylandcomptroller.gov/content/dam/mdcomp/tax/instructions/2025/resident-booklet.pdf#page=21 + # https://services.marylandcomptroller.gov/taxes/en/what-s-new-for-the-2026-tax-filing-season-2025-tax-year?id=kb_article_view&sysparm_article=KB0010023 + salt_cap: [40_000, 40_000, 25_000, 25_000] + salt_deduction: [40_000, 40_000, 25_000, 25_000] + md_itemized_deductions: [59_625, 54_625, 18_750, 18_750] diff --git a/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/deductions/mo_itemized_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/deductions/mo_itemized_deductions.yaml index 27eec9d47e8..cff7a5187ea 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/deductions/mo_itemized_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/deductions/mo_itemized_deductions.yaml @@ -147,3 +147,40 @@ self_employment_tax_ald: 7_064.77 mo_self_employment_tax_addback: 7_064.77 mo_itemized_deductions: 27_064.78 + +- name: Missouri adds back only net income taxes claimed under the federal Schedule A election. + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: [MO, MO, MO, MO] + filing_status: [SINGLE, SINGLE, SINGLE, SINGLE] + adjusted_gross_income: [150_000, 150_000, 650_000, 650_000] + deductible_mortgage_interest: [20_000, 20_000, 20_000, 20_000] + state_withheld_income_tax: [8_000, 8_000, 30_000, 30_000] + mo_kansas_city_earnings_tax: [0, 0, 6_500, 6_500] + state_sales_tax: [7_800, 7_800, 1_000, 1_000] + local_sales_tax: [0, 0, 0, 0] + state_and_local_sales_tax_elected: [true, false, true, false] + output: + # MO-A Part 2 lines 9–11 remove only income taxes in the federal + # deduction, excluding Kansas City earnings tax from the addback. + # At $650,000 AGI the fourth row prorates $30,000 / $36,500 + # against the $10,000 SALT cap, so line 11 is $8,219.18. + # https://dor.mo.gov/forms/MO-A_2025.pdf#page=2 + salt_deduction: [7_800, 8_000, 1_000, 10_000] + mo_net_state_income_taxes: [0, 8_000, 0, 8_219.178] + mo_itemized_deductions: [27_800, 20_000, 21_000, 21_780.822] + +- name: Missouri retains legacy handling of a Schedule A election supplied only as an untyped total. + period: 2025 + absolute_error_margin: 0.01 + input: + state_code: MO + filing_status: SINGLE + adjusted_gross_income: 150_000 + deductible_mortgage_interest: 20_000 + state_withheld_income_tax: 2_000 + state_and_local_sales_or_income_tax: 5_000 + output: + mo_net_state_income_taxes: 2_000 + mo_itemized_deductions: 23_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ne/tax/income/deductions/ne_itemized_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/ne/tax/income/deductions/ne_itemized_deductions.yaml index e11a586976d..cd026d5e4ff 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ne/tax/income/deductions/ne_itemized_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ne/tax/income/deductions/ne_itemized_deductions.yaml @@ -21,3 +21,59 @@ state_code: NE output: ne_itemized_deductions: 3_000 + 7_000 + 6_000 + +- name: Nebraska removes all income taxes even when SALT is at its federal floor + period: 2025 + input: + state_code: NE + employment_income: 700_000 + real_estate_taxes: 8_000 + deductible_mortgage_interest: 20_000 + state_withheld_income_tax: 35_000 + local_income_tax: 0 + state_sales_tax: 4_000 + local_sales_tax: 0 + state_and_local_sales_tax_elected: false + output: + tax_unit_itemizes: true + state_and_local_sales_or_income_tax: 35_000 + salt_cap: 10_000 + salt_deduction: 10_000 + itemized_taxable_income_deductions: 30_000 + ne_itemized_deductions: 0 + ne_taxable_income: 700_000 - 8_600 + +- name: Electing the smaller general sales tax keeps the capped SALT deduction in Nebraska + period: 2025 + input: + state_code: NE + employment_income: 700_000 + real_estate_taxes: 8_000 + deductible_mortgage_interest: 20_000 + state_withheld_income_tax: 35_000 + local_income_tax: 0 + state_sales_tax: 4_000 + local_sales_tax: 0 + state_and_local_sales_tax_elected: true + output: + tax_unit_itemizes: true + state_and_local_sales_or_income_tax: 4_000 + salt_cap: 10_000 + salt_deduction: 10_000 + itemized_taxable_income_deductions: 30_000 + ne_itemized_deductions: 30_000 + ne_taxable_income: 670_000 + +- name: Nebraska subtracts gross income tax when the SALT cap leaves a positive state deduction + period: 2025 + input: + state_code: NE + employment_income: 700_000 + real_estate_taxes: 8_000 + deductible_mortgage_interest: 40_000 + state_and_local_sales_or_income_tax: 35_000 + state_and_local_sales_tax_elected: false + output: + itemized_taxable_income_deductions: 50_000 + ne_itemized_deductions: 15_000 + ne_taxable_income: 685_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml index 7183d93210a..10a1c79554d 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ny/tax/income/credits/ny_elects_tuition_credit_when_itemizing.yaml @@ -153,6 +153,26 @@ ny_college_tuition_deduction: [0, 6_000] ny_deductions: [16_000, 22_000] +- name: Explicit automatic New York itemization awards only one tuition benefit. + period: 2025 + input: + gov.simulation.joint_federal_state_itemization: true + state_code: [NY, NY] + tax_unit_itemizes: [false, false] + state_deduction_method: [AUTOMATIC, AUTOMATIC] + ny_agi: [18_000, 90_000] + ny_exemptions: [1_000, 0] + deductible_mortgage_interest: [16_000, 16_000] + qualified_tuition_expenses: [2_000, 6_000] + state_sales_tax: [0, 0] + local_sales_tax: [0, 0] + output: + ny_itemizes: [true, true] + ny_elects_tuition_credit_when_itemizing: [true, false] + ny_college_tuition_deduction: [0, 6_000] + ny_college_tuition_credit: [200, 0] + ny_deductions: [16_000, 22_000] + - name: A filed New York standard election stays binding in the joint calculation. period: 2025 input: diff --git a/policyengine_us/tools/state_itemization.py b/policyengine_us/tools/state_itemization.py index 57d3543e936..44a8bb779d9 100644 --- a/policyengine_us/tools/state_itemization.py +++ b/policyengine_us/tools/state_itemization.py @@ -14,6 +14,8 @@ JOINT_METHOD_COUNT = 2 * STATE_METHOD_COUNT JOINT_FILING_CHOICE_COUNT = 2 * JOINT_METHOD_COUNT CENT = 0.01 +SALT_ELECTION_WHEN_STATE_ITEMIZED = ("MD", "MO") +SALT_ELECTION_STATES = (*SALT_ELECTION_WHEN_STATE_ITEMIZED, "NE", "VA") NATIVE_STATE_ELECTION_INPUTS = { "AR": "ar_tax_unit_itemizes", "CA": "ca_itemizes", @@ -106,47 +108,46 @@ def joint_itemization(tax_unit, period, parameters): federal_methods = [] costs = [] prefer_federal_itemized = None - for federal_itemizes, state_method, alternative in product( - (False, True), (STANDARD, ITEMIZED), (False, True) + for federal_itemizes, trial in product( + (False, True), ("standard", "itemized", "alternative") ): allowable = federal_itemizes | ~requires_federal_itemizing if forced_federal is not None: allowable &= forced_federal == federal_itemizes - methods = np.where(elected_state, state_method, AUTOMATIC) - if state_method == STANDARD: - linked_method = ITEMIZED if federal_itemizes else STANDARD - methods = np.where(follows_federal, linked_method, methods) + linked_method = ITEMIZED if federal_itemizes else STANDARD + linked = np.where(follows_federal, linked_method, AUTOMATIC) + if trial == "standard": + methods = np.where(elected_state, STANDARD, linked) allowable &= ~( np.isin(state, ("ID", "MO", "NC")) & requires_federal_itemizing & ~keep_automatic ) - else: + elif trial == "itemized": + methods = np.where(elected_state, ITEMIZED, linked) allowable &= independent | (federal_itemizes & federal_itemizers_only) allowable &= ~keep_automatic - methods = np.where(keep_automatic, AUTOMATIC, methods) - - if alternative: - # NY can take an education credit on an itemized return. VA - # Schedule A responds to the federal choice of income or sales tax. - allowable &= ( - (state == "NY") & (state_method == ITEMIZED) & (not fixed_tuition) - ) | ( - (state == "VA") + else: + # Each resident can use only one of these alternatives. + ny_tuition = (state == "NY") & (not fixed_tuition) + salt_sales = ( + np.isin(state, SALT_ELECTION_STATES) & federal_itemizes - & (state_method == STANDARD) & (not fixed_salt) & known_salt_components ) + methods = np.where( + (state == "NY") | federal_itemizers_only, ITEMIZED, linked + ) + allowable &= ny_tuition | salt_sales if not allowable.any(): continue + methods = np.where(keep_automatic, AUTOMATIC, methods) method_code = STATE_METHOD_COUNT * federal_itemizes - if alternative: + if trial == "alternative": method_code += JOINT_METHOD_COUNT - branch_name = ( - f"resident_itemization_{period.start.year}_{method_code}_{state_method}" - ) + branch_name = f"resident_itemization_{period.start.year}_{method_code}_{trial}" branch = get_override_branch( sim, branch_name, @@ -159,22 +160,25 @@ def joint_itemization(tax_unit, period, parameters): inherit_calculated=False, ) try: - if (state == "HI").any(): + if (allowable & (state == "HI")).any(): eligibility = branch.calculate( "hi_itemized_deductions_eligible" - if state_method == ITEMIZED + if trial == "itemized" else "hi_required_to_itemize", period, ) allowable &= (state != "HI") | ( eligibility - if state_method == ITEMIZED + if trial == "itemized" else (keep_automatic | ~eligibility) ) - if state_method == ITEMIZED and (state == "NY").any(): + ny_items = (state == "NY") & ( + (methods == ITEMIZED) | (keep_automatic & (native_supplied == ITEMIZED)) + ) + if (allowable & ny_items).any(): # N.Y. Tax Law §613 requires the standard deduction when the # elected itemized amount is smaller, including the tuition option. - allowable &= (state != "NY") | ( + allowable &= ~ny_items | ( branch.calculate("ny_itemized_deductions", period) >= branch.calculate("ny_standard_deduction", period) ) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py index 5a52b9ba857..b91dd52520e 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/itemizing/state_and_local_sales_tax_elected.py @@ -1,9 +1,15 @@ from policyengine_us.model_api import * +from policyengine_us.tools.period_branch import has_input from policyengine_us.tools.state_itemization import ( + SALT_ELECTION_STATES, + SALT_ELECTION_WHEN_STATE_ITEMIZED, joint_federal_itemizes, joint_itemization_is_enabled, joint_uses_alternative, ) +from policyengine_us.variables.gov.states.tax.income.state_deduction_method import ( + StateDeductionMethod, +) class state_and_local_sales_tax_elected(Variable): @@ -14,13 +20,9 @@ class state_and_local_sales_tax_elected(Variable): reference = "https://www.law.cornell.edu/uscode/text/26/164#b_5" def formula(tax_unit, period, parameters): - # An input with only the total has historically represented income tax - # for Virginia. A filer can supply the election with the total. - simulation = tax_unit.simulation - if any( - ("state_and_local_sales_or_income_tax", branch, period) - in simulation._user_input_keys - for branch in simulation._get_visible_branch_names() + # A filer who supplies only a combined total can also supply the election. + if has_input( + tax_unit.simulation, "state_and_local_sales_or_income_tax", period ): return False income_tax = add( @@ -29,11 +31,19 @@ def formula(tax_unit, period, parameters): sales_tax = add(tax_unit, period, ["state_sales_tax", "local_sales_tax"]) default = sales_tax > income_tax if joint_itemization_is_enabled(period, parameters): - virginia = tax_unit.household("state_code", period) == StateCode.VA - if virginia.any(): + state = tax_unit.household("state_code_str", period) + compares_sales = np.isin(state, SALT_ELECTION_STATES) + if compares_sales.any(): choices = tax_unit("tax_unit_joint_itemization", period) + optional_itemizers = np.isin(state, SALT_ELECTION_WHEN_STATE_ITEMIZED) + uses_standard = ( + choices % len(StateDeductionMethod) + == StateDeductionMethod.STANDARD.index + ) return where( - virginia & joint_federal_itemizes(choices), + compares_sales + & joint_federal_itemizes(choices) + & ~(optional_itemizers & uses_standard), joint_uses_alternative(choices), default, ) diff --git a/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py b/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py index 92fd78ea5d4..d11351c8326 100644 --- a/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py +++ b/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py @@ -16,6 +16,8 @@ class md_itemized_deductions(Variable): # less income taxes net of their pro rata share of the section 68 # reduction. "https://mgaleg.maryland.gov/mgawebsite/Laws/StatuteText?article=gtg§ion=10-218&enactments=false", + "https://www.marylandcomptroller.gov/content/dam/mdcomp/tax/instructions/2025/resident-booklet.pdf#page=21", + "https://services.marylandcomptroller.gov/taxes/en/what-s-new-for-the-2026-tax-filing-season-2025-tax-year?id=kb_article_view&sysparm_article=KB0010023", # Section 68 as amended by P.L. 119-21, sec. 70111, from 2026. # PDF pages 94-95 "https://www.govinfo.gov/content/pkg/PLAW-119publ21/pdf/PLAW-119publ21.pdf#page=94", @@ -29,31 +31,44 @@ def formula(tax_unit, period, parameters): period, ["itemized_deductions_less_salt", "capped_property_taxes"], ) - if parameters(period).gov.irs.deductions.itemized.limitation.obbb.applies: - # Tax-General 10-218(b)(1) starts from federal itemized deductions - # after the section 68 reduction R, and 10-218(b)(3) subtracts - # the income taxes I net of their pro rata share of R: - # T - R - I + R * I / T, where T is the pre-reduction total. - # With I = T - base this equals base * (1 - R / T). - total = tax_unit("total_itemized_taxable_income_deductions", period) - reduction = tax_unit("itemized_taxable_income_deductions_reduction", period) - mask = total > 0 - reduction_share = np.zeros_like(total) - reduction_share[mask] = reduction[mask] / total[mask] - base_itemized = base_itemized * (1 - reduction_share) - - # Apply income-based phase-out if applicable - p = parameters(period).gov.states.md.tax.income.deductions.itemized - if p.phase_out.applies: - filing_status = tax_unit("filing_status", period) - md_agi = tax_unit("adjusted_gross_income", period) - - # Calculate phase-out reduction - excess_income = max_(md_agi - p.phase_out.threshold[filing_status], 0) - phase_out_reduction = excess_income * p.phase_out.rate - - # Apply phase-out (itemized deductions cannot go below zero) - return max_(base_itemized - phase_out_reduction, 0) - - # When phase-out does not apply, no phase-out - return base_itemized + return _limit_deductions(tax_unit, period, parameters, base_itemized) + + def formula_2025(tax_unit, period, parameters): + # Form 502 line 17b removes only income taxes. The Comptroller + # accepts counting property taxes first under the federal SALT cap. + property_tax = min_( + tax_unit("capped_property_taxes", period), tax_unit("salt_cap", period) + ) + elects_sales_tax = tax_unit("state_and_local_sales_tax_elected", period) + deductible_salt = where( + elects_sales_tax, tax_unit("salt_deduction", period), property_tax + ) + base_itemized = ( + tax_unit("itemized_deductions_less_salt", period) + deductible_salt + ) + return _limit_deductions(tax_unit, period, parameters, base_itemized) + + +def _limit_deductions(tax_unit, period, parameters, base_itemized): + if parameters(period).gov.irs.deductions.itemized.limitation.obbb.applies: + # Tax-General 10-218(b)(1) starts from federal itemized deductions + # after the section 68 reduction R, and 10-218(b)(3) subtracts + # the income taxes I net of their pro rata share of R: + # T - R - I + R * I / T, where T is the pre-reduction total. + # With I = T - base this equals base * (1 - R / T). + # A sales election has no income taxes to restore. + total = tax_unit("total_itemized_taxable_income_deductions", period) + reduction = tax_unit("itemized_taxable_income_deductions_reduction", period) + mask = total > 0 + reduction_share = np.zeros_like(total) + reduction_share[mask] = reduction[mask] / total[mask] + base_itemized = base_itemized * (1 - reduction_share) + + p = parameters(period).gov.states.md.tax.income.deductions.itemized + if p.phase_out.applies: + filing_status = tax_unit("filing_status", period) + md_agi = tax_unit("adjusted_gross_income", period) + excess_income = max_(md_agi - p.phase_out.threshold[filing_status], 0) + return max_(base_itemized - excess_income * p.phase_out.rate, 0) + + return base_itemized diff --git a/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py b/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py index d37f3bcde90..b4399bd4e1d 100644 --- a/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py +++ b/policyengine_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.tools.period_branch import has_input class mo_net_state_income_taxes(Variable): @@ -9,6 +10,7 @@ class mo_net_state_income_taxes(Variable): definition_period = YEAR reference = ( "https://dor.mo.gov/forms/MO-A_2021.pdf#page=2", + "https://dor.mo.gov/forms/MO-A_2025.pdf#page=2", "https://revisor.mo.gov/main/OneSection.aspx?section=143.141&bid=7212", ) defined_for = StateCode.MO @@ -35,3 +37,31 @@ def formula(tax_unit, period, parameters): # Pro-rate the income-tax share against the SALT actually deducted # federally after the phase-down (MO-A Part 2 worksheet). return where(uncapped_salt > salt_cap, salt_cap * ratio, uncapped_itax) + + def formula_2025(tax_unit, period, parameters): + simulation = tax_unit.simulation + if has_input(simulation, "state_and_local_sales_or_income_tax", period) and ( + not has_input(simulation, "state_and_local_sales_tax_elected", period) + ): + # Older callers may supply only a placeholder Schedule A amount. + return mo_net_state_income_taxes.formula(tax_unit, period, parameters) + + elects_sales_tax = tax_unit("state_and_local_sales_tax_elected", period) + line_5a = tax_unit("state_and_local_sales_or_income_tax", period) + earnings_taxes = add( + tax_unit, + period, + ["mo_kansas_city_earnings_tax", "mo_st_louis_earnings_tax"], + ) + # MO-A Part 2 line 10 excludes city earnings taxes from the addback. + # The worksheet denominator includes all federal Schedule A line 5d. + net_income_tax = where(elects_sales_tax, 0, max_(line_5a - earnings_taxes, 0)) + gross_salt = tax_unit("salt", period) + deducted_salt = tax_unit("salt_deduction", period) + income_tax_share = np.divide( + net_income_tax, + gross_salt, + out=np.zeros_like(gross_salt), + where=gross_salt > 0, + ) + return deducted_salt * income_tax_share diff --git a/policyengine_us/variables/gov/states/ne/tax/income/deductions/ne_itemized_deductions.py b/policyengine_us/variables/gov/states/ne/tax/income/deductions/ne_itemized_deductions.py index 6205c08b1d3..203dbc44584 100644 --- a/policyengine_us/variables/gov/states/ne/tax/income/deductions/ne_itemized_deductions.py +++ b/policyengine_us/variables/gov/states/ne/tax/income/deductions/ne_itemized_deductions.py @@ -8,6 +8,8 @@ class ne_itemized_deductions(Variable): unit = USD definition_period = YEAR reference = ( + "https://www.nebraskalegislature.gov/laws/statutes.php?statute=77-2716.01", + "https://revenue.nebraska.gov/sites/default/files/doc/tax-forms/2025/f_Individual_Income_Tax_Booklet.pdf#page=14", "https://revenue.nebraska.gov/files/doc/tax-forms/2021/f_1040n_booklet.pdf", "https://revenue.nebraska.gov/files/doc/2022_Ne_Individual_Income_Tax_Booklet_8-307-2022_final_5.pdf", ) @@ -17,3 +19,13 @@ def formula(tax_unit, period, parameters): itm_deds_less_salt = tax_unit("itemized_deductions_less_salt", period) capped_property_taxes = tax_unit("capped_property_taxes", period) return itm_deds_less_salt + capped_property_taxes + + def formula_2025(tax_unit, period, parameters): + federal_itemized = tax_unit("itemized_taxable_income_deductions", period) + elected_sales_tax = tax_unit("state_and_local_sales_tax_elected", period) + line_5a = tax_unit("state_and_local_sales_or_income_tax", period) + # Form 1040N line 8 removes the entire Schedule A line 5a amount + # when it is income tax, even if the federal SALT cap binds. + income_tax = where(elected_sales_tax, 0, line_5a) + # A negative line 9 can never exceed the standard deduction on line 10. + return max_(0, federal_itemized - income_tax) diff --git a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py index 653d63c85dc..ed55bb89d4f 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/deductions/itemized/ny_itemizes.py @@ -1,5 +1,8 @@ from policyengine_us.model_api import * -from policyengine_us.tools.state_itemization import state_itemization_uses_itemized +from policyengine_us.tools.state_itemization import ( + joint_itemization_is_enabled, + state_itemization_uses_itemized, +) class ny_itemizes(Variable): @@ -22,11 +25,13 @@ def formula(tax_unit, period, parameters): return federal_itemizes & (itemized_deductions >= standard_deduction) def formula_2018(tax_unit, period, parameters): - federal = tax_unit("tax_unit_itemizes", period) + automatic = ( + True + if joint_itemization_is_enabled(period, parameters) + else tax_unit("tax_unit_itemizes", period) + ) standard = tax_unit("ny_standard_deduction", period) itemized = tax_unit("ny_itemized_deductions", period) method = tax_unit("state_deduction_method", period) - # Preserve the legacy automatic choice. A filed state method and the - # joint optimizer can select itemization after either federal method. - elects_itemized = state_itemization_uses_itemized(method, federal) + elects_itemized = state_itemization_uses_itemized(method, automatic) return elects_itemized & (itemized >= standard) diff --git a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py index e408e0b256a..a9baea8f76d 100644 --- a/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py +++ b/policyengine_us/variables/gov/states/ny/tax/income/taxable_income/ny_deductions.py @@ -1,6 +1,9 @@ from policyengine_us.model_api import * from policyengine_us.tools.period_branch import has_input -from policyengine_us.tools.state_itemization import state_itemization_uses_itemized +from policyengine_us.tools.state_itemization import ( + joint_itemization_is_enabled, + state_itemization_uses_itemized, +) class ny_deductions(Variable): @@ -21,6 +24,10 @@ def formula(tax_unit, period, parameters): def formula_2018(tax_unit, period, parameters): itemized = tax_unit("ny_itemized_deductions", period) standard = tax_unit("ny_standard_deduction", period) + if joint_itemization_is_enabled(period, parameters): + return where( + tax_unit("ny_itemizes", period), max_(itemized, standard), standard + ) # Retain the historic automatic larger-amount calculation unless a # state election was filed. Section 613 recomputes smaller items. automatic = ( From 58db9c3676e708bf57852fd94a7aa72a9cc49bd3 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 19 Nov 2026 12:56:06 +0000 Subject: [PATCH 11/12] Support weighted itemization preferences and supplied Maryland deductions --- .../core/test_joint_itemization_branches.py | 9 +++++++++ policyengine_us/tools/state_itemization.py | 4 +++- .../deductions/md_itemized_deductions.py | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/policyengine_us/tests/core/test_joint_itemization_branches.py b/policyengine_us/tests/core/test_joint_itemization_branches.py index c759abb8bd7..e53bbd8e0f5 100644 --- a/policyengine_us/tests/core/test_joint_itemization_branches.py +++ b/policyengine_us/tests/core/test_joint_itemization_branches.py @@ -5,6 +5,7 @@ import numpy as np import pytest from hypothesis import assume, example, given, settings, strategies as st +from microdf import MicroSeries from policyengine_core.reforms import Reform from policyengine_us import Simulation @@ -62,6 +63,14 @@ def test_joint_election_requires_a_finite_choice_for_every_unit(): ) +def test_joint_election_accepts_microsimulation_federal_tie_preferences(): + preferences = MicroSeries([False, True, False], weights=[2, 8, 15]) + costs = np.array([[10.0, 10.0, 10.0], [10.0, 10.0, 9.0]]) + np.testing.assert_array_equal( + choose_joint_itemization(costs, (False, True), preferences), [0, 1, 1] + ) + + def test_warm_joint_choice_is_recomputed_for_a_filed_election_in_a_branch(): # The policy examples cover the tax arithmetic. This test exercises the # ordinary runtime after two years of results have already been cached. diff --git a/policyengine_us/tools/state_itemization.py b/policyengine_us/tools/state_itemization.py index 44a8bb779d9..939cc475533 100644 --- a/policyengine_us/tools/state_itemization.py +++ b/policyengine_us/tools/state_itemization.py @@ -60,7 +60,9 @@ def choose_joint_itemization(costs, federal_methods, prefer_federal_itemized): if not np.isfinite(minimum).all(): raise ValueError("Every tax unit needs a legal finite deduction election.") within_cent = costs - minimum <= CENT - same_as_preferred = np.asarray(federal_methods)[:, None] == prefer_federal_itemized + same_as_preferred = np.asarray(federal_methods)[:, None] == np.asarray( + prefer_federal_itemized + ) preferred = within_cent & same_as_preferred return np.where(preferred.any(axis=0), preferred, within_cent).argmax(axis=0) diff --git a/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py b/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py index d11351c8326..b58a03a4f7a 100644 --- a/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py +++ b/policyengine_us/variables/gov/states/md/tax/income/deductions/md_itemized_deductions.py @@ -1,4 +1,6 @@ from policyengine_us.model_api import * +from policyengine_us.tools.period_branch import has_input +from policyengine_us.tools.state_itemization import joint_itemization_is_enabled class md_itemized_deductions(Variable): @@ -34,6 +36,23 @@ def formula(tax_unit, period, parameters): return _limit_deductions(tax_unit, period, parameters, base_itemized) def formula_2025(tax_unit, period, parameters): + simulation = tax_unit.simulation + if ( + has_input(simulation, "capped_property_taxes", period) + and not joint_itemization_is_enabled(period, parameters) + and not any( + has_input(simulation, variable, period) + for variable in ( + "state_and_local_sales_tax_elected", + "state_sales_tax", + "local_sales_tax", + ) + ) + ): + # A supplied capped property amount can stand in for the entire + # eligible SALT component when no sales-tax detail was supplied. + return md_itemized_deductions.formula(tax_unit, period, parameters) + # Form 502 line 17b removes only income taxes. The Comptroller # accepts counting property taxes first under the federal SALT cap. property_tax = min_( From fb7c57e65463bdfe6bbd1d06d89ea3969b54f132 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 22 Nov 2026 08:44:05 +0100 Subject: [PATCH 12/12] Organize resident itemization rules by jurisdiction --- .../federal_itemizers_only.yaml | 13 -------- .../resident_itemization/follows_federal.yaml | 17 ---------- .../independent_states.yaml | 33 ------------------- .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/follows_federal.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/follows_federal.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../federal_itemizers_only.yaml | 10 ++++++ .../federal_itemizers_only.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../federal_itemizers_only.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/follows_federal.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/independent.yaml | 10 ++++++ .../resident_itemization/follows_federal.yaml | 10 ++++++ .../resident_itemization/follows_federal.yaml | 10 ++++++ policyengine_us/tools/state_itemization.py | 28 +++++++++++++--- 25 files changed, 234 insertions(+), 67 deletions(-) delete mode 100644 policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml delete mode 100644 policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml delete mode 100644 policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml create mode 100644 policyengine_us/parameters/gov/states/al/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ar/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/az/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ca/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/dc/tax/income/deductions/resident_itemization/follows_federal.yaml create mode 100644 policyengine_us/parameters/gov/states/de/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ga/tax/income/deductions/resident_itemization/follows_federal.yaml create mode 100644 policyengine_us/parameters/gov/states/hi/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/id/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ks/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ky/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/md/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml create mode 100644 policyengine_us/parameters/gov/states/me/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml create mode 100644 policyengine_us/parameters/gov/states/mn/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/mo/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml create mode 100644 policyengine_us/parameters/gov/states/ms/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/mt/tax/income/deductions/resident_itemization/follows_federal.yaml create mode 100644 policyengine_us/parameters/gov/states/nc/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ny/tax/income/deductions/resident_itemization/independent.yaml create mode 100644 policyengine_us/parameters/gov/states/ok/tax/income/deductions/resident_itemization/follows_federal.yaml create mode 100644 policyengine_us/parameters/gov/states/va/tax/income/deductions/resident_itemization/follows_federal.yaml diff --git a/policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml b/policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml deleted file mode 100644 index a8954500eb6..00000000000 --- a/policyengine_us/parameters/gov/simulation/resident_itemization/federal_itemizers_only.yaml +++ /dev/null @@ -1,13 +0,0 @@ -description: States where full-year residents may choose a state itemized deduction only with federal itemization, with the ordinary separate state standard option subject to state rules. -metadata: - unit: list - label: State itemization requires federal itemization - reference: - - title: 2025 Maryland resident income tax instructions - href: https://www.marylandcomptroller.gov/content/dam/mdcomp/tax/instructions/2025/resident-booklet.pdf - - title: 2025 Maine Form 1040ME instructions - href: https://www.maine.gov/revenue/sites/maine.gov.revenue/files/inline-files/25_1040me_gen_instr_w_cover_pg.pdf - - title: 2025 Missouri Form MO-1040 instructions, Schedule MO-A - href: https://dor.mo.gov/forms/MO-1040%20Instructions_2025.pdf -values: - 2025-01-01: [MD, ME, MO] diff --git a/policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml deleted file mode 100644 index 3577cee20fe..00000000000 --- a/policyengine_us/parameters/gov/simulation/resident_itemization/follows_federal.yaml +++ /dev/null @@ -1,17 +0,0 @@ -description: Jurisdictions with a state deduction that follows the full-year resident's federal standard or itemized deduction method. -metadata: - unit: list - label: State deduction method follows the federal return - reference: - - title: District of Columbia Code section 47-1803.04 - href: https://code.dccouncil.gov/us/dc/council/code/sections/47-1803.04 - - title: 2025 Georgia IT-511 individual income tax booklet - href: https://dor.georgia.gov/document/document/2025-it-511-individual-income-tax-booklet/download - - title: 2025 Montana Form 2 instructions - href: https://revenue.mt.gov/files/forms/Montana-Individual-Income-Tax-Return-Form-2-Instructions/2025_Montana_Individual_Income_Tax_Return_Form_2_Instructions.pdf - - title: 2025 Oklahoma Form 511 instructions - href: https://oklahoma.gov/content/dam/ok/en/tax/documents/forms/individuals/current/511-Pkt.pdf - - title: 2025 Virginia Schedule A instructions - href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf -values: - 2025-01-01: [DC, GA, MT, OK, VA] diff --git a/policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml b/policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml deleted file mode 100644 index ab0954ba38d..00000000000 --- a/policyengine_us/parameters/gov/simulation/resident_itemization/independent_states.yaml +++ /dev/null @@ -1,33 +0,0 @@ -description: States where a full-year resident may take a different standard or itemized deduction method from the federal return. -metadata: - unit: list - label: Independent resident deduction methods - reference: - - title: 2025 Alabama Form 40 instructions - href: https://www.revenue.alabama.gov/wp-content/uploads/2026/01/25f40bk.pdf - - title: 2025 Arkansas Form AR1000F instructions - href: https://www.dfa.arkansas.gov/wp-content/uploads/2025_AR1000F_and_AR1000NR_Instructions.pdf - - title: 2025 Arizona Form 140 instructions - href: https://azdor.gov/sites/default/files/document/FORMS_INDIVIDUAL_2025_140Booklet.pdf - - title: 2025 California Form 540 instructions - href: https://www.ftb.ca.gov/forms/2025/2025-540-instructions.html - - title: 2025 Delaware income tax instructions - href: https://revenuefiles.delaware.gov/2025/PITForms_Instructions/Instructions/PIT-RES_Instructions_2025-01.pdf - - title: 2025 Hawaii Form N-11 instructions - href: https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=15 - - title: 2025 Idaho Form 40 instructions - href: https://tax.idaho.gov/wp-content/uploads/forms/EIN00046/EIN00046_03-02-2026.pdf - - title: 2025 Kansas income tax instructions - href: https://www.ksrevenue.gov/incomebook25.html - - title: 2025 Kentucky Schedule A instructions - href: https://revenue.ky.gov/Forms/740%20Schedule%20A%20%282025%29.pdf - - title: 2025 Minnesota Schedule M1SA - href: https://www.revenue.state.mn.us/sites/default/files/2025-12/m1sa-25_0.pdf - - title: 2025 Mississippi resident return instructions - href: https://www.dor.ms.gov/sites/default/files/tax-forms/individual/80108258%201.pdf - - title: 2025 North Carolina individual income tax instructions - href: https://www.ncdor.gov/taxes-forms/individual-income-tax/filing-topics/north-carolina-standard-deduction-or-north-carolina-itemized-deductions - - title: New York 2025 itemized deductions - href: https://www.tax.ny.gov/pit/file/itemized-deductions-2025.htm -values: - 2025-01-01: [AL, AR, AZ, CA, DE, HI, ID, KS, KY, MN, MS, NC, NY] diff --git a/policyengine_us/parameters/gov/states/al/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/al/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..6bb3fd2402c --- /dev/null +++ b/policyengine_us/parameters/gov/states/al/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Alabama allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Alabama allows independent resident deduction methods + reference: + - title: 2025 Alabama Form 40 instructions + href: https://www.revenue.alabama.gov/wp-content/uploads/2026/01/25f40bk.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ar/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/ar/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..f853fa55f6d --- /dev/null +++ b/policyengine_us/parameters/gov/states/ar/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Arkansas allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Arkansas allows independent resident deduction methods + reference: + - title: 2025 Arkansas Form AR1000F instructions + href: https://www.dfa.arkansas.gov/wp-content/uploads/2025_AR1000F_and_AR1000NR_Instructions.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/az/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/az/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..0d90a89a7c9 --- /dev/null +++ b/policyengine_us/parameters/gov/states/az/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Arizona allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Arizona allows independent resident deduction methods + reference: + - title: 2025 Arizona Form 140 instructions + href: https://azdor.gov/sites/default/files/document/FORMS_INDIVIDUAL_2025_140Booklet.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ca/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/ca/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..88d03af8ee4 --- /dev/null +++ b/policyengine_us/parameters/gov/states/ca/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: California allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: California allows independent resident deduction methods + reference: + - title: 2025 California Form 540 instructions + href: https://www.ftb.ca.gov/forms/2025/2025-540-instructions.html +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/dc/tax/income/deductions/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/states/dc/tax/income/deductions/resident_itemization/follows_federal.yaml new file mode 100644 index 00000000000..c736faf127e --- /dev/null +++ b/policyengine_us/parameters/gov/states/dc/tax/income/deductions/resident_itemization/follows_federal.yaml @@ -0,0 +1,10 @@ +description: The District of Columbia uses the full-year resident's federal standard or itemized deduction method on the state return. +metadata: + unit: bool + period: year + label: The District of Columbia follows the federal deduction method + reference: + - title: District of Columbia Code section 47-1803.04 + href: https://code.dccouncil.gov/us/dc/council/code/sections/47-1803.04 +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/de/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/de/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..cf8042ebcb3 --- /dev/null +++ b/policyengine_us/parameters/gov/states/de/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Delaware allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Delaware allows independent resident deduction methods + reference: + - title: 2025 Delaware income tax instructions + href: https://revenuefiles.delaware.gov/2025/PITForms_Instructions/Instructions/PIT-RES_Instructions_2025-01.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ga/tax/income/deductions/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/states/ga/tax/income/deductions/resident_itemization/follows_federal.yaml new file mode 100644 index 00000000000..7a9c9d8e64a --- /dev/null +++ b/policyengine_us/parameters/gov/states/ga/tax/income/deductions/resident_itemization/follows_federal.yaml @@ -0,0 +1,10 @@ +description: Georgia uses the full-year resident's federal standard or itemized deduction method on the state return. +metadata: + unit: bool + period: year + label: Georgia follows the federal deduction method + reference: + - title: 2025 Georgia IT-511 individual income tax booklet + href: https://dor.georgia.gov/document/document/2025-it-511-individual-income-tax-booklet/download +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/hi/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..3b63dc30682 --- /dev/null +++ b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Hawaii allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Hawaii allows independent resident deduction methods + reference: + - title: 2025 Hawaii Form N-11 instructions + href: https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=15 +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/id/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/id/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..284524dc310 --- /dev/null +++ b/policyengine_us/parameters/gov/states/id/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Idaho allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Idaho allows independent resident deduction methods + reference: + - title: 2025 Idaho Form 40 instructions + href: https://tax.idaho.gov/wp-content/uploads/forms/EIN00046/EIN00046_03-02-2026.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ks/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/ks/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..4254c9533b7 --- /dev/null +++ b/policyengine_us/parameters/gov/states/ks/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Kansas allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Kansas allows independent resident deduction methods + reference: + - title: 2025 Kansas income tax instructions + href: https://www.ksrevenue.gov/incomebook25.html +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ky/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/ky/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..aea6d23f9c7 --- /dev/null +++ b/policyengine_us/parameters/gov/states/ky/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Kentucky allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Kentucky allows independent resident deduction methods + reference: + - title: 2025 Kentucky Schedule A instructions + href: https://revenue.ky.gov/Forms/740%20Schedule%20A%20%282025%29.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/md/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml b/policyengine_us/parameters/gov/states/md/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml new file mode 100644 index 00000000000..6d862d5028b --- /dev/null +++ b/policyengine_us/parameters/gov/states/md/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml @@ -0,0 +1,10 @@ +description: Maryland allows full-year residents to itemize on the state return only if they itemize federally. +metadata: + unit: bool + period: year + label: Maryland requires federal itemization for state itemization + reference: + - title: 2025 Maryland resident income tax instructions + href: https://www.marylandcomptroller.gov/content/dam/mdcomp/tax/instructions/2025/resident-booklet.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/me/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml b/policyengine_us/parameters/gov/states/me/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml new file mode 100644 index 00000000000..9b9b6837c8b --- /dev/null +++ b/policyengine_us/parameters/gov/states/me/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml @@ -0,0 +1,10 @@ +description: Maine allows full-year residents to itemize on the state return only if they itemize federally. +metadata: + unit: bool + period: year + label: Maine requires federal itemization for state itemization + reference: + - title: 2025 Maine Form 1040ME instructions + href: https://www.maine.gov/revenue/sites/maine.gov.revenue/files/inline-files/25_1040me_gen_instr_w_cover_pg.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/mn/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/mn/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..a86e4bfd8e5 --- /dev/null +++ b/policyengine_us/parameters/gov/states/mn/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Minnesota allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Minnesota allows independent resident deduction methods + reference: + - title: 2025 Minnesota Schedule M1SA + href: https://www.revenue.state.mn.us/sites/default/files/2025-12/m1sa-25_0.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/mo/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml b/policyengine_us/parameters/gov/states/mo/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml new file mode 100644 index 00000000000..fdef1fcece3 --- /dev/null +++ b/policyengine_us/parameters/gov/states/mo/tax/income/deductions/resident_itemization/federal_itemizers_only.yaml @@ -0,0 +1,10 @@ +description: Missouri allows full-year residents to itemize on the state return only if they itemize federally. +metadata: + unit: bool + period: year + label: Missouri requires federal itemization for state itemization + reference: + - title: 2025 Missouri Form MO-1040 instructions, Schedule MO-A + href: https://dor.mo.gov/forms/MO-1040%20Instructions_2025.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ms/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/ms/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..80f4c917b46 --- /dev/null +++ b/policyengine_us/parameters/gov/states/ms/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: Mississippi allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: Mississippi allows independent resident deduction methods + reference: + - title: 2025 Mississippi resident return instructions + href: https://www.dor.ms.gov/sites/default/files/tax-forms/individual/80108258%201.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/mt/tax/income/deductions/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/states/mt/tax/income/deductions/resident_itemization/follows_federal.yaml new file mode 100644 index 00000000000..ce8d6648468 --- /dev/null +++ b/policyengine_us/parameters/gov/states/mt/tax/income/deductions/resident_itemization/follows_federal.yaml @@ -0,0 +1,10 @@ +description: Montana uses the full-year resident's federal standard or itemized deduction method on the state return. +metadata: + unit: bool + period: year + label: Montana follows the federal deduction method + reference: + - title: 2025 Montana Form 2 instructions + href: https://revenue.mt.gov/files/forms/Montana-Individual-Income-Tax-Return-Form-2-Instructions/2025_Montana_Individual_Income_Tax_Return_Form_2_Instructions.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/nc/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/nc/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..c39e7729a22 --- /dev/null +++ b/policyengine_us/parameters/gov/states/nc/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: North Carolina allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: North Carolina allows independent resident deduction methods + reference: + - title: 2025 North Carolina individual income tax instructions + href: https://www.ncdor.gov/taxes-forms/individual-income-tax/filing-topics/north-carolina-standard-deduction-or-north-carolina-itemized-deductions +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ny/tax/income/deductions/resident_itemization/independent.yaml b/policyengine_us/parameters/gov/states/ny/tax/income/deductions/resident_itemization/independent.yaml new file mode 100644 index 00000000000..093cf263a19 --- /dev/null +++ b/policyengine_us/parameters/gov/states/ny/tax/income/deductions/resident_itemization/independent.yaml @@ -0,0 +1,10 @@ +description: New York allows full-year residents to use a different deduction method on the state return, subject to state eligibility rules. +metadata: + unit: bool + period: year + label: New York allows independent resident deduction methods + reference: + - title: New York 2025 itemized deductions + href: https://www.tax.ny.gov/pit/file/itemized-deductions-2025.htm +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/ok/tax/income/deductions/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/states/ok/tax/income/deductions/resident_itemization/follows_federal.yaml new file mode 100644 index 00000000000..16c1116762b --- /dev/null +++ b/policyengine_us/parameters/gov/states/ok/tax/income/deductions/resident_itemization/follows_federal.yaml @@ -0,0 +1,10 @@ +description: Oklahoma uses the full-year resident's federal standard or itemized deduction method on the state return. +metadata: + unit: bool + period: year + label: Oklahoma follows the federal deduction method + reference: + - title: 2025 Oklahoma Form 511 instructions + href: https://oklahoma.gov/content/dam/ok/en/tax/documents/forms/individuals/current/511-Pkt.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/parameters/gov/states/va/tax/income/deductions/resident_itemization/follows_federal.yaml b/policyengine_us/parameters/gov/states/va/tax/income/deductions/resident_itemization/follows_federal.yaml new file mode 100644 index 00000000000..79146b4e749 --- /dev/null +++ b/policyengine_us/parameters/gov/states/va/tax/income/deductions/resident_itemization/follows_federal.yaml @@ -0,0 +1,10 @@ +description: Virginia uses the full-year resident's federal standard or itemized deduction method on the state return. +metadata: + unit: bool + period: year + label: Virginia follows the federal deduction method + reference: + - title: 2025 Virginia Schedule A instructions + href: https://www.tax.virginia.gov/sites/default/files/vatax-pdf/2025-sch-a-instructions.pdf +values: + 2025-01-01: true diff --git a/policyengine_us/tools/state_itemization.py b/policyengine_us/tools/state_itemization.py index 939cc475533..b1311a34ce8 100644 --- a/policyengine_us/tools/state_itemization.py +++ b/policyengine_us/tools/state_itemization.py @@ -1,6 +1,7 @@ from itertools import product import numpy as np +from policyengine_core.errors import ParameterNotFoundError from policyengine_us.tools.period_branch import get_override_branch, has_input from policyengine_us.variables.gov.states.tax.income.state_deduction_method import ( @@ -67,16 +68,35 @@ def choose_joint_itemization(costs, federal_methods, prefer_federal_itemized): return np.where(preferred.any(axis=0), preferred, within_cent).argmax(axis=0) +def _resident_itemization_masks(state, state_parameters): + states_by_rule = { + "independent": [], + "federal_itemizers_only": [], + "follows_federal": [], + } + for jurisdiction in state_parameters: + try: + state_tax = getattr(state_parameters, jurisdiction).tax.income + rule = state_tax.deductions.resident_itemization + except ParameterNotFoundError: + continue + for name, jurisdictions in states_by_rule.items(): + if getattr(rule, name, False): + jurisdictions.append(jurisdiction.upper()) + return tuple( + np.isin(state, jurisdictions) for jurisdictions in states_by_rule.values() + ) + + def joint_itemization(tax_unit, period, parameters): """Evaluate 2025 full-year resident deduction elections on isolated branches.""" if not tax_unit.count: return np.empty(0, dtype=np.int32) sim = tax_unit.simulation state = tax_unit.household("state_code_str", period) - p = parameters(period).gov.simulation.resident_itemization - independent = np.isin(state, p.independent_states) - federal_itemizers_only = np.isin(state, p.federal_itemizers_only) - follows_federal = np.isin(state, p.follows_federal) + independent, federal_itemizers_only, follows_federal = _resident_itemization_masks( + state, parameters(period).gov.states + ) elected_state = independent | federal_itemizers_only status = tax_unit("filing_status", period) requires_federal_itemizing = (status == status.possible_values.SEPARATE) & tax_unit(