diff --git a/changelog.d/hi-claim-of-right.added.md b/changelog.d/hi-claim-of-right.added.md new file mode 100644 index 00000000000..8c431e6f804 --- /dev/null +++ b/changelog.d/hi-claim-of-right.added.md @@ -0,0 +1 @@ +Model Hawaii's claim of right relief: from 2022 the section 1341 lesser-of computed on Hawaii tax with the Form N-364 refundable credit, and repayments as 2% miscellaneous itemized deductions otherwise (through 2025). diff --git a/policyengine_us/parameters/gov/states/hi/tax/income/claim_of_right/section_1341_operative.yaml b/policyengine_us/parameters/gov/states/hi/tax/income/claim_of_right/section_1341_operative.yaml new file mode 100644 index 00000000000..5a0e7b8c2ee --- /dev/null +++ b/policyengine_us/parameters/gov/states/hi/tax/income/claim_of_right/section_1341_operative.yaml @@ -0,0 +1,15 @@ +description: Hawaii applies the claim of right computation of section 1341 of the Internal Revenue Code, using Hawaii tax, if this is true. +values: + 2018-01-01: false + 2022-01-01: true +metadata: + unit: bool + period: year + label: Hawaii section 1341 claim of right computation operative + reference: + - title: "Act 56, SLH 2023, sections 2 and 7(1) (HRS 235-2.3(b)(40); taxable years beginning after December 31, 2021) #page 3,5" + href: https://data.capitol.hawaii.gov/sessions/sessionlaws/Years/SLH2023/SLH2023_Act56.pdf#page=3 + - title: "Act 35, SLH 2026 (HB2329 CD1), HRS 235-2.3(b)(45)" + href: https://data.capitol.hawaii.gov/sessions/session2026/bills/HB2329_CD1_.pdf#page=11 + - title: 2025 Form N-364, Claim of Right Tax Credit + href: https://files.hawaii.gov/tax/forms/2025/n364_i.pdf diff --git a/policyengine_us/parameters/gov/states/hi/tax/income/credits/refundable.yaml b/policyengine_us/parameters/gov/states/hi/tax/income/credits/refundable.yaml index 990f08587c1..9fdfcdb589c 100644 --- a/policyengine_us/parameters/gov/states/hi/tax/income/credits/refundable.yaml +++ b/policyengine_us/parameters/gov/states/hi/tax/income/credits/refundable.yaml @@ -13,12 +13,14 @@ values: - hi_food_excise_credit - hi_cdcc - hi_tax_credit_for_low_income_household_renters + - hi_claim_of_right_credit 2023-01-01: - hi_food_excise_credit - hi_cdcc - hi_tax_credit_for_low_income_household_renters - hi_eitc + - hi_claim_of_right_credit metadata: unit: list diff --git a/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/miscellaneous_deductions_allowed.yaml b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/miscellaneous_deductions_allowed.yaml new file mode 100644 index 00000000000..7a4329a476b --- /dev/null +++ b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/miscellaneous_deductions_allowed.yaml @@ -0,0 +1,17 @@ +description: Hawaii allows miscellaneous itemized deductions above two percent of Hawaii adjusted gross income, if this is true. +values: + 2018-01-01: true + 2026-01-01: false +metadata: + unit: bool + period: year + label: Hawaii miscellaneous itemized deductions allowed + reference: + - title: HRS 235-2.4(b) before 2026 (section 67 operative; the suspension in section 67(g) not operative) + href: https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=11 + - title: "Act 35, SLH 2026 (HB2329 CD1), deleting that sentence, so section 67(h) applies; taxable years beginning after December 31, 2025 #page 17-18,34" + href: https://data.capitol.hawaii.gov/sessions/session2026/bills/HB2329_CD1_.pdf#page=17 + - title: Hawaii Department of Taxation Announcement 2026-06 (conformity to IRC section 67(h), which disallows miscellaneous itemized deductions) + href: https://files.hawaii.gov/tax/news/announce/ann26-06.pdf#page=2 + - title: "2025 Form N-11 instructions, line 21f and Worksheet A-6 #page 19,34" + href: https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=19 diff --git a/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/sources.yaml b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/sources.yaml index 20406023cc9..85c1c489dd7 100644 --- a/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/sources.yaml +++ b/policyengine_us/parameters/gov/states/hi/tax/income/deductions/itemized/sources.yaml @@ -6,6 +6,7 @@ values: - hi_interest_deduction - hi_casualty_loss_deduction - hi_salt_deduction + - hi_claim_of_right_deduction metadata: unit: list period: year diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit_applies.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit_applies.yaml new file mode 100644 index 00000000000..b66b29e82ff --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit_applies.yaml @@ -0,0 +1,103 @@ +# Hawaii: section 1341 operative from 2022 (Act 56, SLH 2023, sections 2 and +# 7(1)), with the credit figured on Form N-364 from prior-year Hawaii tax and +# "whichever results in the least tax". Before 2022, and for repayments of +# $3,000 or less, a repayment is a miscellaneous itemized deduction above 2% of +# Hawaii AGI (Worksheet A-6) while Hawaii allows those (through 2025; Act 35, +# SLH 2026). This file follows the statute for 2022-2025; the 2022-2025 N-11 +# instructions list the items the other way round (see the PR). + +- name: Case 1, the Hawaii credit method gives the prior-year Hawaii tax decrease as a credit and no deduction. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_credit_applies: true + hi_claim_of_right_prior_year_tax_decrease: 600 + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_section_1341_eligible: true + hi_claim_of_right_credit: 600 + hi_claim_of_right_deduction: 0 + +- name: Case 2, the Hawaii deduction method deducts the whole repayment outside the 2% floor. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 50_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_credit_applies: false + hi_claim_of_right_prior_year_tax_decrease: 600 + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_credit: 0 + hi_claim_of_right_deduction: 10_000 + +# Wages $60,000, repays $10,000; the earlier year's Hawaii tax would fall by +# $1,500. Deducting $10,000 saves at most 11% x $10,000 = $1,100, the top +# Hawaii rate, so the credit gives less tax. +- name: Case 8, Hawaii uses the credit when the earlier year's Hawaii tax decrease exceeds what the deduction saves. + absolute_error_margin: 0.01 + period: 2025 + input: + people: + head: + age: 40 + employment_income: 60_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_prior_year_tax_decrease: 1_500 + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_credit_applies: true + hi_claim_of_right_credit: 1_500 + hi_claim_of_right_deduction: 0 + hi_income_tax: 1_529.86 + +# Wages $100,000, $20,000 of charity, repays $10,000; the earlier year's Hawaii +# tax would fall by $100. The filer itemizes either way, and $10,000 of +# deduction saves at least 1.4% x $10,000 = $140, the lowest Hawaii rate, so +# the deduction gives less tax. +- name: Case 9, Hawaii uses the deduction when it saves more than the prior-year decrease. + absolute_error_margin: 0.01 + period: 2025 + input: + people: + head: + age: 40 + employment_income: 100_000 + charitable_cash_donations: 20_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_prior_year_tax_decrease: 100 + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_credit_applies: false + hi_claim_of_right_deduction: 10_000 + hi_claim_of_right_credit: 0 + hi_income_tax: 4_124.26 diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.yaml new file mode 100644 index 00000000000..72713a16239 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.yaml @@ -0,0 +1,139 @@ +# Hawaii: section 1341 operative from 2022 (Act 56, SLH 2023, sections 2 and +# 7(1)), with the credit figured on Form N-364 from prior-year Hawaii tax and +# "whichever results in the least tax". Before 2022, and for repayments of +# $3,000 or less, a repayment is a miscellaneous itemized deduction above 2% of +# Hawaii AGI (Worksheet A-6) while Hawaii allows those (through 2025; Act 35, +# SLH 2026). This file follows the statute for 2022-2025; the 2022-2025 N-11 +# instructions list the items the other way round (see the PR). + +# Wages $50,000, so Hawaii AGI $50,000 and the 2% floor is $1,000. +- name: Case 3, a repayment of $3,000 is a miscellaneous deduction above 2% of Hawaii AGI. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 50_000 + claim_of_right_repayment: 3_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + state_code: HI + output: + hi_agi: 50_000 + hi_claim_of_right_section_1341_eligible: false + hi_claim_of_right_deduction: 2_000 + hi_claim_of_right_credit: 0 + +# Before 2022 section 1341 is excluded in Hawaii; the 2018-2021 N-11 +# instructions: "Repayments under a claim of right over $3,000 are subject to +# the 2% limitation for Hawaii income tax purposes." +- name: Case 4, in 2021 a $10,000 repayment is floored at 2% of Hawaii AGI and gets no credit. + period: 2021 + input: + people: + head: + age: 40 + employment_income: 50_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_prior_year_tax_decrease: 600 + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_section_1341_eligible: false + hi_claim_of_right_credit_applies: false + hi_claim_of_right_deduction: 9_000 + hi_claim_of_right_credit: 0 + +- name: Case 5, from 2026 a repayment of $3,000 or less is not deductible. + period: 2026 + input: + people: + head: + age: 40 + employment_income: 50_000 + claim_of_right_repayment: 2_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_deduction: 0 + +- name: Case 6, a repayment of income Hawaii never taxed gets neither a deduction nor a credit. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 50_000 + claim_of_right_repayment: 10_000 + hi_claim_of_right_repayment_excluded_from_income: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_prior_year_tax_decrease: 600 + households: + household: + members: [head] + state_code: HI + output: + hi_claim_of_right_repayment: 0 + hi_claim_of_right_deduction: 0 + hi_claim_of_right_credit: 0 + +- name: Case 7, a joint return counts both spouses' repayments toward $3,000 but not a dependent's. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 2_000 + spouse: + age: 40 + claim_of_right_repayment: 2_000 + child: + age: 17 + claim_of_right_repayment: 5_000 + tax_units: + tax_unit: + members: [head, spouse, child] + hi_claim_of_right_credit_applies: false + households: + household: + members: [head, spouse, child] + state_code: HI + output: + hi_claim_of_right_repayment: 4_000 + hi_claim_of_right_section_1341_eligible: true + hi_claim_of_right_deduction: 4_000 + +- name: Case 10, outside Hawaii. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_prior_year_tax_decrease: 600 + households: + household: + members: [head] + state_code: CA + output: + hi_claim_of_right_deduction: 0 + hi_claim_of_right_credit: 0 diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_income_tax.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_income_tax.yaml new file mode 100644 index 00000000000..515d7a97782 --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/claim_of_right/hi_income_tax.yaml @@ -0,0 +1,168 @@ +# HRS 235-91.5 requires refundable credits before nonrefundable credits. +# In 2022 the Hawaii EITC is nonrefundable, so claim-of-right relief can +# displace it. These households receive no TANF. Form N-11 lines 27, 33-36 and N-364's lesser-tax comparison: +# https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=60 +# https://files.hawaii.gov/tax/forms/2022/n11ins.pdf#page=21 +# https://files.hawaii.gov/tax/forms/2025/n364_i.pdf + +- name: 2022 head of household at 22500 owes no Hawaii tax without a repayment + absolute_error_margin: 0.01 + period: 2022 + input: + people: + head: + age: 40 + employment_income: 22_500 + child: + age: 5 + tax_units: + tax_unit: + members: [head, child] + filing_status: HEAD_OF_HOUSEHOLD + spm_units: + spm_unit: + members: [head, child] + tanf: 0 + households: + household: + members: [head, child] + state_code: HI + output: + # Tax 728 less food/excise credit 110 leaves only 618 for the EITC. + hi_income_tax: 0 + hi_income_tax_before_non_refundable_credits: 728 + hi_food_excise_credit: 110 + hi_eitc_potential: 670.85 + hi_eitc: 618 + +- name: 2022 repayment at 22500 gives zero relief and ties keep the deduction + absolute_error_margin: 0.01 + period: 2022 + input: + people: + head: + age: 40 + employment_income: 22_500 + claim_of_right_repayment: 10_000 + child: + age: 5 + tax_units: + tax_unit: + members: [head, child] + filing_status: HEAD_OF_HOUSEHOLD + hi_claim_of_right_prior_year_tax_decrease: 600 + spm_units: + spm_unit: + members: [head, child] + tanf: 0 + households: + household: + members: [head, child] + state_code: HI + output: + # Both methods end at zero, matching the no-repayment case above. + hi_income_tax: 0 + hi_income_tax_if_claiming_claim_of_right_credit: 0 + hi_income_tax_if_claiming_claim_of_right_deduction: 0 + hi_claim_of_right_credit_applies: false + hi_claim_of_right_deduction: 10_000 + hi_claim_of_right_credit: 0 + +- name: 2022 fixed credit at 22500 displaces the nonrefundable EITC + absolute_error_margin: 0.01 + period: 2022 + input: + people: + head: + age: 40 + employment_income: 22_500 + claim_of_right_repayment: 10_000 + child: + age: 5 + tax_units: + tax_unit: + members: [head, child] + filing_status: HEAD_OF_HOUSEHOLD + hi_claim_of_right_credit_applies: true + hi_claim_of_right_prior_year_tax_decrease: 600 + spm_units: + spm_unit: + members: [head, child] + tanf: 0 + households: + household: + members: [head, child] + state_code: HI + output: + # Line 34 = 728 - (110 + 600) = 18, the cap on the EITC. + hi_income_tax: 0 + hi_income_tax_before_non_refundable_credits: 728 + hi_refundable_credits: 710 + hi_eitc_potential: 670.85 + hi_eitc: 18 + hi_non_refundable_credits: 18 + hi_claim_of_right_credit: 600 + hi_claim_of_right_deduction: 0 + +- name: 2022 credit at 15000 refunds the excess after displacing the EITC + absolute_error_margin: 0.01 + period: 2022 + input: + people: + head: + age: 40 + employment_income: 15_000 + claim_of_right_repayment: 10_000 + child: + age: 5 + tax_units: + tax_unit: + members: [head, child] + filing_status: HEAD_OF_HOUSEHOLD + hi_claim_of_right_prior_year_tax_decrease: 600 + spm_units: + spm_unit: + members: [head, child] + tanf: 0 + households: + household: + members: [head, child] + state_code: HI + output: + # Line 34 = 292.10 - (140 + 600) = -447.90; no EITC can be used. + hi_income_tax: -447.90 + hi_income_tax_before_non_refundable_credits: 292.10 + hi_refundable_credits: 740 + hi_eitc: 0 + hi_claim_of_right_credit_applies: true + hi_claim_of_right_credit: 600 + hi_claim_of_right_deduction: 0 + +# Section 1341(b)(1), as operative in Hawaii: the prior-year decrease in +# excess of current tax is refunded. No other Hawaii credit enters this case. +- name: 2025 claim of right credit refunds its excess over Hawaii tax + absolute_error_margin: 0.01 + period: 2025 + input: + people: + head: + age: 40 + employment_income: 40_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + hi_claim_of_right_prior_year_tax_decrease: 3_000 + households: + household: + members: [head] + state_code: HI + output: + # Tax without the deduction 1,570.21 less the 3,000 decrease. + hi_income_tax: -1_429.79 + hi_income_tax_before_non_refundable_credits: 1_570.21 + hi_refundable_credits: 3_000 + hi_non_refundable_credits: 0 + hi_claim_of_right_credit_applies: true + hi_claim_of_right_credit: 3_000 + hi_claim_of_right_deduction: 0 diff --git a/policyengine_us/tests/unit/test_claim_of_right_section_1341_properties.py b/policyengine_us/tests/unit/test_claim_of_right_section_1341_properties.py index 022de486265..c693c2a1ac8 100644 --- a/policyengine_us/tests/unit/test_claim_of_right_section_1341_properties.py +++ b/policyengine_us/tests/unit/test_claim_of_right_section_1341_properties.py @@ -40,10 +40,12 @@ its payment is the prior-year increase when the credit method applies and zero otherwise. -Last, one itemizing household per state: the credit method reduces the federal -tax deductible in Alabama, Missouri and Oregon, so their state taxes can rise. -Other states' taxes stay unchanged for this household (no state input is -supplied). The deduction method leaves Arizona's and Kansas's taxes unchanged. +Last, one itemizing household per state: with the credit method fixed, the +repayment reduces the federal tax deductible in Alabama, Missouri and Oregon, so +their state taxes can rise; it lowers the tax of each state listed in +STATES_WITH_RELIEF_UNDER_THE_CREDIT whose rule is in the model; and it leaves +every other state's income tax unchanged (section 1341(b)(3)). With the +deduction method fixed it leaves Arizona's and Kansas's taxes unchanged. """ import gc @@ -89,6 +91,28 @@ # deduction: A.R.S. 43-1021(9) and K.S.A. 79-32,120(a). # California carries the federal deduction in Schedule CA column A. STATES_WITHOUT_THE_DEDUCTION = ["AZ", "KS"] +# States whose own claim of right relief applies when federal tax is computed +# with the section 1341 credit, and the variable that carries it. Under the +# credit method these lower the household's state tax. A listed state whose +# variable is not in the model yet must not change. +STATES_WITH_RELIEF_UNDER_THE_CREDIT = { + # Ark. Code 26-51-457: a deduction whichever federal method applies. + "AR": "ar_claim_of_right_deduction", + # Act 56, SLH 2023: section 1341 computed on Hawaii tax, independently. + "HI": "hi_claim_of_right_credit", + # 35 ILCS 5/203(a)(2)(P): the deduction used to compute the federal credit. + "IL": "il_claim_of_right_subtraction", + # IC 6-3-1-3.5(a)(22). + "IN": "in_claim_of_right_deduction", + # M.G.L. c. 62, s. 3(B)(a)(14). + "MA": "ma_claim_of_right_deduction", + # N.J.S.A. 54A:5-2 and TAM 2011-7: an offset within the income category. + "NJ": "nj_claim_of_right_offset", + # R.C. 5747.01(A)(12). + "OH": "oh_claim_of_right_deduction", + # IT-140 Schedule M, IRC 1341 Repayments. + "WV": "wv_claim_of_right_subtraction", +} BRANCHES = [ "income_tax_if_claiming_claim_of_right_deduction", "income_tax_if_claiming_claim_of_right_credit", @@ -304,8 +328,8 @@ def test_north_carolina_follows_the_federal_method(results, year): ) -def state_income_tax(year, repayment, method=None): - """State income tax of an itemizing single filer in each state.""" +def state_simulation(year, repayment, method=None): + """An itemizing single filer in each state.""" situation = {"people": {}, "tax_units": {}, "households": {}} for i, state in enumerate(STATES): situation["people"][f"p{i}"] = { @@ -326,20 +350,32 @@ def state_income_tax(year, repayment, method=None): "members": [f"p{i}"], "state_code": {year: state}, } - simulation = Simulation(situation=situation) + return Simulation(situation=situation) + + +def state_income_tax(simulation, year): return np.asarray(simulation.calculate("state_income_tax", year)) def test_states_under_each_federal_method(): # One year: each of these three simulations computes every state's tax. year = YEARS[0] - without_repayment = state_income_tax(year, 0) - with_credit = state_income_tax(year, 10_000, method=True) + without_repayment = state_income_tax(state_simulation(year, 0), year) + credit = state_simulation(year, 10_000, method=True) + with_credit = state_income_tax(credit, year) + variables = credit.tax_benefit_system.variables + relief = np.isin( + STATES, + [ + state + for state, variable in STATES_WITH_RELIEF_UNDER_THE_CREDIT.items() + if variable in variables + ], + ) federal_tax_deduction_states = np.isin(STATES, ["AL", "MO", "OR"]) + unchanged = ~relief & ~federal_tax_deduction_states np.testing.assert_allclose( - with_credit[~federal_tax_deduction_states], - without_repayment[~federal_tax_deduction_states], - atol=TOLERANCE, + with_credit[unchanged], without_repayment[unchanged], atol=TOLERANCE ) assert np.all( with_credit[federal_tax_deduction_states] @@ -349,7 +385,12 @@ def test_states_under_each_federal_method(): with_credit[federal_tax_deduction_states] > without_repayment[federal_tax_deduction_states] + TOLERANCE ) - with_deduction = state_income_tax(year, 10_000, method=False) + assert np.all(with_credit[relief] < without_repayment[relief] - 1), ( + "each listed state's own rule should lower its tax under the credit method" + ) + with_deduction = state_income_tax( + state_simulation(year, 10_000, method=False), year + ) assert np.any(np.abs(with_deduction - without_repayment) > 1), ( "the deduction should reach the states that follow federal itemized deductions" ) diff --git a/policyengine_us/tests/unit/test_hi_claim_of_right_properties.py b/policyengine_us/tests/unit/test_hi_claim_of_right_properties.py new file mode 100644 index 00000000000..777440c9549 --- /dev/null +++ b/policyengine_us/tests/unit/test_hi_claim_of_right_properties.py @@ -0,0 +1,180 @@ +"""Properties of Hawaii's claim of right deduction and credit. + +From 2022 section 1341 is operative in Hawaii (Act 56, SLH 2023): Hawaii tax is +the lesser of the tax with a deduction for a repayment over $3,000 and the tax +without it less the decrease in prior-year Hawaii tax (Form N-364), a +refundable credit. Otherwise a repayment is a miscellaneous itemized deduction +above 2% of Hawaii AGI while Hawaii allows those (through 2025). The policy +cases are in YAML. Hawaii picks the method by computing Hawaii tax in two +override branches, so these tests compare the model with independent +simulations that fix the method as an input, over a grid for 2021, 2025 and +2026: + +- the lesser-of rule: Hawaii income tax equals the smaller of the tax with the + deduction method fixed and the tax with the credit method fixed, ties going + to the deduction, and the branches equal those simulations; +- the deduction is the whole repayment or nothing and the credit is the whole + decrease or nothing when section 1341 applies, never both; before 2022 there + is never a credit; +- Hawaii tax does not depend on the federal method, never rises with a + repayment, and never rises as the repayment or the prior-year decrease grows. +""" + +import gc +import itertools + +import numpy as np +import pytest + +from policyengine_us import Simulation + +YEARS = [2021, 2025, 2026] +REPAYMENTS = [0, 2_000, 3_000, 3_001, 10_000, 60_000] +DECREASES = [0, 300, 3_000] +WAGES = [30_000, 100_000, 400_000] +CHARITY = [0, 30_000] +AXES = [REPAYMENTS, DECREASES, WAGES, CHARITY] +GRID = list(itertools.product(*AXES)) +SHAPE = tuple(len(axis) for axis in AXES) +REPAYMENT, DECREASE, WAGE, CHARITABLE = ( + np.array([point[i] for point in GRID], dtype=float) for i in range(len(AXES)) +) +ZEROS = np.zeros_like(REPAYMENT) +THRESHOLD = 3_000 +TOLERANCE = 0.01 + + +def grid_simulation(year, repayment=REPAYMENT, tax_unit_inputs=None): + """One single Hawaii filer per grid point.""" + situation = {"people": {}, "tax_units": {}, "households": {}} + for i in range(len(GRID)): + person = f"p{i}" + situation["people"][person] = { + "age": {year: 40}, + "employment_income": {year: WAGE[i]}, + "charitable_cash_donations": {year: CHARITABLE[i]}, + "claim_of_right_repayment": {year: float(repayment[i])}, + } + tax_unit = { + "members": [person], + "hi_claim_of_right_prior_year_tax_decrease": {year: float(DECREASE[i])}, + "claim_of_right_prior_year_tax_decrease": {year: float(DECREASE[i])}, + } + for name, value in (tax_unit_inputs or {}).items(): + tax_unit[name] = {year: value} + situation["tax_units"][f"t{i}"] = tax_unit + situation["households"][f"h{i}"] = { + "members": [person], + "state_code": {year: "HI"}, + } + return Simulation(situation=situation) + + +def calculate(simulation, year, variables): + return {v: np.asarray(simulation.calculate(v, year)) for v in variables} + + +@pytest.fixture(scope="module") +def results(): + out = {} + for year in YEARS: + r = calculate( + grid_simulation(year), + year, + [ + "hi_income_tax", + "hi_claim_of_right_section_1341_eligible", + "hi_claim_of_right_credit_applies", + "hi_claim_of_right_deduction", + "hi_claim_of_right_credit", + "hi_income_tax_if_claiming_claim_of_right_credit", + "hi_income_tax_if_claiming_claim_of_right_deduction", + ], + ) + r["tax_with_credit"] = calculate( + grid_simulation( + year, tax_unit_inputs={"hi_claim_of_right_credit_applies": True} + ), + year, + ["hi_income_tax"], + )["hi_income_tax"] + r["tax_with_deduction"] = calculate( + grid_simulation( + year, tax_unit_inputs={"hi_claim_of_right_credit_applies": False} + ), + year, + ["hi_income_tax"], + )["hi_income_tax"] + r["tax_without_repayment"] = calculate( + grid_simulation(year, ZEROS), year, ["hi_income_tax"] + )["hi_income_tax"] + r["tax_federal_credit"] = calculate( + grid_simulation( + year, tax_unit_inputs={"claim_of_right_credit_applies": True} + ), + year, + ["hi_income_tax"], + )["hi_income_tax"] + out[year] = r + yield out + gc.collect() + + +@pytest.mark.parametrize("year", YEARS) +def test_tax_is_the_lesser_of_the_two_methods(results, year): + r = results[year] + eligible = r["hi_claim_of_right_section_1341_eligible"] + np.testing.assert_array_equal(eligible, (REPAYMENT > THRESHOLD) & (year >= 2022)) + credit = eligible & ( + np.round(r["tax_with_credit"], 2) < np.round(r["tax_with_deduction"], 2) + ) + np.testing.assert_array_equal(r["hi_claim_of_right_credit_applies"], credit) + expected = np.where(credit, r["tax_with_credit"], r["tax_with_deduction"]) + np.testing.assert_allclose(r["hi_income_tax"], expected, atol=TOLERANCE) + if year >= 2022: + assert credit.any() and (eligible & ~credit).any(), "both methods occur" + + +@pytest.mark.parametrize("year", [2025, 2026]) +def test_branches_match_independent_simulations(results, year): + r = results[year] + eligible = r["hi_claim_of_right_section_1341_eligible"] + np.testing.assert_allclose( + r["hi_income_tax_if_claiming_claim_of_right_credit"][eligible], + r["tax_with_credit"][eligible], + atol=TOLERANCE, + ) + np.testing.assert_allclose( + r["hi_income_tax_if_claiming_claim_of_right_deduction"][eligible], + r["tax_with_deduction"][eligible], + atol=TOLERANCE, + ) + + +@pytest.mark.parametrize("year", YEARS) +def test_deduction_and_credit_are_exclusive(results, year): + r = results[year] + eligible = r["hi_claim_of_right_section_1341_eligible"] + credit_applies = r["hi_claim_of_right_credit_applies"] + deduction, credit = r["hi_claim_of_right_deduction"], r["hi_claim_of_right_credit"] + np.testing.assert_allclose( + deduction[eligible & ~credit_applies], REPAYMENT[eligible & ~credit_applies] + ) + np.testing.assert_allclose(deduction[credit_applies], 0) + np.testing.assert_allclose(credit, np.where(credit_applies, DECREASE, 0)) + assert not np.any((deduction > 0) & (credit > 0)) + assert np.all(deduction <= REPAYMENT + TOLERANCE) + if year < 2022: + assert not credit_applies.any() and np.all(credit == 0) + + +@pytest.mark.parametrize("year", YEARS) +def test_tax_ignores_the_federal_method_and_never_rises(results, year): + r = results[year] + np.testing.assert_allclose( + r["tax_federal_credit"], r["hi_income_tax"], atol=TOLERANCE + ) + assert np.all(r["hi_income_tax"] <= r["tax_without_repayment"] + TOLERANCE) + table = r["hi_income_tax"].reshape(SHAPE) + assert np.all(np.diff(table, axis=0) <= TOLERANCE), "rises with the repayment" + assert np.all(np.diff(table, axis=1) <= TOLERANCE), "rises with the decrease" diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit.py new file mode 100644 index 00000000000..c3039efd17e --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit.py @@ -0,0 +1,26 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_credit(Variable): + value_type = float + entity = TaxUnit + label = "Hawaii claim of right tax credit" + unit = USD + documentation = ( + "When Hawaii tax is computed under section 1341(a)(5), the decrease " + "in prior-year Hawaii tax from excluding the repaid income (Form " + "N-364, line 6). It is a refundable credit (Schedule CR, line 9)." + ) + definition_period = YEAR + reference = ( + "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf", + # 2025 Schedule CR, Part I, line 9 + "https://files.hawaii.gov/tax/forms/2025/schcr_i.pdf", + ) + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + eligible = tax_unit("hi_claim_of_right_section_1341_eligible", period) + credit_applies = tax_unit("hi_claim_of_right_credit_applies", period) + decrease = tax_unit("hi_claim_of_right_prior_year_tax_decrease", period) + return where(eligible & credit_applies, decrease, 0) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit_applies.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit_applies.py new file mode 100644 index 00000000000..49d20064054 --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_credit_applies.py @@ -0,0 +1,40 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_credit_applies(Variable): + value_type = bool + entity = TaxUnit + label = "Hawaii tax is computed with the claim of right tax credit" + documentation = ( + "Whether Hawaii income tax for the year of repayment is computed " + "under section 1341(a)(5) as operative in Hawaii: the tax without a " + "deduction for the repayment, less the decrease in prior-year Hawaii " + "tax (the Form N-364 credit). Hawaii tax is the lesser of this and " + "the tax with the deduction, whichever federal method applies; " + "equal amounts use the deduction." + ) + definition_period = YEAR + reference = ( + "https://data.capitol.hawaii.gov/sessions/sessionlaws/Years/SLH2023/SLH2023_Act56.pdf#page=3", + "https://www.govinfo.gov/content/pkg/USCODE-2024-title26/html/USCODE-2024-title26-subtitleA-chap1-subchapQ-partV-sec1341.htm", + # 2025 Form N-364 instructions: "whichever results in the least tax", + # using the Hawaii tax rate. + "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf", + ) + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + eligible = tax_unit("hi_claim_of_right_section_1341_eligible", period) + if not eligible.any(): + # Comparing the two methods takes two more Hawaii tax + # computations; skip them when no tax unit qualifies. + return np.zeros(tax_unit.count, dtype=bool) + tax_if_credit = tax_unit( + "hi_income_tax_if_claiming_claim_of_right_credit", period + ) + tax_if_deduction = tax_unit( + "hi_income_tax_if_claiming_claim_of_right_deduction", period + ) + # Ties go to the deduction (26 CFR 1.1341-1(b)(3)); comparing to the + # cent keeps floating-point noise from deciding a tie. + return eligible & (np.round(tax_if_credit, 2) < np.round(tax_if_deduction, 2)) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.py new file mode 100644 index 00000000000..e96c7db863e --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.py @@ -0,0 +1,48 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_deduction(Variable): + value_type = float + entity = TaxUnit + label = "Hawaii claim of right repayment itemized deduction" + unit = USD + documentation = ( + "Hawaii itemized deduction for repaying income Hawaii taxed in an " + "earlier year under a claim of right. When section 1341 applies in " + "Hawaii (from 2022, repayments over the threshold), the whole " + "repayment is deducted outside the two percent floor (section " + "67(b)(9)) unless Hawaii tax is computed with the claim of right " + "credit. Otherwise the repayment is a miscellaneous itemized " + "deduction above two percent of Hawaii adjusted gross income while " + "Hawaii allows those (through 2025). The floor applies to the " + "repayment alone, because Hawaii's itemized list omits the other " + "miscellaneous expenses the model has." + ) + definition_period = YEAR + reference = ( + "https://data.capitol.hawaii.gov/sessions/sessionlaws/Years/SLH2023/SLH2023_Act56.pdf#page=3", + "https://www.law.cornell.edu/uscode/text/26/67#b_9", + "https://files.hawaii.gov/tax/legal/hrs/hrs_235.pdf#page=11", + # 2018 Form N-11 instructions: "Repayments under a claim of right over + # $3,000 are subject to the 2% limitation for Hawaii income tax + # purposes." (section 1341 not operative) + "https://files.hawaii.gov/tax/forms/2018/n11ins.pdf#page=21", + # 2025 Form N-11 instructions, Worksheet A-6, lines 26-29 + "https://files.hawaii.gov/tax/forms/2025/n11ins.pdf#page=34", + ) + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + p = parameters(period).gov.states.hi.tax.income.deductions.itemized + repayment = tax_unit("hi_claim_of_right_repayment", period) + eligible = tax_unit("hi_claim_of_right_section_1341_eligible", period) + credit_applies = tax_unit("hi_claim_of_right_credit_applies", period) + section_1341_deduction = where(credit_applies, 0, repayment) + if p.miscellaneous_deductions_allowed: + floor = parameters(period).gov.irs.deductions.itemized.misc.floor * max_( + tax_unit("hi_agi", period), 0 + ) + miscellaneous_deduction = max_(repayment - floor, 0) + else: + miscellaneous_deduction = 0 + return where(eligible, section_1341_deduction, miscellaneous_deduction) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_prior_year_tax_decrease.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_prior_year_tax_decrease.py new file mode 100644 index 00000000000..66bc094dbe8 --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_prior_year_tax_decrease.py @@ -0,0 +1,17 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_prior_year_tax_decrease(Variable): + value_type = float + entity = TaxUnit + label = "Prior-year Hawaii tax decrease from excluding repaid claim of right income" + unit = USD + documentation = ( + "Decrease in Hawaii income tax for the earlier year or years from " + "excluding the income repaid this year: the tax on each earlier " + "Hawaii return less that tax refigured without the repaid income " + "(Form N-364, lines 4 to 6, summed over the earlier years)." + ) + definition_period = YEAR + reference = "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf" + defined_for = StateCode.HI diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_repayment.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_repayment.py new file mode 100644 index 00000000000..c81dd1d0a86 --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_repayment.py @@ -0,0 +1,23 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_repayment(Variable): + value_type = float + entity = TaxUnit + label = "Hawaii claim of right repayment" + unit = USD + documentation = ( + "Total repaid this year by the head and spouse of income Hawaii " + "taxed in an earlier year under a claim of right (Form N-364, line " + "1). Dependents' repayments belong on their own returns." + ) + definition_period = YEAR + reference = "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf" + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + person = tax_unit.members + repayment = person("claim_of_right_repayment", period) + excluded = person("hi_claim_of_right_repayment_excluded_from_income", period) + head_or_spouse = person("is_tax_unit_head_or_spouse", period) + return tax_unit.sum(max_(repayment - excluded, 0) * head_or_spouse) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_repayment_excluded_from_income.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_repayment_excluded_from_income.py new file mode 100644 index 00000000000..95a3e6f7d7f --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_repayment_excluded_from_income.py @@ -0,0 +1,19 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_repayment_excluded_from_income(Variable): + value_type = float + entity = Person + label = "Claim of right repayment not taxed by Hawaii when received" + unit = USD + documentation = ( + "Part of claim_of_right_repayment that Hawaii did not tax in the " + "earlier year it was received. Hawaii allows no deduction or credit " + "for it." + ) + definition_period = YEAR + reference = ( + # 2025 Form N-364 instructions, General Information + "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf", + ) + defined_for = StateCode.HI diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_section_1341_eligible.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_section_1341_eligible.py new file mode 100644 index 00000000000..90c468a5d67 --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_section_1341_eligible.py @@ -0,0 +1,30 @@ +from policyengine_us.model_api import * + + +class hi_claim_of_right_section_1341_eligible(Variable): + value_type = bool + entity = TaxUnit + label = "Hawaii claim of right repayment qualifies for section 1341" + documentation = ( + "Whether section 1341 is operative in Hawaii for the year and the " + "repayment of income Hawaii taxed exceeds the section 1341(a)(3) " + "threshold, so that Hawaii tax is the lesser of the tax with a " + "deduction for the repayment and the tax without it less the " + "decrease in prior-year Hawaii tax." + ) + definition_period = YEAR + reference = ( + "https://data.capitol.hawaii.gov/sessions/sessionlaws/Years/SLH2023/SLH2023_Act56.pdf#page=3", + "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf", + ) + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + operative = parameters( + period + ).gov.states.hi.tax.income.claim_of_right.section_1341_operative + threshold = parameters( + period + ).gov.irs.deductions.itemized.claim_of_right.threshold + repayment = tax_unit("hi_claim_of_right_repayment", period) + return operative & (repayment > threshold) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_income_tax_if_claiming_claim_of_right_credit.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_income_tax_if_claiming_claim_of_right_credit.py new file mode 100644 index 00000000000..26f7608ce31 --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_income_tax_if_claiming_claim_of_right_credit.py @@ -0,0 +1,25 @@ +from policyengine_us.model_api import * + + +class hi_income_tax_if_claiming_claim_of_right_credit(Variable): + value_type = float + entity = TaxUnit + label = "Hawaii income tax with the claim of right tax credit" + unit = USD + documentation = ( + "Hawaii income tax computed without a deduction for the repayment of " + "claim of right income, less the decrease in prior-year Hawaii tax " + "(section 1341(a)(5) as operative in Hawaii)." + ) + definition_period = YEAR + reference = "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf" + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + branch = get_override_branch( + tax_unit.simulation, + "hi_claim_of_right_credit", + period, + {"hi_claim_of_right_credit_applies": np.ones(tax_unit.count, dtype=bool)}, + ) + return branch.calculate("hi_income_tax", period) diff --git a/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_income_tax_if_claiming_claim_of_right_deduction.py b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_income_tax_if_claiming_claim_of_right_deduction.py new file mode 100644 index 00000000000..a7ab1316c0c --- /dev/null +++ b/policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_income_tax_if_claiming_claim_of_right_deduction.py @@ -0,0 +1,25 @@ +from policyengine_us.model_api import * + + +class hi_income_tax_if_claiming_claim_of_right_deduction(Variable): + value_type = float + entity = TaxUnit + label = "Hawaii income tax with the claim of right deduction" + unit = USD + documentation = ( + "Hawaii income tax computed with an itemized deduction for the " + "repayment of claim of right income (section 1341(a)(4) as operative " + "in Hawaii)." + ) + definition_period = YEAR + reference = "https://files.hawaii.gov/tax/forms/2025/n364_i.pdf" + defined_for = StateCode.HI + + def formula(tax_unit, period, parameters): + branch = get_override_branch( + tax_unit.simulation, + "hi_claim_of_right_deduction", + period, + {"hi_claim_of_right_credit_applies": np.zeros(tax_unit.count, dtype=bool)}, + ) + return branch.calculate("hi_income_tax", period) diff --git a/source_conflicts/candidates.yaml b/source_conflicts/candidates.yaml index 528def1524c..919b47bd85d 100644 --- a/source_conflicts/candidates.yaml +++ b/source_conflicts/candidates.yaml @@ -2869,13 +2869,13 @@ candidates: follows: statute code: - policyengine_us/parameters/gov/states/hi/tax/income/additions/additions.yaml + - policyengine_us/variables/gov/states/hi/tax/income/claim_of_right/hi_claim_of_right_deduction.py - policyengine_us/variables/gov/states/hi/tax/income/hi_additions.py prs: - https://github.com/PolicyEngine/policyengine-us/pull/10200 state: ruled - note: 'Ruled in October 2026 under the statute-first rule; N-364 first exists for 2025, so earlier claiming procedures - need separate verification. Code not yet on main: gov/states/hi/tax/income/claim_of_right/hi_claim_of_right.yaml, - hi_claim_of_right_deduction.' + note: Ruled in October 2026 under the statute-first rule; N-364 first exists for 2025, so earlier claiming procedures + need separate verification. - id: us-hi:joint-return-claimable-spouse-exemption program: income-tax years: