diff --git a/changelog.d/dependent-worksheet-w2-wages.fixed.md b/changelog.d/dependent-worksheet-w2-wages.fixed.md new file mode 100644 index 00000000000..18e7c2a1411 --- /dev/null +++ b/changelog.d/dependent-worksheet-w2-wages.fixed.md @@ -0,0 +1 @@ +Use Form W-2 box 1 wages, which leave out elective deferrals, and farm income as earned income in the federal, Oregon and Hawaii standard deduction worksheets for dependents and in the Medicaid dependent filing test, which now also subtracts the deductible part of self-employment tax as the worksheet does. diff --git a/policyengine_us/parameters/gov/irs/income/filing_requirement/dependent/earned_income_sources.yaml b/policyengine_us/parameters/gov/irs/income/filing_requirement/dependent/earned_income_sources.yaml index 22410a45918..f685a64bcce 100644 --- a/policyengine_us/parameters/gov/irs/income/filing_requirement/dependent/earned_income_sources.yaml +++ b/policyengine_us/parameters/gov/irs/income/filing_requirement/dependent/earned_income_sources.yaml @@ -1,7 +1,8 @@ -description: The Internal Revenue Service counts these gross income sources as earned income when it tests the unearned income of a filer who can be claimed as a dependent; every other gross income source is unearned income. +description: The Internal Revenue Service counts these gross income sources as earned income of a filer who can be claimed as a dependent, both for the standard deduction worksheet for dependents and for the unearned income filing test. The earned portion of taxable disability benefits is counted separately; other gross income is unearned income. values: 2010-01-01: - # Form 1040 line 1z (wages). + # Form 1040 line 1z (wages). Line 1a is the total of Form(s) W-2, box 1, + # which leaves out elective deferrals. - irs_employment_income # Schedule 1 line 3 (business income, Schedule C). - self_employment_income @@ -11,14 +12,18 @@ values: metadata: unit: list period: year - label: IRS earned income sources for the dependent unearned income filing test + label: IRS earned income sources for filers who can be claimed as dependents reference: - title: 26 U.S. Code § 6012(a)(1)(C)(i)(I) and (f)(2)(D) - income other than earned income href: https://www.law.cornell.edu/uscode/text/26/6012 - # "Generally, your earned income is the total of the amount(s) you - # reported on Form 1040 or 1040-SR, line 1z, and Schedule 1, lines 3, 6, - # 8r, 8t, and 8u minus the amount, if any, on Schedule 1, line 15." - # Schedule 1 line 5 (rents, royalties, partnerships, S corporations and - # trusts) is not on the list. - - title: 2025 Form 1040 instructions, Standard Deduction Worksheet for Dependents - href: https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=35 + - title: 26 U.S. Code § 63(c)(5) - limitation on basic standard deduction in the case of certain dependents + href: https://www.law.cornell.edu/uscode/text/26/63#c_5 + # Line 1a is the total of Form(s) W-2, box 1 (page 23); an elective + # deferral "isn't included as income in box 1 of your Form W-2" (page + # 25). Worksheet footnote (page 35): "Generally, your earned income is + # the total of the amount(s) you reported on Form 1040 or 1040-SR, line + # 1z, and Schedule 1, lines 3, 6, 8r, 8t, and 8u minus the amount, if + # any, on Schedule 1, line 15." Schedule 1 line 5 (rents, royalties, + # partnerships, S corporations and trusts) is not on the list. + - title: "2025 Form 1040 instructions, line 1a and Standard Deduction Worksheet for Dependents #page 23,25,35" + href: https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=23 diff --git a/policyengine_us/tests/core/test_dependent_worksheet_earned_income_invariants.py b/policyengine_us/tests/core/test_dependent_worksheet_earned_income_invariants.py new file mode 100644 index 00000000000..da139ea1c6d --- /dev/null +++ b/policyengine_us/tests/core/test_dependent_worksheet_earned_income_invariants.py @@ -0,0 +1,344 @@ +"""Invariants for earned income on the standard deduction worksheet for dependents. + +The Form 1040 Standard Deduction Worksheet for Dependents starts earned income +from line 1z, and line 1a is the total of Form(s) W-2, box 1, which leaves out +elective deferrals (2025 Form 1040 instructions, PDF pages 23, 25 and 35). +`standard_deduction_worksheet_earned_income` is that amount for the head and +spouse; `basic_standard_deduction` (26 USC 63(c)(5)), `or_standard_deduction` +and `hi_deductions` use it for a filer who can be claimed as a dependent, and +`medicaid_person_is_required_to_file` uses the same per-person amount +(`standard_deduction_worksheet_earned_income_person`). +YAML cases pin single households; these tests check what must hold for every +input. + +`test_worksheet_properties` draws batches of single and joint tax units with +Hypothesis (any mix of claimability, wages, 401(k) deferrals, self-employment +and farm income or loss, and interest, in Oregon, Hawaii or Texas) and runs +each batch, with four variants of every unit, as one simulation for 2025 and +2026. Four fixed units start every batch so that each property has rows to +check: the review's case (a claimed single filer with $10,000 of wages, a +$6,000 deferral and $600 of interest) in each state, and a claimed single +filer with $901 of farm profit and $450 of interest, whose filing +requirement turns on the line 15 subtraction alone (property 6): + +1. Deferral invariance: a unit whose wages are W with a deferral D gets the + same worksheet earned income, deductions, federal filing requirement and + Medicaid filing requirement as a twin with wages max(W - D, 0) and no + deferral, as long as the Schedule 1 line 15 deduction is the same for + both. Deferrals are still Social Security and Medicare wages, so near the + Social Security wage base they change self-employment tax and line 15; + the drawn wages and self-employment income stay far below it. +2. Bounds: the basic standard deduction of a unit whose head or spouse can be + claimed is at least the section 63(c)(5)(A) amount and never more than the + regular basic standard deduction for its filing status; for any other unit + it is the regular amount. Hawaii's limited deduction never exceeds Hawaii's + regular standard deduction. +3. Monotonicity: $1,000 more wages with the same deferral never lowers + worksheet earned income or any of the three deductions, and a deferral + $1,000 larger out of the same wages never raises them. +4. Reference: for units with wages and deferrals only, worksheet earned income + equals the sum of max(W - D, 0) over the head and spouse, and the basic + standard deduction of a claimable unit equals min(regular amount, + max(63(c)(5)(A) amount, worksheet earned income + 63(c)(5)(B) amount)). +5. Table 2 (2025): for single claimable filers under 65 and not blind with + only wages, deferrals and interest, both `tax_unit_is_required_to_file` and + `medicaid_person_is_required_to_file` equal Publication 501 (2025), Table + 2, computed with W-2 box 1 wages as earned income. +6. Federal and Medicaid agree (2025): for every drawn single filer who can + be claimed (under 65, not blind), including self-employment and farm + income or loss, `medicaid_person_is_required_to_file` equals + `tax_unit_is_required_to_file`. Both apply section 6012(a)(1) through the + same limited standard deduction, including its line 15 subtraction. +""" + +import numpy as np +from hypothesis import HealthCheck, given, settings +from hypothesis import strategies as st + +from policyengine_us import Simulation +from policyengine_us.system import system as SYSTEM + +YEARS = (2025, 2026) +STATES = ("OR", "HI", "TX") +VARIANTS = ("base", "twin", "raised", "deferred") +RAISE = 1_000 + +# Publication 501 (2025), Table 2, single dependents not 65 or older or blind: +# https://www.irs.gov/pub/irs-prior/p501--2025.pdf#page=4 +TABLE_2_FLOOR = 1_350 +TABLE_2_EARNED_INCOME_ADDITION = 450 +TABLE_2_EARNED_INCOME_LIMIT = 15_750 + + +def simulate(units): + """One simulation of independent tax units, each in its own household.""" + people, tax_units, households = {}, {}, {} + groups = {"marital_units": {}, "spm_units": {}, "families": {}} + for index, unit in enumerate(units): + members = [f"adult_{index}_{n}" for n in range(len(unit["adults"]))] + for name, inputs in zip(members, unit["adults"]): + people[name] = { + variable: {year: value for year in YEARS} + for variable, value in inputs.items() + } + tax_units[f"tax_unit_{index}"] = { + "members": members, + "filing_status": {year: unit["filing_status"] for year in YEARS}, + # Keep Hawaii's comparison on the standard deduction. + "hi_itemized_deductions": {year: 0 for year in YEARS}, + } + households[f"household_{index}"] = { + "members": members, + "state_code": {year: unit["state"] for year in YEARS}, + } + for name in ("spm_units", "families"): + groups[name][f"{name}_{index}"] = {"members": members} + groups["marital_units"][f"marital_unit_{index}"] = {"members": members} + return Simulation( + situation={ + "people": people, + "tax_units": tax_units, + "households": households, + **groups, + } + ) + + +def adult(claimed, wages, deferral, self_employment, farm, interest): + return { + "age": 30, + "is_blind": False, + "claimed_as_dependent_on_another_return": claimed, + "employment_income": wages, + "traditional_401k_contributions": deferral, + "self_employment_income": self_employment, + "farm_operations_income": farm, + "taxable_interest_income": interest, + } + + +def variant(unit, kind): + """The unit, its no-deferral twin, or the unit with more wages or a larger + deferral out of the same wages.""" + adults = [] + for person in unit["adults"]: + person = dict(person) + if kind == "twin": + person["employment_income"] = max( + person["employment_income"] - person["traditional_401k_contributions"], + 0, + ) + person["traditional_401k_contributions"] = 0 + elif kind == "raised": + person["employment_income"] += RAISE + elif kind == "deferred": + person["traditional_401k_contributions"] = min( + person["traditional_401k_contributions"] + RAISE, + person["employment_income"], + ) + adults.append(person) + return {**unit, "adults": adults} + + +money = st.integers(min_value=0, max_value=40_000) +loss_or_profit = st.one_of(st.just(0), st.integers(min_value=-10_000, max_value=10_000)) + + +@st.composite +def adults(draw): + wages = draw(money) + deferral = draw(st.integers(min_value=0, max_value=wages)) + return adult( + claimed=draw(st.booleans()), + wages=wages, + deferral=deferral, + self_employment=draw(loss_or_profit), + farm=draw(loss_or_profit), + interest=draw(st.integers(min_value=0, max_value=5_000)), + ) + + +@st.composite +def units(draw): + joint = draw(st.booleans()) + members = [draw(adults()) for _ in range(2 if joint else 1)] + return { + "filing_status": "JOINT" if joint else "SINGLE", + "state": draw(st.sampled_from(STATES)), + "adults": members, + } + + +# Fixed units so every property has rows: the reviewer's case and its twin. +FIXED_UNITS = [ + { + "filing_status": "SINGLE", + "state": state, + "adults": [adult(True, 10_000, 6_000, 0, 0, 600)], + } + for state in STATES +] + [ + # Line 15 is $901 x 0.9235 x 15.3% / 2 = $63.65, so the limit is the + # $1,350 floor and gross income of $1,351 requires a return. Without the + # subtraction the limit would be $1,351 and no return would be required. + { + "filing_status": "SINGLE", + "state": "TX", + "adults": [adult(True, 0, 0, 0, 901, 450)], + } +] + + +def head_values(simulation, units, variable, year): + values = np.asarray(simulation.calculate(variable, year)) + first = np.cumsum([0] + [len(unit["adults"]) for unit in units]) + return values[first[:-1]] + + +@settings( + max_examples=40, + deadline=None, + suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large], +) +@given(st.lists(units(), min_size=1, max_size=12)) +def test_worksheet_properties(drawn): + base = FIXED_UNITS + drawn + batch = [variant(unit, kind) for kind in VARIANTS for unit in base] + simulation = simulate(batch) + n = len(base) + rows = {kind: slice(i * n, (i + 1) * n) for i, kind in enumerate(VARIANTS)} + claimable = np.array( + [ + any(a["claimed_as_dependent_on_another_return"] for a in unit["adults"]) + for unit in base + ] + ) + joint = np.array([unit["filing_status"] == "JOINT" for unit in base]) + wages_only = np.array( + [ + all( + a["self_employment_income"] == 0 and a["farm_operations_income"] == 0 + for a in unit["adults"] + ) + for unit in base + ] + ) + hi = np.array([unit["state"] == "HI" for unit in base]) + assert (claimable & wages_only & ~joint).any() + + for year in YEARS: + p = SYSTEM.parameters(year).gov.irs.deductions.standard + values = { + variable: np.asarray(simulation.calculate(variable, year)) + for variable in ( + "standard_deduction_worksheet_earned_income", + "basic_standard_deduction", + "standard_deduction", + "tax_unit_is_required_to_file", + "or_standard_deduction", + "hi_deductions", + "hi_standard_deduction", + ) + } + values["medicaid_head"] = head_values( + simulation, batch, "medicaid_person_is_required_to_file", year + ) + + # 1. Deferral invariance. + for variable, value in values.items(): + np.testing.assert_array_equal( + value[rows["base"]], + value[rows["twin"]], + err_msg=f"{year}: {variable} depends on the deferral, not box 1", + ) + + # 2. Bounds. + regular = np.where(joint, p.amount["JOINT"], p.amount["SINGLE"]) + basic = values["basic_standard_deduction"][rows["base"]] + assert (basic[claimable] <= regular[claimable] + 1e-6).all(), year + assert (basic[claimable] >= p.dependent.amount - 1e-6).all(), year + np.testing.assert_allclose(basic[~claimable], regular[~claimable]) + hi_limited = values["hi_deductions"][rows["base"]][hi] + hi_regular = values["hi_standard_deduction"][rows["base"]][hi] + assert (hi_limited <= hi_regular + 1e-6).all(), year + + # 3. Monotonicity in box 1 wages, both ways. + for variable in ( + "standard_deduction_worksheet_earned_income", + "basic_standard_deduction", + "or_standard_deduction", + "hi_deductions", + ): + value = values[variable] + assert (value[rows["raised"]] >= value[rows["base"]] - 1e-6).all(), ( + f"{year}: {variable} falls with more box 1 wages" + ) + assert (value[rows["deferred"]] <= value[rows["base"]] + 1e-6).all(), ( + f"{year}: {variable} rises with a larger deferral" + ) + + # 4. Reference, for units with wages and deferrals only. + worksheet = values["standard_deduction_worksheet_earned_income"][rows["base"]] + expected_worksheet = np.array( + [ + sum( + max(a["employment_income"] - a["traditional_401k_contributions"], 0) + for a in unit["adults"] + ) + for unit in base + ] + ) + np.testing.assert_allclose( + worksheet[wages_only], expected_worksheet[wages_only], atol=0.01 + ) + expected_basic = np.minimum( + regular, + np.maximum( + p.dependent.amount, + expected_worksheet + p.dependent.additional_earned_income, + ), + ) + rows_4 = wages_only & claimable + np.testing.assert_allclose(basic[rows_4], expected_basic[rows_4], atol=0.01) + + # 5. Table 2 with box 1 wages as earned income (2025 amounts). + if year == 2025: + single = ~joint & claimable & wages_only + person = [unit["adults"][0] for unit in base] + earned = np.array( + [ + max(a["employment_income"] - a["traditional_401k_contributions"], 0) + for a in person + ] + ) + unearned = np.array([a["taxable_interest_income"] for a in person]) + expected = ( + (unearned > TABLE_2_FLOOR) + | (earned > TABLE_2_EARNED_INCOME_LIMIT) + | ( + earned + unearned + > np.maximum( + TABLE_2_FLOOR, + np.minimum( + earned, + TABLE_2_EARNED_INCOME_LIMIT + - TABLE_2_EARNED_INCOME_ADDITION, + ) + + TABLE_2_EARNED_INCOME_ADDITION, + ) + ) + ) + assert single.any() + # 6. Federal and Medicaid agree for every single claimable filer. + all_single = ~joint & claimable + np.testing.assert_array_equal( + values["medicaid_head"][rows["base"]][all_single], + values["tax_unit_is_required_to_file"][rows["base"]][all_single], + err_msg="2025: Medicaid and federal filing tests differ", + ) + for variable in ("tax_unit_is_required_to_file", "medicaid_head"): + np.testing.assert_array_equal( + values[variable][rows["base"]][single], + expected[single], + err_msg=f"2025: {variable} differs from Table 2 on box 1 wages", + ) diff --git a/policyengine_us/tests/core/test_disability_filing_invariants.py b/policyengine_us/tests/core/test_disability_filing_invariants.py index 97df448dcf4..cc2617c1442 100644 --- a/policyengine_us/tests/core/test_disability_filing_invariants.py +++ b/policyengine_us/tests/core/test_disability_filing_invariants.py @@ -25,11 +25,11 @@ retain the dependent worksheet in every year (decision d1395): https://www.law.cornell.edu/uscode/text/26/6012 -The Medicaid reference applies Table 2 to each person's gross and earned -income. The deduction worksheet additionally subtracts Schedule 1 line 15. -Elective deferrals are zero: the pre-existing worksheet/Medicaid treatment of -deferrals is review P3-4, reserved for a separate change. These properties -concern section 6012's income tests, not separate Schedule SE filing duties. +The federal deduction worksheet and Medicaid Table 2 reference use W-2 box 1 +wages after elective deferrals, plus earned disability and business income, +less Schedule 1 line 15 (2025 Form 1040 instructions, pp. 25 and 35). +These properties concern section 6012's income tests, not separate Schedule +SE filing duties. """ import numpy as np @@ -56,6 +56,7 @@ def filer(**inputs): "is_blind": False, "claimed_as_dependent_on_another_return": True, "employment_income": 0, + "traditional_401k_contributions": 0, "self_employment_income": 0, "taxable_interest_income": 0, "disability_benefits": 0, @@ -67,11 +68,14 @@ def filer(**inputs): @st.composite def filers(draw): + wages = draw(st.integers(0, 30_000)) return filer( age=draw(st.sampled_from([19, 40, 64, 65, 66, 80])), is_blind=draw(st.booleans()), claimed_as_dependent_on_another_return=draw(st.booleans()), - employment_income=draw(st.integers(0, 30_000)), + employment_income=wages, + # The 2024 elective-deferral limit is the smallest across YEARS. + traditional_401k_contributions=draw(st.integers(0, min(wages, 23_000))), self_employment_income=draw( st.one_of(st.just(0), st.integers(-10_000, 30_000)) ), @@ -102,13 +106,28 @@ def filers(draw): tax_exempt_disability_benefits=2_000, disability_benefits_before_minimum_retirement_age=6_000, ), - # H2: $6,000 business profit and $5,000 of earned disability. This also - # distinguishes Medicaid's Table 2 earnings from the deduction worksheet. + # H2: $6,000 business profit and $5,000 of earned disability. filer( self_employment_income=6_000, disability_benefits=7_000, disability_benefits_before_minimum_retirement_age=5_000, ), + # Combined deferrals/disability regression in 2025: $15,000 earned and + # gross income, with a $15,450 dependent deduction, means no return. + filer( + employment_income=18_000, + traditional_401k_contributions=6_000, + disability_benefits=3_000, + disability_benefits_before_minimum_retirement_age=3_000, + ), + # Line 15 makes both filing tests true: $2,351 gross exceeds the + # $901 + $1,000 - $63.65 + $450 = $2,287.35 dependent deduction. + filer( + self_employment_income=901, + taxable_interest_income=450, + disability_benefits=1_000, + disability_benefits_before_minimum_retirement_age=1_000, + ), filer(employment_income=2_000, self_employment_income=-5_000), filer(employment_income=2_000, self_employment_income=-100), # Schedule SE line 4a falls just below/above $400 at these profits. @@ -181,7 +200,9 @@ def reference(person, year): earned_disability = min( taxable, max(0, person["disability_benefits_before_minimum_retirement_age"]) ) - wages = person["employment_income"] + wages = max( + 0, person["employment_income"] - person["traditional_401k_contributions"] + ) business = person["self_employment_income"] interest = person["taxable_interest_income"] gross = wages + max(0, business) + interest + taxable @@ -193,8 +214,8 @@ def reference(person, year): # Schedule SE lines 4a, 4c, 12 and 13, below the Social Security cap. net_business = business * 0.9235 line_15 = net_business * 0.153 / 2 if net_business >= 400 else 0 - worksheet_line_1 = max(0, earned - line_15) - worksheet_deduction = min(regular, max(floor, worksheet_line_1 + EARNED_ADDITION)) + worksheet_earned = max(0, earned - line_15) + worksheet_deduction = min(regular, max(floor, worksheet_earned + EARNED_ADDITION)) claimed = person["claimed_as_dependent_on_another_return"] basic = worksheet_deduction if claimed else regular standard = basic + extra @@ -213,11 +234,12 @@ def reference(person, year): # Business losses lower earned income but cannot reclassify wages or # disability pensions as unearned income. table_2_gross_limit = ( - max(floor, min(earned, regular - EARNED_ADDITION) + EARNED_ADDITION) + extra + max(floor, min(worksheet_earned, regular - EARNED_ADDITION) + EARNED_ADDITION) + + extra ) medicaid_required = ( unearned > floor + extra - or earned > regular + extra + or worksheet_earned > regular + extra or gross > table_2_gross_limit ) return { diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.yaml index ec8fd341c06..fe518b9769c 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.yaml @@ -146,6 +146,111 @@ output: medicaid_person_is_required_to_file: true +- name: Case 9, a dependent's earned income is W-2 box 1 wages, after a 401(k) deferral. + # Form 1040 instructions (2025): line 1a is W-2 box 1, which leaves out + # the $6,000 elective deferral. Earned income is $4,000, so the Pub. 501 + # (2025), Table 2 limit is the larger of $1,350 or $4,000 + $450 = $4,450. + # Gross income, $4,000 of wages and $600 of interest, is more than $4,450, + # so the dependent must file. + period: 2025 + input: + people: + person1: + age: 17 + employment_income: 10_000 + traditional_401k_contributions: 6_000 + taxable_interest_income: 600 + tax_units: + tax_unit: + members: [person1] + output: + medicaid_person_is_required_to_file: true + +- name: Case 10, the same box 1 wages without a deferral give the same answer. + # Control for Case 9: $4,000 of wages and $600 of interest; $4,600 is more + # than $4,000 + $450 = $4,450. + period: 2025 + input: + people: + person1: + age: 17 + employment_income: 4_000 + taxable_interest_income: 600 + tax_units: + tax_unit: + members: [person1] + output: + medicaid_person_is_required_to_file: true + +- name: Case 11, wages over the regular amount before a deferral but not after it do not require a return. + # Box 1 wages are $17,000 - $3,000 = $14,000, not more than the $15,750 + # single amount (Table 2, test 2), and gross income of $14,000 is not more + # than $14,000 + $450 = $14,450 (test 3). + period: 2025 + input: + people: + person1: + age: 17 + employment_income: 17_000 + traditional_401k_contributions: 3_000 + tax_units: + tax_unit: + members: [person1] + output: + medicaid_person_is_required_to_file: false + +- name: Case 12, farm income is earned income, not unearned income. + # The Form 1040 dependent worksheet counts Schedule 1 line 6 (farm income) + # as earned income, net of the deductible part of self-employment tax + # (line 15): $2,000 - $2,000 x 0.9235 x 15.3% / 2 = $1,858.70. $2,000 of + # farm income is not unearned income over $1,350, and gross income of + # $2,000 is not more than $1,858.70 + $450 = $2,308.70. The section 6017 + # self-employment tax filing rule is not part of the section 6012(a)(1) + # test that 42 CFR 435.603(d)(2) uses. + period: 2025 + input: + people: + person1: + age: 17 + farm_operations_income: 2_000 + tax_units: + tax_unit: + members: [person1] + output: + medicaid_person_is_required_to_file: false + +- name: Case 13, farm income counts net of the deductible part of self-employment tax. + # Worksheet earned income is $15,000 - $15,000 x 0.9235 x 15.3% / 2 = + # $13,940.28, so the limit is $13,940.28 + $450 = $14,390.28, below the + # $15,750 single amount. Gross income of $15,000 is more than that, so the + # dependent must file, as the federal test finds for the same filer. + period: 2025 + input: + people: + person1: + age: 17 + farm_operations_income: 15_000 + tax_units: + tax_unit: + members: [person1] + output: + medicaid_person_is_required_to_file: true + +- name: Case 14, self-employment income counts net of the deductible part of self-employment tax. + # Same arithmetic as Case 13 for $15,000 of Schedule C income: the limit + # is $14,390.28 and gross income of $15,000 is more than that. + period: 2025 + input: + people: + person1: + age: 17 + self_employment_income: 15_000 + tax_units: + tax_unit: + members: [person1] + output: + medicaid_person_is_required_to_file: true + - name: A dependent's disability pension before minimum retirement age is earned income for the filing threshold. period: 2024 input: @@ -218,9 +323,9 @@ - name: H3b, deferred wages and fully earned disability do not require Medicaid filing # All $5,000 is line 1h pay, leaving no unearned income. The dependent - # deduction used for this test is $4,000 + $5,000 + $450 = $9,450, - # above gross income $6,500. P3-4's wage-deferral worksheet treatment - # is pre-existing and reserved for a separate change. + # deduction used for this test is $1,500 + $5,000 + $450 = $6,950, + # above gross income $6,500 (2025 Form 1040 instructions, p. 35; + # Pub. 501, p. 4, Table 2). Earned wages exclude the $2,500 deferral. period: 2025 input: age: 20 @@ -234,3 +339,28 @@ earned_disability_benefits: 5_000 medicaid_irs_gross_income: 6_500 medicaid_person_is_required_to_file: false + +- name: Deferred wages and earned disability together stay below the Medicaid filing threshold + # 2025 Form 1040 instructions, pp. 25 and 35: line 1a wages are + # $18,000 - $6,000 = $12,000; line 1h disability adds $3,000, making + # worksheet earned income $15,000 and line 4a deduction $15,450. + # https://www.irs.gov/pub/irs-prior/p501--2025.pdf#page=4 + # Pub. 501, Table 2: unearned income is $0; earned income $15,000 is + # below $15,750; gross income $15,000 is below the larger of $1,350 + # or min($15,000, $15,300) + $450 = $15,450. No return is required. + # Counting wages before deferrals, or omitting earned disability from + # worksheet earned income, would incorrectly require filing. + period: 2025 + input: + age: 30 + employment_income: 18_000 + traditional_401k_contributions: 6_000 + disability_benefits: 3_000 + disability_benefits_before_minimum_retirement_age: 3_000 + claimed_as_dependent_on_another_return: true + output: + irs_employment_income: 12_000 + earned_disability_benefits: 3_000 + standard_deduction_worksheet_earned_income_person: 15_000 + medicaid_irs_gross_income: 15_000 + medicaid_person_is_required_to_file: false diff --git a/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml index 55633ed743d..0eb2bb90c54 100644 --- a/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/basic_standard_deduction.yaml @@ -286,6 +286,134 @@ # $3,000 - $3,000 x 0.9235 x 15.3% / 2 = $2,788.06; plus $450 = $3,238.06. basic_standard_deduction: 3238.06 +- name: 2025 dependent filer with a 401(k) deferral uses W-2 box 1 wages on the worksheet + # Form 1040 instructions (2025): worksheet earned income starts from line + # 1z, and line 1a is W-2 box 1, which leaves out the $6,000 elective + # deferral. Earned income is $10,000 - $6,000 = $4,000; $4,000 + $450 = + # $4,450. Gross income, $4,000 of wages and $600 of interest, is more than + # $4,450, so a return is required (Pub. 501 (2025), Table 2). + period: 2025 + input: + people: + head: + age: 20 + employment_income: 10_000 + traditional_401k_contributions: 6_000 + taxable_interest_income: 600 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + state_code: CA + output: + basic_standard_deduction: 4_450 + tax_unit_is_required_to_file: true + +- name: 2025 dependent filer with the same W-2 box 1 wages and no deferral gets the same deduction + # Control for the case above: $4,000 of wages with no deferral gives + # $4,000 + $450 = $4,450, and gross income of $4,600 requires a return. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 4_000 + taxable_interest_income: 600 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + state_code: CA + output: + basic_standard_deduction: 4_450 + tax_unit_is_required_to_file: true + +- name: 2025 dependent filer whose wages before deferral exceed the regular amount but whose W-2 box 1 wages do not + # $17,000 of wages less a $3,000 deferral is $14,000 of box 1 wages; + # $14,000 + $450 = $14,450, below the $15,750 single amount. Gross income, + # $14,000, does not exceed $14,450, so no return is required. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 17_000 + traditional_401k_contributions: 3_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + state_code: CA + output: + basic_standard_deduction: 14_450 + tax_unit_is_required_to_file: false + +- name: 2025 dependent filer with farm income counts it as earned income on the worksheet + # Schedule 1 line 6 (farm income) is in worksheet earned income, net of + # the deductible part of self-employment tax (line 15): + # $3,000 - $3,000 x 0.9235 x 15.3% / 2 = $2,788.06; plus $450 = $3,238.06. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + head: + age: 20 + farm_operations_income: 3_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + state_code: CA + output: + basic_standard_deduction: 3238.06 + +- name: 2025 joint return with a claimable spouse sums both spouses' W-2 box 1 wages + # Box 1 wages are $8,000 - $3,000 = $5,000 and $8,000, so joint earned + # income is $13,000; $13,000 + $450 = $13,450, below the $31,500 joint + # amount. + period: 2025 + input: + people: + person_a: + age: 20 + employment_income: 8_000 + traditional_401k_contributions: 3_000 + claimed_as_dependent_on_another_return: true + is_tax_unit_head: true + is_tax_unit_spouse: false + person_b: + age: 20 + employment_income: 8_000 + claimed_as_dependent_on_another_return: false + is_tax_unit_head: false + is_tax_unit_spouse: true + tax_units: + tax_unit: + members: [person_a, person_b] + filing_status: JOINT + households: + household: + members: [person_a, person_b] + state_code: CA + output: + basic_standard_deduction: 13_450 + - name: A dependent filer's disability pension before minimum retirement age counts as earned income # 2024 Form 1040 instructions, Standard Deduction Worksheet for Dependents: # earned income starts from line 1z, which includes disability pensions @@ -383,7 +511,7 @@ - name: H2, the dependent worksheet combines earned disability with self-employment income net of deductible tax # 2024 Form 1040 Standard Deduction Worksheet for Dependents: line 1h # includes only the $5,000 before minimum retirement age. Schedule 1 - # line 15 is $6,000 x 0.9235 x 15.3% / 2 = $423.89. Worksheet line 1 is + # line 15 is $6,000 x 0.9235 x 15.3% / 2 = $423.89. Worksheet earned income is # $6,000 + $5,000 - $423.89 = $10,576.11, plus $450 = $11,026.11. # The remaining $2,000 of taxable disability is unearned. period: 2024 @@ -411,3 +539,38 @@ basic_standard_deduction: 11_026.11 standard_deduction: 11_026.11 tax_unit_is_required_to_file: true + +- name: 2025 dependent worksheet combines W-2 wages after deferrals with earned disability + # 2025 Form 1040 instructions, pp. 25 and 35: + # https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=35 + # Line 1a is $18,000 - $6,000 = $12,000; line 1h adds the $3,000 + # disability pension, so line 1z and worksheet earned income are $15,000. + # Worksheet line 1: no age/blindness boxes; line 2: $15,000 + $450 = + # $15,450; line 3: $15,750; line 4a: min($15,450, $15,750) = $15,450. + # Pub. 501 (2025), p. 4, Table 2: no unearned income; earned income + # $15,000 < $15,750; gross income $15,000 < $15,450, so no return. + period: 2025 + input: + people: + head: + age: 30 + employment_income: 18_000 + traditional_401k_contributions: 6_000 + disability_benefits: 3_000 + disability_benefits_before_minimum_retirement_age: 3_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + output: + irs_employment_income: 12_000 + earned_disability_benefits: 3_000 + standard_deduction_worksheet_earned_income_person: 15_000 + standard_deduction_worksheet_earned_income: 15_000 + irs_gross_income: 15_000 + basic_standard_deduction: 15_450 + tax_unit_is_required_to_file: false diff --git a/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/standard_deduction_worksheet_earned_income.yaml b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/standard_deduction_worksheet_earned_income.yaml new file mode 100644 index 00000000000..2d303c7ebde --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/standard_deduction_worksheet_earned_income.yaml @@ -0,0 +1,182 @@ +- name: Wages count as reported in W-2 box 1, after a 401(k) deferral + # Form 1040 instructions (2025): line 1a is W-2 box 1, and an elective + # deferral is not included in box 1. $10,000 - $6,000 = $4,000. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 10_000 + traditional_401k_contributions: 6_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 4_000 + +- name: Pretax health premiums and HSA payroll contributions are also left out of box 1 wages + # $10,000 - $1,000 - $500 = $8,500. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 10_000 + pre_tax_health_insurance_premiums: 1_000 + health_savings_account_payroll_contributions: 500 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 8_500 + +- name: Designated Roth 401(k) contributions stay in box 1 wages + # 2025 Form 1040 instructions, IRA deduction worksheet, note 3: "Except for + # designated Roth contributions, these amounts aren't included as income + # in box 1 of your Form W-2." + period: 2025 + input: + people: + head: + age: 20 + employment_income: 10_000 + roth_401k_contributions: 2_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 10_000 + +- name: Self-employment income is net of the deductible part of self-employment tax + # $3,000 - $3,000 x 0.9235 x 15.3% / 2 = $2,788.06. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + head: + age: 20 + self_employment_income: 3_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 2788.06 + +- name: Farm income (Schedule 1 line 6) counts, net of the deductible part of self-employment tax + # $3,000 - $3,000 x 0.9235 x 15.3% / 2 = $2,788.06. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + head: + age: 20 + farm_operations_income: 3_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 2788.06 + +- name: A farm loss reduces earned income + # $5,000 of wages less a $2,000 farm loss is $3,000; a loss owes no + # self-employment tax. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 5_000 + farm_operations_income: -2_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 3_000 + +- name: Earned income is not negative + # $1,000 of wages less a $5,000 business loss is floored at $0. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 1_000 + self_employment_income: -5_000 + tax_units: + tax_unit: + members: [head] + households: + household: + members: [head] + output: + standard_deduction_worksheet_earned_income: 0 + +- name: A joint return sums both spouses' box 1 wages and leaves out a dependent's wages + # Head $8,000 - $3,000 = $5,000; spouse $8,000; the dependent child's + # $2,000 belongs on the child's own return. $5,000 + $8,000 = $13,000. + period: 2025 + input: + people: + head: + age: 30 + employment_income: 8_000 + traditional_401k_contributions: 3_000 + is_tax_unit_head: true + spouse: + age: 30 + employment_income: 8_000 + is_tax_unit_spouse: true + child: + age: 10 + employment_income: 2_000 + is_tax_unit_dependent: true + tax_units: + tax_unit: + members: [head, spouse, child] + filing_status: JOINT + households: + household: + members: [head, spouse, child] + output: + standard_deduction_worksheet_earned_income: 13_000 + +- name: On a joint return one spouse's business loss offsets the other spouse's wages before the zero floor + # $5,000 of wages less the spouse's $3,000 loss is $2,000. + period: 2025 + input: + people: + head: + age: 30 + employment_income: 5_000 + is_tax_unit_head: true + spouse: + age: 30 + self_employment_income: -3_000 + is_tax_unit_spouse: true + tax_units: + tax_unit: + members: [head, spouse] + filing_status: JOINT + households: + household: + members: [head, spouse] + output: + standard_deduction_worksheet_earned_income: 2_000 diff --git a/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/standard_deduction_worksheet_earned_income_person.yaml b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/standard_deduction_worksheet_earned_income_person.yaml new file mode 100644 index 00000000000..d7b5dc6b38c --- /dev/null +++ b/policyengine_us/tests/policy/baseline/gov/irs/deductions/standard/standard_deduction_worksheet_earned_income_person.yaml @@ -0,0 +1,35 @@ +- name: A person's wages count as reported in W-2 box 1, after a 401(k) deferral + # $10,000 - $6,000 = $4,000. + period: 2025 + input: + people: + person: + age: 17 + employment_income: 10_000 + traditional_401k_contributions: 6_000 + output: + standard_deduction_worksheet_earned_income_person: 4_000 + +- name: Farm income counts net of the deductible part of self-employment tax + # $15,000 - $15,000 x 0.9235 x 15.3% / 2 = $13,940.28. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person: + age: 17 + farm_operations_income: 15_000 + output: + standard_deduction_worksheet_earned_income_person: 13_940.28 + +- name: A loss is kept, not floored, so a joint return can net it against the other spouse + # $1,000 of wages less a $5,000 business loss. + period: 2025 + input: + people: + person: + age: 17 + employment_income: 1_000 + self_employment_income: -5_000 + output: + standard_deduction_worksheet_earned_income_person: -4_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/hi_deductions.yaml b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/hi_deductions.yaml index 56eb95f2a84..61691fd2025 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/hi_deductions.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/hi/tax/income/deductions/hi_deductions.yaml @@ -3,7 +3,7 @@ input: state_code: HI filing_status: JOINT - tax_unit_earned_income: 1_000 + standard_deduction_worksheet_earned_income: 1_000 hi_agi: 1_000 hi_total_itemized_deductions: 5_000 hi_reduced_itemized_deductions: 1_000 @@ -16,7 +16,7 @@ input: state_code: HI filing_status: JOINT - tax_unit_earned_income: 1_000_000 + standard_deduction_worksheet_earned_income: 1_000_000 hi_agi: 1_000_000 hi_total_itemized_deductions: 5_000 hi_reduced_itemized_deductions: 1_000 @@ -29,7 +29,7 @@ input: state_code: HI filing_status: JOINT - tax_unit_earned_income: 1_000 + standard_deduction_worksheet_earned_income: 1_000 hi_agi: 1_000 hi_total_itemized_deductions: 1_000 hi_reduced_itemized_deductions: 1_000 @@ -42,7 +42,7 @@ input: state_code: HI filing_status: SEPARATE - tax_unit_earned_income: 1_000_000 + standard_deduction_worksheet_earned_income: 1_000_000 hi_agi: 1_000_000 hi_total_itemized_deductions: 5_000 hi_reduced_itemized_deductions: 1_000 @@ -55,7 +55,7 @@ input: state_code: HI filing_status: JOINT - tax_unit_earned_income: 1_000_000 + standard_deduction_worksheet_earned_income: 1_000_000 hi_agi: 1_000_000 hi_total_itemized_deductions: 5_000 hi_reduced_itemized_deductions: 4_500 @@ -90,7 +90,7 @@ tax_unit: members: [person_a, person_b] filing_status: JOINT - tax_unit_earned_income: 3_000 + standard_deduction_worksheet_earned_income: 3_000 hi_itemized_deductions: 0 households: household: @@ -118,7 +118,7 @@ tax_unit: members: [person_b, person_a] filing_status: JOINT - tax_unit_earned_income: 3_000 + standard_deduction_worksheet_earned_income: 3_000 hi_itemized_deductions: 0 households: household: @@ -146,7 +146,7 @@ tax_unit: members: [person_a, person_b] filing_status: JOINT - tax_unit_earned_income: 3_000 + standard_deduction_worksheet_earned_income: 3_000 hi_itemized_deductions: 4_000 households: household: @@ -174,7 +174,7 @@ tax_unit: members: [person_b, person_a] filing_status: JOINT - tax_unit_earned_income: 3_000 + standard_deduction_worksheet_earned_income: 3_000 hi_itemized_deductions: 4_000 households: household: @@ -190,7 +190,7 @@ state_code: HI filing_status: SINGLE claimed_as_dependent_on_another_return: true - tax_unit_earned_income: 300 + standard_deduction_worksheet_earned_income: 300 hi_itemized_deductions: 0 output: # HRS 235-2.4(a)(3): greater of $500 or earned income ($300). @@ -276,3 +276,48 @@ output: # $3,000 - $3,000 x 0.9235 x 15.3% / 2 = $2,788.06, below the $8,800 joint amount. hi_deductions: 2788.06 + +- name: 2025 single dependent filer with a 401(k) deferral uses W-2 box 1 wages + # N-11 instructions (2025), PDF page 20: earned income is federal Form 1040 + # line 1 wages, which are W-2 box 1 and leave out the $2,000 elective + # deferral. Greater of $500 or $3,000 - $2,000 = $1,000. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 3_000 + traditional_401k_contributions: 2_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + hi_itemized_deductions: 0 + households: + household: + members: [head] + state_code: HI + output: + hi_deductions: 1_000 + +- name: 2025 single dependent filer with the same box 1 wages and no deferral gets the same deduction + # Control for the case above: greater of $500 or $1,000 of wages. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 1_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + hi_itemized_deductions: 0 + households: + household: + members: [head] + state_code: HI + output: + hi_deductions: 1_000 diff --git a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml index c040dee6619..8c539d076fa 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/or/tax/income/deductions/standard/or_standard_deduction.yaml @@ -69,7 +69,7 @@ filing_status: JOINT age_head: 35 claimed_as_dependent_on_another_return: true - tax_unit_earned_income: 600 + standard_deduction_worksheet_earned_income: 600 output: # $1100 base or_standard_deduction: 1_100 @@ -81,7 +81,7 @@ filing_status: SINGLE age_head: 35 claimed_as_dependent_on_another_return: true - tax_unit_earned_income: 1_000 + standard_deduction_worksheet_earned_income: 1_000 output: # $1000 income + $350 addition, below the $2,350 normal standard deduction cap. or_standard_deduction: 1_350 @@ -93,7 +93,7 @@ filing_status: SINGLE age: 35 claimed_as_dependent_on_another_return: true - tax_unit_earned_income: 1_000 + standard_deduction_worksheet_earned_income: 1_000 blind_head: true output: # $1000 income + $350 addition + $1200 blind @@ -156,7 +156,7 @@ tax_unit: members: [person_a, person_b] filing_status: JOINT - tax_unit_earned_income: 3_000 + standard_deduction_worksheet_earned_income: 3_000 households: household: members: [person_a, person_b] @@ -183,7 +183,7 @@ tax_unit: members: [person_b, person_a] filing_status: JOINT - tax_unit_earned_income: 3_000 + standard_deduction_worksheet_earned_income: 3_000 households: household: members: [person_b, person_a] @@ -213,3 +213,47 @@ # $1,500 - $1,500 x 0.9235 x 15.3% / 2 = $1,394.03; plus $450 = $1,844.03, # above the $1,350 minimum and below the $2,835 single amount. or_standard_deduction: 1844.03 + +- name: 2025 dependent filer with a 401(k) deferral uses W-2 box 1 wages + # Earned income is figured as in the federal worksheet, from W-2 box 1, + # which leaves out the $2,000 elective deferral: $3,000 - $2,000 = $1,000; + # $1,000 + $450 = $1,450, above the $1,350 minimum and below the $2,835 + # single amount. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 3_000 + traditional_401k_contributions: 2_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + state_code: OR + output: + or_standard_deduction: 1_450 + +- name: 2025 dependent filer with the same box 1 wages and no deferral gets the same deduction + # Control for the case above: $1,000 + $450 = $1,450. + period: 2025 + input: + people: + head: + age: 20 + employment_income: 1_000 + claimed_as_dependent_on_another_return: true + tax_units: + tax_unit: + members: [head] + filing_status: SINGLE + households: + household: + members: [head] + state_code: OR + output: + or_standard_deduction: 1_450 diff --git a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.py b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.py index f5b3d7f9796..dc9576b1946 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.py +++ b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_person_is_required_to_file.py @@ -3,13 +3,6 @@ FilingStatus, ) -# The wage and self-employment sources in gov.irs.gross_income.sources. -EARNED_GROSS_INCOME_SOURCES = [ - "irs_employment_income", - "self_employment_income", - "sstb_self_employment_income", -] - class medicaid_person_is_required_to_file(Variable): value_type = bool @@ -20,23 +13,32 @@ class medicaid_person_is_required_to_file(Variable): "https://www.law.cornell.edu/cfr/text/42/435.603#d_2", "https://www.irs.gov/publications/p501", "https://www.irs.gov/pub/irs-prior/p501--2025.pdf#page=4", + # Form 1040 instructions: line 1a is Form(s) W-2, box 1 (PDF page 23), + # which leaves out elective deferrals (page 25); the Standard + # Deduction Worksheet for Dependents' earned income subtracts Schedule + # 1, line 15 (page 35). + # PDF pages 23, 25, 35 + "https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=23", ) def formula(person, period, parameters): standard = parameters(period).gov.irs.deductions.standard filing_requirement = parameters(period).gov.irs.income.filing_requirement gross_income = person("medicaid_irs_gross_income", period) - # Disability pensions reported as wages before minimum retirement - # age are earned income. - earned_income = add( - person, period, ["earned_income", "earned_disability_benefits"] + # Earned income is figured as on the IRS dependent worksheet, which + # sets the limited standard deduction the gross income test compares + # against: W-2 box 1 wages (which leave out elective deferrals) plus + # earned disability benefits and business and farm income, minus + # deductible self-employment tax, and not below zero. + earned_income = max_( + person("standard_deduction_worksheet_earned_income_person", period), 0 ) - # Unearned income is gross income other than wages and self-employment - # earnings (IRS Pub. 501, Table 2). Gross income counts each source's - # positive amount, so subtract those sources' positive amounts: a - # business loss does not turn other income into unearned income. + # Unearned income is gross income other than earned income (IRS Pub. + # 501, Table 2). Gross income counts each source's positive amount, so + # subtract those sources' positive amounts: a business loss does not + # turn other income into unearned income. earned_gross_income = 0 - for source in EARNED_GROSS_INCOME_SOURCES: + for source in filing_requirement.dependent.earned_income_sources: earned_gross_income += max_(0, person(source, period)) earned_gross_income += person("earned_disability_benefits", period) unearned_income = max_(0, gross_income - earned_gross_income) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py index 9a6e4f56988..68386ca8890 100644 --- a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/basic_standard_deduction.py @@ -25,15 +25,10 @@ def formula(tax_unit, period, parameters): # can be claimed. dependent_elsewhere = tax_unit("head_or_spouse_is_dependent_elsewhere", period) standard_deduction = p.amount[filing_status] - # Worksheet earned income: wages and self-employment income minus the - # deductible part of self-employment tax (Schedule 1, line 15). - worksheet_earned_income = max_( - tax_unit("tax_unit_earned_income", period) - # Disability pensions reported on Form 1040 line 1h count - # as earned income on the worksheet (line 1z). - + tax_unit_non_dep_sum("earned_disability_benefits", tax_unit, period) - - tax_unit("self_employment_tax_ald", period), - 0, + # Worksheet earned income: W-2 box 1 wages, earned disability benefits, + # business and farm income, minus deductible self-employment tax. + worksheet_earned_income = tax_unit( + "standard_deduction_worksheet_earned_income", period ) standard_deduction_if_dependent = min_( standard_deduction, diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/standard_deduction_worksheet_earned_income.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/standard_deduction_worksheet_earned_income.py new file mode 100644 index 00000000000..344153b6770 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/standard_deduction_worksheet_earned_income.py @@ -0,0 +1,34 @@ +from policyengine_us.model_api import * + + +class standard_deduction_worksheet_earned_income(Variable): + value_type = float + entity = TaxUnit + label = "Earned income for the standard deduction worksheet for dependents" + unit = USD + documentation = ( + "Earned income of the head and spouse on the Standard Deduction " + "Worksheet for Dependents: wages from Form W-2 box 1, which leave out " + "elective deferrals, plus earned disability benefits and business " + "and farm income, minus the " + "deductible part of self-employment tax, and not below zero." + ) + definition_period = YEAR + reference = ( + "https://www.law.cornell.edu/uscode/text/26/63#c_5", + # Standard Deduction Worksheet for Dependents, Form 1040 instructions. + "https://www.irs.gov/pub/irs-prior/i1040gi--2024.pdf#page=34", + "https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=35", + # Publication 501, Table 8, line 1: "Enter your earned income (defined + # below). If none, enter -0-." + "https://www.irs.gov/pub/irs-prior/p501--2025.pdf#page=26", + ) + + def formula(tax_unit, period, parameters): + # The head's and spouse's amounts: a dependent's earnings belong on + # the dependent's own return. A joint return sums both spouses' + # amounts before the zero floor. + earned_income = tax_unit_non_dep_sum( + "standard_deduction_worksheet_earned_income_person", tax_unit, period + ) + return max_(earned_income, 0) diff --git a/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/standard_deduction_worksheet_earned_income_person.py b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/standard_deduction_worksheet_earned_income_person.py new file mode 100644 index 00000000000..5a05312d207 --- /dev/null +++ b/policyengine_us/variables/gov/irs/income/taxable_income/deductions/standard_deduction/standard_deduction_worksheet_earned_income_person.py @@ -0,0 +1,45 @@ +from policyengine_us.model_api import * + + +class standard_deduction_worksheet_earned_income_person(Variable): + value_type = float + entity = Person + label = ( + "Earned income for the standard deduction worksheet for dependents, by person" + ) + unit = USD + documentation = ( + "A person's earned income on the Standard Deduction Worksheet for " + "Dependents: wages from Form W-2 box 1, which leave out elective " + "deferrals, plus disability pensions reported as wages before minimum " + "retirement age and business and farm income, minus the deductible part " + "of their self-employment tax. Not floored at zero, so that on a " + "joint return one spouse's loss offsets the other's earnings." + ) + definition_period = YEAR + reference = ( + "https://www.law.cornell.edu/uscode/text/26/63#c_5", + # Form 1040 instructions. Line 1a is the total of Form(s) W-2, box 1 + # (PDF page 23). An elective deferral "isn't included as income in + # box 1 of your Form W-2" (page 25). Worksheet footnote: "Generally, + # your earned income is the total of the amount(s) you reported on + # Form 1040 or 1040-SR, line 1z, and Schedule 1, lines 3, 6, 8r, 8t, + # and 8u minus the amount, if any, on Schedule 1, line 15" (page 34 + # in 2024, page 35 in 2025). + # PDF pages 23, 25, 34 + "https://www.irs.gov/pub/irs-prior/i1040gi--2024.pdf#page=23", + # PDF pages 23, 25, 35 + "https://www.irs.gov/pub/irs-prior/i1040gi--2025.pdf#page=23", + ) + + def formula(person, period, parameters): + p = parameters(period).gov.irs.income.filing_requirement.dependent + # Form 1040 line 1z wages (irs_employment_income, after elective + # deferrals and other pretax payroll deductions) and Schedule 1 lines + # 3 and 6. A business or farm loss reduces the total. + earned_income = add(person, period, p.earned_income_sources) + # Form 1040 line 1h disability pensions are part of line 1z, but + # are modeled separately from irs_employment_income. + earned_income = earned_income + person("earned_disability_benefits", period) + # Schedule 1, line 15: the deductible part of self-employment tax. + return earned_income - person("self_employment_tax_ald_person", period) 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 fe50a345a3c..38e5e40180f 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 @@ -21,7 +21,6 @@ def formula(tax_unit, period, parameters): standard_deduction = tax_unit("hi_standard_deduction", period) total_itemized_deduction = tax_unit("hi_itemized_deductions", period) - tax_unit_earned_income = tax_unit("tax_unit_earned_income", period) filing_status = tax_unit("filing_status", period) # check itemized deduction eligibility @@ -35,10 +34,11 @@ def formula(tax_unit, period, parameters): is_dependent_on_another_return = tax_unit( "head_or_spouse_is_dependent_elsewhere", period ) - # Worksheet earned income: wages and self-employment income minus the - # deductible part of self-employment tax (Schedule 1, line 15). - worksheet_earned_income = max_( - tax_unit_earned_income - tax_unit("self_employment_tax_ald", period), 0 + # 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 diff --git a/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py b/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py index 54d2dc18fbc..dd9293000a1 100644 --- a/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py +++ b/policyengine_us/variables/gov/states/or/tax/income/deductions/or_standard_deduction.py @@ -11,7 +11,8 @@ class or_standard_deduction(Variable): reference = ( "https://www.oregon.gov/dor/forms/FormsPubs/form-or-40-inst_101-040-1_2021.pdf#page=18", "https://www.oregonlegislature.gov/bills_laws/ors/ors316.html", # ORS 316.695(7)-(8) - "https://www.oregon.gov/dor/forms/FormsPubs/publication-or-17_101-431_2025.pdf#page=96", + # Earned income definition and dependent worksheets, PDF pages 95-96 + "https://www.oregon.gov/dor/forms/FormsPubs/publication-or-17_101-431_2025.pdf#page=95", ) defined_for = StateCode.OR @@ -21,13 +22,9 @@ def formula(tax_unit, period, parameters): filing_status = tax_unit("filing_status", period) initial_core_deduction = p.amount[filing_status] # Replace if claimable as a dependent. Earned income is figured as in - # the federal worksheet, net of the deductible part of self-employment - # tax (Schedule 1, line 15). - earned_income = max_( - tax_unit("tax_unit_earned_income", period) - - tax_unit("self_employment_tax_ald", period), - 0, - ) + # the federal worksheet: W-2 box 1 wages, business and farm income, + # net of the deductible part of self-employment tax. + earned_income = tax_unit("standard_deduction_worksheet_earned_income", period) claimable_dep_floor = p.claimable_as_dependent.min claimable_dep_earned_amount = ( earned_income + p.claimable_as_dependent.earned_income_addition