diff --git a/changelog.d/il-oh-claim-of-right.added.md b/changelog.d/il-oh-claim-of-right.added.md new file mode 100644 index 00000000000..bf9399cd6e8 --- /dev/null +++ b/changelog.d/il-oh-claim-of-right.added.md @@ -0,0 +1 @@ +Add Illinois's subtraction (35 ILCS 5/203(a)(2)(P)), which applies when the federal return claims section 1341 relief, and Ohio's deduction (R.C. 5747.01(A)(12)), which applies to any repayment section 1341 covers. Users who entered a repayment in il_other_subtractions or oh_other_subtractions should move it to claim_of_right_repayment, or it counts twice. diff --git a/policyengine_us/parameters/gov/states/il/tax/income/base/subtractions.yaml b/policyengine_us/parameters/gov/states/il/tax/income/base/subtractions.yaml index f51d2d263dc..381f7ae3250 100644 --- a/policyengine_us/parameters/gov/states/il/tax/income/base/subtractions.yaml +++ b/policyengine_us/parameters/gov/states/il/tax/income/base/subtractions.yaml @@ -7,6 +7,7 @@ values: - taxable_retirement_distributions - taxable_roth_conversions - military_retirement_income + - il_claim_of_right_subtraction # Schedule M line 15 - il_529_plan_subtraction - salt_refund_income - il_other_subtractions @@ -21,5 +22,7 @@ metadata: href: https://tax.illinois.gov/content/dam/soi/en/web/tax/forms/incometax/documents/currentyear/individual/il-1040-instr.pdf#page7 - title: Illinois Department of Revenue 2024 Form IL-1040 Instructions href: https://tax.illinois.gov/content/dam/soi/en/web/tax/forms/incometax/documents/currentyear/individual/il-1040-instr.pdf#page=7 + - title: Illinois Department of Revenue 2025 Schedule M instructions, line 15 + href: https://tax.illinois.gov/content/dam/soi/en/web/tax/forms/incometax/documents/currentyear/individual/il-1040-schedule-m-instr.pdf#page=3 - title: Illinois Department of Revenue Publication 120, Retirement Income href: https://tax.illinois.gov/content/dam/soi/en/web/tax/research/publications/pubs/documents/pub-120.pdf#page=2 diff --git a/policyengine_us/parameters/gov/states/oh/tax/income/deductions/deductions.yaml b/policyengine_us/parameters/gov/states/oh/tax/income/deductions/deductions.yaml index 278d049e468..ef7a46700a8 100644 --- a/policyengine_us/parameters/gov/states/oh/tax/income/deductions/deductions.yaml +++ b/policyengine_us/parameters/gov/states/oh/tax/income/deductions/deductions.yaml @@ -13,6 +13,7 @@ values: - salt_refund_income - oh_business_income_deduction_person # Schedule of Adjustments, line 13 - oh_qualifying_capital_gain_deduction # R.C. 5747.01(A)(34), from 2026 + - oh_claim_of_right_deduction # R.C. 5747.01(A)(12); Schedule of Adjustments, line 29 (2025) - oh_other_subtractions metadata: diff --git a/policyengine_us/tests/policy/baseline/gov/irs/credits/claim_of_right/claim_of_right_relief_claimed.yaml b/policyengine_us/tests/policy/baseline/gov/irs/credits/claim_of_right/claim_of_right_relief_claimed.yaml new file mode 100644 index 00000000000..1cc4e0a066a --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/credits/claim_of_right/claim_of_right_relief_claimed.yaml @@ -0,0 +1,49 @@ +- name: Case 1, the credit method claims relief. + period: 2025 + input: + claim_of_right_section_1341_eligible: true + claim_of_right_credit_applies: true + claim_of_right_deduction: 0 + tax_unit_itemizes: false + output: + claim_of_right_relief_claimed: true + +- name: Case 2, the deduction method on a return that itemizes claims relief. + period: 2025 + input: + claim_of_right_section_1341_eligible: true + claim_of_right_credit_applies: false + claim_of_right_deduction: 5_000 + tax_unit_itemizes: true + output: + claim_of_right_relief_claimed: true + +- name: Case 3, the deduction method on a return that takes the standard deduction claims nothing. + period: 2025 + input: + claim_of_right_section_1341_eligible: true + claim_of_right_credit_applies: false + claim_of_right_deduction: 5_000 + tax_unit_itemizes: false + output: + claim_of_right_relief_claimed: false + +- name: Case 4, an itemizer with no qualifying repayment claims nothing. + period: 2025 + input: + claim_of_right_section_1341_eligible: false + claim_of_right_credit_applies: false + claim_of_right_deduction: 0 + tax_unit_itemizes: true + output: + claim_of_right_relief_claimed: false + +- name: Case 5, a method flag on a return without a qualifying repayment claims nothing. + period: 2025 + input: + claim_of_right_section_1341_eligible: false + claim_of_right_credit_applies: true + claim_of_right_deduction: 0 + tax_unit_itemizes: true + output: + claim_of_right_relief_claimed: false diff --git a/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/subtractions/il_claim_of_right_subtraction.yaml b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/subtractions/il_claim_of_right_subtraction.yaml new file mode 100644 index 00000000000..085e884784c --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/il/tax/income/subtractions/il_claim_of_right_subtraction.yaml @@ -0,0 +1,183 @@ +# 35 ILCS 5/203(a)(2)(P) and 2025 Schedule M line 15: the deduction used to +# compute the federal section 1341 credit, or the itemized deduction taken for +# the repayment. + +- name: Case 1, the federal credit method subtracts the repayment. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: true + households: + household: + members: [head] + state_code: IL + output: + il_claim_of_right_subtraction: 10_000 + +- name: Case 2, the federal deduction method on an itemized return subtracts the repayment. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: false + tax_unit_itemizes: true + households: + household: + members: [head] + state_code: IL + output: + claim_of_right_deduction: 10_000 + il_claim_of_right_subtraction: 10_000 + +- name: Case 3, the deduction method with the federal standard deduction subtracts nothing. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: false + tax_unit_itemizes: false + households: + household: + members: [head] + state_code: IL + output: + il_claim_of_right_subtraction: 0 + +- name: Case 4, a repayment of $3,000 claims no section 1341 relief. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 3_000 + tax_units: + tax_unit: + members: [head] + tax_unit_itemizes: true + households: + household: + members: [head] + state_code: IL + output: + claim_of_right_section_1341_eligible: false + il_claim_of_right_subtraction: 0 + +- name: Case 5, a joint return subtracts both spouses' repayments 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_500 + child: + age: 17 + claim_of_right_repayment: 5_000 + tax_units: + tax_unit: + members: [head, spouse, child] + claim_of_right_credit_applies: true + households: + household: + members: [head, spouse, child] + state_code: IL + output: + il_claim_of_right_subtraction: 4_500 + +- name: Case 6, outside Illinois. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: true + households: + household: + members: [head] + state_code: IN + output: + il_claim_of_right_subtraction: 0 + +# Wages $40,000, standard deduction, repays $10,000; the earlier year's federal +# tax would fall by $2,200. Federal tax: $2,671.50 with the deduction (it loses +# to the $15,750 standard deduction) or $2,671.50 - $2,200 = $471.50 with the +# credit, so the credit applies. IL-1040: base income $40,000 - $10,000 = +# $30,000; less the $2,850 exemption = $27,150; x 4.95% = $1,343.925. +- name: Case 7, a standard-deduction filer whose federal tax uses the credit. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + employment_income: 40_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_prior_year_tax_decrease: 2_200 + households: + household: + members: [head] + state_code: IL + output: + claim_of_right_credit_applies: true + claim_of_right_credit: 2_200 + il_claim_of_right_subtraction: 10_000 + il_base_income: 30_000 + il_taxable_income: 27_150 + il_income_tax_before_non_refundable_credits: 1_343.925 + +# Wages $100,000, $20,000 of charity, repays $10,000; the earlier year's tax +# would fall by only $400. The deduction is worth more than $400 to an +# itemizer in the 22% bracket, so federal tax uses the deduction and the return +# itemizes. IL-1040: base income $100,000 - $10,000 = $90,000; less $2,850 = +# $87,150; x 4.95% = $4,313.925. +- name: Case 8, an itemizer whose federal tax uses the deduction. + period: 2025 + absolute_error_margin: 0.01 + 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] + claim_of_right_prior_year_tax_decrease: 400 + households: + household: + members: [head] + state_code: IL + output: + claim_of_right_credit_applies: false + tax_unit_itemizes: true + claim_of_right_deduction: 10_000 + il_claim_of_right_subtraction: 10_000 + il_base_income: 90_000 + il_taxable_income: 87_150 + il_income_tax_before_non_refundable_credits: 4_313.925 diff --git a/policyengine_us/tests/policy/baseline/gov/states/oh/tax/income/deductions/oh_claim_of_right_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/oh/tax/income/deductions/oh_claim_of_right_deduction.yaml new file mode 100644 index 00000000000..a578829b9dd --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/states/oh/tax/income/deductions/oh_claim_of_right_deduction.yaml @@ -0,0 +1,238 @@ +# R.C. 5747.01(A)(12) and the 2025 IT 1040 instructions, Schedule of +# Adjustments line 29: deduct a repayment of income included in Ohio AGI in a +# prior year, except income that qualified for the Ohio resident or +# nonresident credit. The deduction must be allowable, whichever federal method +# applies and whether or not the federal return itemizes. + +- name: Case 1, the federal credit method deducts the repayment. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: true + households: + household: + members: [head] + state_code: OH + output: + oh_claim_of_right_deduction: 10_000 + +- name: Case 2, income that qualified for an Ohio credit or stayed out of Ohio AGI when received is not deducted. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + oh_claim_of_right_repayment_not_deductible: 4_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: true + households: + household: + members: [head] + state_code: OH + output: + oh_claim_of_right_deduction: 6_000 + +- name: Case 3, the federal deduction method on an itemized return deducts the repayment. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: false + tax_unit_itemizes: true + households: + household: + members: [head] + state_code: OH + output: + oh_claim_of_right_deduction: 10_000 + +- name: Case 4, the deduction method with the federal standard deduction still deducts the repayment. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: false + tax_unit_itemizes: false + households: + household: + members: [head] + state_code: OH + output: + oh_claim_of_right_deduction: 10_000 + +- name: Case 5, each spouse deducts their own repayment; a dependent's belongs on their own return. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 2_000 + spouse: + age: 40 + claim_of_right_repayment: 2_500 + oh_claim_of_right_repayment_not_deductible: 3_000 + child: + age: 17 + claim_of_right_repayment: 5_000 + tax_units: + tax_unit: + members: [head, spouse, child] + claim_of_right_credit_applies: true + households: + household: + members: [head, spouse, child] + state_code: OH + output: + oh_claim_of_right_deduction: [2_000, 0, 0] + +- name: Case 6, outside Ohio. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: true + households: + household: + members: [head] + state_code: IL + output: + oh_claim_of_right_deduction: 0 + +# Wages $40,000, standard deduction, repays $10,000; the earlier year's federal +# tax would fall by $2,200, so federal tax uses the credit ($471.50 against +# $2,671.50). Ohio AGI $40,000 - $10,000 = $30,000; modified AGI under $40,001 +# gives a $2,400 exemption, so Ohio taxable income is $27,600. +- name: Case 7, a standard-deduction filer whose federal tax uses the credit. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 40_000 + claim_of_right_repayment: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_prior_year_tax_decrease: 2_200 + households: + household: + members: [head] + state_code: OH + output: + claim_of_right_credit_applies: true + oh_claim_of_right_deduction: 10_000 + oh_agi: 30_000 + oh_taxable_income: 27_600 + +# Joint return: head wages $100,000; spouse wages $3,500, of which the spouse +# repays $3,100; earlier-year federal decrease $500, so federal tax uses the +# credit. The deduction leaves the spouse $400 of Ohio AGI. The joint filing +# credit needs $500 of qualifying income for each spouse, and "Amounts deducted +# on the Ohio Schedule of Adjustments are not included in Ohio AGI, and thus +# are not 'qualifying income'" (2025 instructions, line 12, PDF p. 29). So the +# couple loses the credit and Ohio tax rises. +- name: Case 8, the deduction can take a spouse below the joint filing credit's $500 test. + period: 2025 + input: + people: + head: + age: 40 + employment_income: 100_000 + spouse: + age: 40 + employment_income: 3_500 + claim_of_right_repayment: 3_100 + tax_units: + tax_unit: + members: [head, spouse] + claim_of_right_prior_year_tax_decrease: 500 + households: + household: + members: [head, spouse] + state_code: OH + output: + claim_of_right_credit_applies: true + oh_claim_of_right_deduction: [0, 3_100] + oh_joint_filing_credit_qualifying_income: [100_000, 400] + oh_joint_filing_credit: 0 + +- name: Case 9, a repayment of exactly $3,000 does not exceed the section 1341 threshold. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 3_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: false + tax_unit_itemizes: false + households: + household: + members: [head] + state_code: OH + output: + oh_claim_of_right_deduction: 0 + +- name: Case 10, a repayment of $3,001 is deductible without a federal claim. + period: 2025 + input: + people: + head: + age: 40 + claim_of_right_repayment: 3_001 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: false + tax_unit_itemizes: false + households: + household: + members: [head] + state_code: OH + output: + oh_claim_of_right_deduction: 3_001 + +- name: Case 11, the federal credit does not override Ohio's exclusions. + period: 2021 + input: + people: + head: + age: 40 + claim_of_right_repayment: 10_000 + oh_claim_of_right_repayment_not_deductible: 10_000 + tax_units: + tax_unit: + members: [head] + claim_of_right_credit_applies: true + households: + household: + members: [head] + state_code: OH + output: + oh_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_il_oh_claim_of_right_properties.py b/policyengine_us/tests/unit/test_il_oh_claim_of_right_properties.py new file mode 100644 index 00000000000..3e74b820d1b --- /dev/null +++ b/policyengine_us/tests/unit/test_il_oh_claim_of_right_properties.py @@ -0,0 +1,180 @@ +"""Properties of Illinois's and Ohio's claim of right subtractions. + +Illinois (35 ILCS 5/203(a)(2)(P), Schedule M line 15) takes a repayment of +income held under a claim of right off federal AGI when the federal return +claims section 1341 relief: the credit, or the repayment deduction on a return +that itemizes. Ohio (R.C. 5747.01(A)(12), Schedule of Adjustments line 29) +deducts a section 1341 repayment whichever federal method applies and whether +or not the return itemizes. The policy cases are in YAML. Which federal method +applies, and whether the return itemizes, come from the federal branch +computations, so these tests compare simulations over a grid of repayments, +earlier-year decreases, wages and charity, each against a reference that does +not use the new variables: + +- with the federal credit method fixed, or the deduction method fixed on a + return that itemizes, Illinois income tax equals that of a simulation with + no repayment and the same amount entered through the existing Schedule M + input, and Ohio taxable income equals that of a simulation with no + repayment and wages lower by the repayment (where wages cover it); with the + deduction method fixed on a return taking the standard deduction, Illinois + income tax equals a simulation with no repayment and Ohio taxable income + still equals the lower-wage simulation; +- with the method chosen by the model, an eligible Illinois return gets that + relief whenever the earlier year's federal tax fell, because a winning + deduction must have lowered tax, which only an itemized deduction does, and + an eligible Ohio return gets it whatever the earlier decrease; +- for these single filers, neither state's income tax ever rises with a + repayment, or as it grows (on a joint Ohio return the deduction can cost the + joint filing credit; see the YAML). +""" + +import gc +import itertools + +import numpy as np +import pytest + +from policyengine_us import Simulation + +YEAR = 2025 +STATES = ["IL", "OH"] +REPAYMENTS = [0, 2_000, 3_000, 3_001, 10_000, 60_000] +DECREASES = [0, 500, 5_000] +WAGES = [20_000, 80_000, 300_000] +CHARITY = [0, 30_000] +AXES = [STATES, REPAYMENTS, DECREASES, WAGES, CHARITY] +GRID = list(itertools.product(*AXES)) +SHAPE = tuple(len(axis) for axis in AXES) +STATE = np.array([point[0] for point in GRID]) +REPAYMENT, DECREASE, WAGE, CHARITABLE = ( + np.array([point[i] for point in GRID], dtype=float) for i in range(1, len(AXES)) +) +ZEROS = np.zeros_like(REPAYMENT) +IL = STATE == "IL" +OH = STATE == "OH" +THRESHOLD = 3_000 +ELIGIBLE_REPAYMENT = np.where(REPAYMENT > THRESHOLD, REPAYMENT, 0) +# Ohio's reference lowers wages by the repayment, so it needs wages at least +# that large. +OH_COMPARABLE = OH & (WAGE >= ELIGIBLE_REPAYMENT) +TOLERANCE = 0.01 + + +def grid_simulation(repayment, tax_unit_inputs=None, schedule_m=ZEROS, wage_cut=ZEROS): + """One single-person tax unit 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] - wage_cut[i]}, + "charitable_cash_donations": {YEAR: CHARITABLE[i]}, + "claim_of_right_repayment": {YEAR: float(repayment[i])}, + } + tax_unit = { + "members": [person], + "claim_of_right_prior_year_tax_decrease": {YEAR: float(DECREASE[i])}, + "il_other_subtractions": {YEAR: float(schedule_m[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: STATE[i]}, + } + return Simulation(situation=situation) + + +def calculate(simulation, variables): + return {v: np.asarray(simulation.calculate(v, YEAR)) for v in variables} + + +METHODS = { + "credit": {"claim_of_right_credit_applies": True}, + "deduction_itemizing": { + "claim_of_right_credit_applies": False, + "tax_unit_itemizes": True, + }, + "deduction_standard": { + "claim_of_right_credit_applies": False, + "tax_unit_itemizes": False, + }, +} +OUTPUTS = ["il_income_tax", "oh_taxable_income", "state_income_tax"] + + +@pytest.fixture(scope="module") +def results(): + out = {"model": calculate(grid_simulation(REPAYMENT), OUTPUTS)} + for name, inputs in METHODS.items(): + out[name] = calculate( + grid_simulation(REPAYMENT, tax_unit_inputs=inputs), OUTPUTS + ) + out["none"] = calculate(grid_simulation(ZEROS), OUTPUTS) + # Independent reference: no repayment, and the same amount entered through + # paths that existed before these subtractions. + out["reference"] = calculate( + grid_simulation( + ZEROS, + schedule_m=np.where(IL, ELIGIBLE_REPAYMENT, 0), + wage_cut=np.where(OH_COMPARABLE, ELIGIBLE_REPAYMENT, 0), + ), + OUTPUTS, + ) + yield out + gc.collect() + + +def assert_relief(r, reference, rows): + """Illinois tax and Ohio taxable income in `r` equal `reference` on `rows`.""" + np.testing.assert_allclose( + r["il_income_tax"][IL & rows], + reference["il_income_tax"][IL & rows], + atol=TOLERANCE, + ) + oh_rows = OH_COMPARABLE & rows + np.testing.assert_allclose( + r["oh_taxable_income"][oh_rows], + reference["oh_taxable_income"][oh_rows], + atol=TOLERANCE, + ) + + +def test_each_federal_method_matches_the_existing_input_path(results): + every = np.ones_like(REPAYMENT, dtype=bool) + assert_relief(results["credit"], results["reference"], every) + assert_relief(results["deduction_itemizing"], results["reference"], every) + # The standard deduction under the deduction method claims nothing, so + # Illinois gives nothing. Ohio asks only that the deduction be allowable. + np.testing.assert_allclose( + results["deduction_standard"]["il_income_tax"][IL], + results["none"]["il_income_tax"][IL], + atol=TOLERANCE, + ) + np.testing.assert_allclose( + results["deduction_standard"]["oh_taxable_income"][OH_COMPARABLE], + results["reference"]["oh_taxable_income"][OH_COMPARABLE], + atol=TOLERANCE, + ) + + +def test_eligible_returns_get_relief_when_the_earlier_tax_fell(results): + eligible = REPAYMENT > THRESHOLD + assert_relief(results["model"], results["reference"], eligible & (DECREASE > 0)) + assert_relief(results["model"], results["none"], ~eligible) + # Ohio gives relief to every eligible return, whatever the earlier decrease. + np.testing.assert_allclose( + results["model"]["oh_taxable_income"][OH_COMPARABLE & eligible], + results["reference"]["oh_taxable_income"][OH_COMPARABLE & eligible], + atol=TOLERANCE, + ) + + +def test_state_tax_never_rises(results): + with_repayment = results["model"]["state_income_tax"] + without = results["none"]["state_income_tax"] + assert np.all(with_repayment <= without + TOLERANCE) + assert np.any(with_repayment < without - 1), "some repayment should lower tax" + table = with_repayment.reshape(SHAPE) + assert np.all(np.diff(table, axis=1) <= TOLERANCE), "rises with the repayment" diff --git a/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_relief_claimed.py b/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_relief_claimed.py new file mode 100644 index 00000000000..78b699010f8 --- /dev/null +++ b/policyengine_us/variables/gov/irs/credits/claim_of_right/claim_of_right_relief_claimed.py @@ -0,0 +1,28 @@ +from policyengine_us.model_api import * + + +class claim_of_right_relief_claimed(Variable): + value_type = bool + entity = TaxUnit + label = "Federal return claims relief for a claim of right repayment" + documentation = ( + "Whether the federal return claims relief for repaying claim of right " + "income: the section 1341 credit (Schedule 3, line 13b), or the " + "repayment deduction (Schedule A, line 16) on a return that itemizes. " + "A return whose tax is computed with the deduction but that takes the " + "standard deduction claims neither. Illinois allows its subtraction " + "only when the federal return claims one of the two." + ) + definition_period = YEAR + reference = ( + "https://www.govinfo.gov/content/pkg/USCODE-2024-title26/html/USCODE-2024-title26-subtitleA-chap1-subchapQ-partV-sec1341.htm", + # Publication 525 (2025), Repayments, methods 1 and 2 + "https://www.irs.gov/pub/irs-prior/p525--2025.pdf#page=36", + ) + + def formula(tax_unit, period, parameters): + eligible = tax_unit("claim_of_right_section_1341_eligible", period) + credit_applies = tax_unit("claim_of_right_credit_applies", period) + deduction = tax_unit("claim_of_right_deduction", period) + itemizes = tax_unit("tax_unit_itemizes", period) + return eligible & (credit_applies | (itemizes & (deduction > 0))) diff --git a/policyengine_us/variables/gov/states/il/tax/income/schedule_m/il_other_subtractions.py b/policyengine_us/variables/gov/states/il/tax/income/schedule_m/il_other_subtractions.py index 6f9326fb150..64765033d8a 100644 --- a/policyengine_us/variables/gov/states/il/tax/income/schedule_m/il_other_subtractions.py +++ b/policyengine_us/variables/gov/states/il/tax/income/schedule_m/il_other_subtractions.py @@ -12,6 +12,7 @@ class il_other_subtractions(Variable): "Illinois subtractions from federal adjusted gross income reported on " "Schedule M not otherwise modeled, entered as a positive amount. " "Do not include line 13 (Bright Start, Bright Directions and College Illinois contributions), " + "line 15 (restoration of amounts held under a claim of right, which il_claim_of_right_subtraction computes), " "line 22 (U.S. obligations interest), or non-Illinois state and local income tax refunds " "on line 25, which PolicyEngine subtracts through salt_refund_income." ) diff --git a/policyengine_us/variables/gov/states/il/tax/income/subtractions/il_claim_of_right_subtraction.py b/policyengine_us/variables/gov/states/il/tax/income/subtractions/il_claim_of_right_subtraction.py new file mode 100644 index 00000000000..f56322b8eb1 --- /dev/null +++ b/policyengine_us/variables/gov/states/il/tax/income/subtractions/il_claim_of_right_subtraction.py @@ -0,0 +1,40 @@ +from policyengine_us.model_api import * + + +class il_claim_of_right_subtraction(Variable): + value_type = float + entity = TaxUnit + label = "Illinois subtraction for restoring amounts held under a claim of right" + unit = USD + documentation = ( + "Illinois base income subtraction for repaying income included in an " + "earlier year under a claim of right (Schedule M, line 15): the " + "repayment, when federal tax is computed with the section 1341 credit " + "or the return deducts the repayment as an itemized deduction. A " + "return that takes the federal standard deduction under the deduction " + "method subtracts nothing." + ) + definition_period = YEAR + reference = ( + # 35 ILCS 5/203(a)(2)(P) + "https://ilga.gov/documents/legislation/ilcs/documents/003500050K203.htm", + # 86 Ill. Adm. Code 100.2465 + "https://my.ilga.gov/commission/jcar/admincode/086/086001000E24650R.html", + # 2017 Schedule M instructions, line 15 + "https://taxarchive.illinois.gov/content/dam/soi/en/web/taxarchive/forms/income-tax/2017/individual/il-1040-schedule-m-instr.pdf#page=2", + # 2025 Schedule M instructions, line 15 + "https://tax.illinois.gov/content/dam/soi/en/web/tax/forms/incometax/documents/currentyear/individual/il-1040-schedule-m-instr.pdf#page=3", + ) + defined_for = StateCode.IL + + def formula(tax_unit, period, parameters): + # Under the credit method, the subtraction is "the amount of the + # repayment that would otherwise have been deductible" (86 Ill. Adm. + # Code 100.2465(b)); under the deduction method, the itemized + # deduction taken. Either way it is the whole repayment. From 2026 the + # federal section 68 limit reduces total itemized deductions and has + # no rule allocating the reduction to one deduction; the model reads + # "the itemized deduction taken" as the whole Schedule A amount. + claimed = tax_unit("claim_of_right_relief_claimed", period) + repayment = tax_unit("tax_unit_claim_of_right_repayment", period) + return where(claimed, repayment, 0) diff --git a/policyengine_us/variables/gov/states/oh/tax/income/deductions/claim_of_right/oh_claim_of_right_deduction.py b/policyengine_us/variables/gov/states/oh/tax/income/deductions/claim_of_right/oh_claim_of_right_deduction.py new file mode 100644 index 00000000000..174198a7b8d --- /dev/null +++ b/policyengine_us/variables/gov/states/oh/tax/income/deductions/claim_of_right/oh_claim_of_right_deduction.py @@ -0,0 +1,38 @@ +from policyengine_us.model_api import * + + +class oh_claim_of_right_deduction(Variable): + value_type = float + entity = Person + label = "Ohio deduction for repayment of income reported in a prior year" + unit = USD + documentation = ( + "Ohio adjusted gross income deduction for repaying income included in " + "adjusted gross income in an earlier year under a claim of right " + "(Schedule of Adjustments, line 23 in 2021 and line 29 in 2025), " + "excluding the part that R.C. 5747.01(A)(12) does not allow. It applies " + "to a repayment that section 1341 covers, whichever federal method " + "applies and whether or not the federal return itemizes: the statute " + "requires that the deduction be allowable, not claimed. A nonbusiness " + "repayment of $3,000 or less is not allowable: it falls outside " + "section 1341, so it stays a miscellaneous itemized deduction (section " + "67(b)(9)), which section 67(h) disallows from 2018." + ) + definition_period = YEAR + reference = ( + # R.C. 5747.01(A)(12) + "https://codes.ohio.gov/ohio-revised-code/section-5747.01", + # 2021 Ohio IT 1040 instructions, Schedule of Adjustments line 23 + "https://dam.assets.ohio.gov/image/upload/tax.ohio.gov/forms/ohio_individual/individual/2021/pit-it1040-booklet.pdf#page=17", + # 2025 Ohio IT 1040 instructions, Schedule of Adjustments line 29 + "https://dam.assets.ohio.gov/image/upload/tax.ohio.gov/forms/ohio_individual/individual/2025/it1040-booklet.pdf#page=23", + ) + defined_for = StateCode.OH + + def formula(person, period, parameters): + eligible = person.tax_unit("claim_of_right_section_1341_eligible", period) + repayment = person("claim_of_right_repayment", period) + excluded = person("oh_claim_of_right_repayment_not_deductible", period) + # Dependents' repayments belong on their own returns. + head_or_spouse = person("is_tax_unit_head_or_spouse", period) + return where(eligible & head_or_spouse, max_(repayment - excluded, 0), 0) diff --git a/policyengine_us/variables/gov/states/oh/tax/income/deductions/claim_of_right/oh_claim_of_right_repayment_not_deductible.py b/policyengine_us/variables/gov/states/oh/tax/income/deductions/claim_of_right/oh_claim_of_right_repayment_not_deductible.py new file mode 100644 index 00000000000..39e3096548c --- /dev/null +++ b/policyengine_us/variables/gov/states/oh/tax/income/deductions/claim_of_right/oh_claim_of_right_repayment_not_deductible.py @@ -0,0 +1,26 @@ +from policyengine_us.model_api import * + + +class oh_claim_of_right_repayment_not_deductible(Variable): + value_type = float + entity = Person + label = "Claim of right repayment that Ohio's repayment deduction excludes" + unit = USD + documentation = ( + "Part of claim_of_right_repayment that does not meet R.C. " + "5747.01(A)(12): income that was not included in Ohio adjusted gross " + "income in the year it was received (for example, income Ohio " + "deducted then), income that qualified that year for the Ohio " + "nonresident credit or the resident credit for tax paid to another " + "state (R.C. 5747.05(A) or (B)), and amounts that reduce Ohio " + "adjusted gross income on another line in any year." + ) + definition_period = YEAR + reference = ( + # R.C. 5747.01(A)(12)(a) and (b) + "https://codes.ohio.gov/ohio-revised-code/section-5747.01", + "https://codes.ohio.gov/ohio-revised-code/section-5747.05", + # 2025 Ohio IT 1040 instructions, Schedule of Adjustments line 29 + "https://dam.assets.ohio.gov/image/upload/tax.ohio.gov/forms/ohio_individual/individual/2025/it1040-booklet.pdf#page=23", + ) + defined_for = StateCode.OH diff --git a/policyengine_us/variables/gov/states/oh/tax/income/deductions/oh_other_subtractions.py b/policyengine_us/variables/gov/states/oh/tax/income/deductions/oh_other_subtractions.py index e44831584f1..d2217b8ed6d 100644 --- a/policyengine_us/variables/gov/states/oh/tax/income/deductions/oh_other_subtractions.py +++ b/policyengine_us/variables/gov/states/oh/tax/income/deductions/oh_other_subtractions.py @@ -13,7 +13,8 @@ class oh_other_subtractions(Variable): "not otherwise modeled, entered as a positive amount. Do not include " "Social Security, military retirement, 529 deductions, Pell grants, educator " "expenses, disability benefits, medical expenses, U.S. government interest, " - "state tax refunds, business income deductions, or capital gain deductions, " - "which PolicyEngine computes separately." + "state tax refunds, business income deductions, capital gain deductions, or " + "repayments of income reported in a prior year (line 29 in 2025; see " + "oh_claim_of_right_deduction), which PolicyEngine computes separately." ) reference = "https://dam.assets.ohio.gov/image/upload/v1767095693/tax.ohio.gov/forms/ohio_individual/individual/2025/it1040-booklet.pdf#page=20"