diff --git a/changelog.d/base-mode-uprating.changed.md b/changelog.d/base-mode-uprating.changed.md new file mode 100644 index 00000000000..7c4a41731bb --- /dev/null +++ b/changelog.d/base-mode-uprating.changed.md @@ -0,0 +1 @@ +Project the standard deduction, child tax credit and long-term care premium limits from their statutory base-year amounts with core's base-mode uprating, so each year rounds the increase over the base instead of chaining from the last rounded value; the joint and surviving spouse standard deductions now equal twice the single amount in every year. Move the dependent standard deduction, educator expense cap, HSA limits, Oregon Kids' Credit and NYC income tax elimination credit projections from hand-coded extensions to the same mechanism. Encode the dependent standard deduction's earned income addition from 1998 ($250, then $300 from 2006). Under the Trustees core-thresholds reform, amounts on base-mode uprating round their wage-indexed increase over the statutory base, so the head of household standard deduction stays $23,625 plus whole $50 steps; `trustees_core_threshold_parameters` lists every parameter the reform re-projects. diff --git a/policyengine_us/parameters/gov/bls/cpi/c_cpi_u_medical_care_august.yaml b/policyengine_us/parameters/gov/bls/cpi/c_cpi_u_medical_care_august.yaml new file mode 100644 index 00000000000..0ee9d75c167 --- /dev/null +++ b/policyengine_us/parameters/gov/bls/cpi/c_cpi_u_medical_care_august.yaml @@ -0,0 +1,40 @@ +description: The Bureau of Labor Statistics publishes this August value of the medical care component of the Chained Consumer Price Index for All Urban Consumers, which 26 U.S.C. 213(d)(10)(B)(ii) uses to index the long-term care premium limits from 2018. +values: + # BLS series SUUR0000SAM (U.S. city average, medical care, December + # 1999=100), from the BLS public data API on November 9, 2026. The API + # footnotes the August 2026 value "Initial"; the earlier values carry no + # footnote. + 2000-08-01: 103.1 + 2001-08-01: 107.7 + 2002-08-01: 112.6 + 2003-08-01: 116.8 + 2004-08-01: 121.9 + 2005-08-01: 126.7 + 2006-08-01: 132.0 + 2007-08-01: 137.559 + 2008-08-01: 141.727 + 2009-08-01: 145.976 + 2010-08-01: 150.342 + 2011-08-01: 154.833 + 2012-08-01: 161.288 + 2013-08-01: 165.308 + 2014-08-01: 168.514 + 2015-08-01: 172.579 + 2016-08-01: 181.028 + 2017-08-01: 183.999 + 2018-08-01: 186.317 + 2019-08-01: 192.296 + 2020-08-01: 198.805 + 2021-08-01: 200.660 + 2022-08-01: 211.077 + 2023-08-01: 207.307 + 2024-08-01: 213.326 + 2025-08-01: 219.791 + 2026-08-01: 222.917 +metadata: + unit: /1 + label: Chained CPI-U medical care, August + economy: false + reference: + - title: BLS | Chained CPI-U, U.S. city average, medical care (SUUR0000SAM) + href: https://data.bls.gov/timeseries/SUUR0000SAM diff --git a/policyengine_us/parameters/gov/bls/cpi/cpi_u_medical_care_nsa_august.yaml b/policyengine_us/parameters/gov/bls/cpi/cpi_u_medical_care_nsa_august.yaml new file mode 100644 index 00000000000..c68f9c8cb6a --- /dev/null +++ b/policyengine_us/parameters/gov/bls/cpi/cpi_u_medical_care_nsa_august.yaml @@ -0,0 +1,42 @@ +description: The Bureau of Labor Statistics publishes this August value of the medical care component of the Consumer Price Index for All Urban Consumers, not seasonally adjusted, which 26 U.S.C. 213(d)(10)(B)(ii) uses to index the long-term care premium limits. +values: + # BLS series CUUR0000SAM (U.S. city average, medical care, 1982-84=100), + # from the BLS public data API on November 9, 2026. + 1996-08-01: 229.2 + 1997-08-01: 235.2 + 1998-08-01: 243.5 + 1999-08-01: 251.9 + 2000-08-01: 262.6 + 2001-08-01: 274.4 + 2002-08-01: 287.3 + 2003-08-01: 298.4 + 2004-08-01: 311.6 + 2005-08-01: 323.9 + 2006-08-01: 337.7 + 2007-08-01: 352.961 + 2008-08-01: 364.477 + 2009-08-01: 376.537 + 2010-08-01: 388.467 + 2011-08-01: 400.874 + 2012-08-01: 417.123 + 2013-08-01: 426.866 + 2014-08-01: 435.777 + 2015-08-01: 446.536 + 2016-08-01: 468.379 + 2017-08-01: 476.869 + 2018-08-01: 484.172 + 2019-08-01: 500.916 + 2020-08-01: 523.295 + 2021-08-01: 525.247 + 2022-08-01: 553.429 + 2023-08-01: 548.082 + 2024-08-01: 564.407 + 2025-08-01: 583.875 + 2026-08-01: 593.003 +metadata: + unit: /1 + label: CPI-U medical care, not seasonally adjusted, August + economy: false + reference: + - title: BLS | CPI-U, U.S. city average, medical care, not seasonally adjusted (CUUR0000SAM) + href: https://data.bls.gov/timeseries/CUUR0000SAM diff --git a/policyengine_us/parameters/gov/irs/ald/educator_expense/cap.yaml b/policyengine_us/parameters/gov/irs/ald/educator_expense/cap.yaml index df1939db6c6..0195879b430 100644 --- a/policyengine_us/parameters/gov/irs/ald/educator_expense/cap.yaml +++ b/policyengine_us/parameters/gov/irs/ald/educator_expense/cap.yaml @@ -20,16 +20,17 @@ metadata: unit: currency-USD period: year label: Educator expense deduction cap - # Values after the last IRS publication are computed in - # parameters/uprating_extensions.py per 26 U.S.C. 62(d)(3): the statutory - # $250 increased by the 1(f)(3) cost-of-living adjustment with calendar - # year 2014 as the base year, each increase rounded to the nearest multiple - # of $50. Computing from the $250 base rather than chaining from the - # rounded $350 puts each projected $50 step in the year the statute does on - # the model's CPI projection; those values supersede this uprating rule, - # which describes the index and rounding. uprating: - parameter: gov.irs.uprating + # 26 U.S.C. 62(d)(3): the statutory $250 plus its 1(f)(3) cost-of-living + # increase with calendar year 2014 as the base year, rounded to the + # nearest multiple of $50. The index's 2015 value covers calendar year + # 2014. Projecting from the $250 base rather than chaining from a rounded + # published value puts each $50 step in the year the statute does. + parameter: gov.irs.indexing.c_cpi_u + base: + period: 2015 + value: 250 + floor: true rounding: type: nearest interval: 50 diff --git a/policyengine_us/parameters/gov/irs/credits/ctc/amount/base.yaml b/policyengine_us/parameters/gov/irs/credits/ctc/amount/base.yaml index b30e3c8d95c..91fe918fdcd 100644 --- a/policyengine_us/parameters/gov/irs/credits/ctc/amount/base.yaml +++ b/policyengine_us/parameters/gov/irs/credits/ctc/amount/base.yaml @@ -18,6 +18,20 @@ brackets: metadata: uprating: parameter: gov.irs.uprating + # 26 U.S.C. 24(i)(2) and (3): the $2,200 in 24(h)(2), plus its 1(f)(3) + # cost-of-living increase with calendar year 2024 as the base year, + # rounded down to a multiple of $100. The index's 2025 value covers + # calendar year 2024. Base mode adds values only after the last + # value above. Like the standard deduction, this stays on + # gov.irs.uprating, whose window ends in July (#9105; open #9621 + # moves it), not gov.irs.indexing.c_cpi_u, which the dependent + # amounts and educator cap use. gov.irs.uprating runs 0.6% to 1.0% + # below that index in 2028-2030 and about 1.0% below through 2037; + # gov/irs/deductions/standard/amount.yaml explains the split. + base: + period: 2025 + value: 2_200 + floor: true rounding: type: downwards interval: 100 @@ -30,9 +44,6 @@ brackets: href: https://www.irs.gov/pub/irs-drop/rp-26-35.pdf#page=8 - title: 2026 IRS data release href: https://www.irs.gov/pub/irs-drop/rp-25-32.pdf#page=14 - # IRC §24(i)(2) adjusts the $2,200 statutory base using 2024 as reference year. - # Current implementation uses incremental uprating from latest value, which - # produces correct results but differs from statutory base-year calculation. - threshold: values: 2013-01-01: 17 diff --git a/policyengine_us/parameters/gov/irs/credits/ctc/refundable/individual_max.yaml b/policyengine_us/parameters/gov/irs/credits/ctc/refundable/individual_max.yaml index 8ad692ca1ec..23e852eaef4 100644 --- a/policyengine_us/parameters/gov/irs/credits/ctc/refundable/individual_max.yaml +++ b/policyengine_us/parameters/gov/irs/credits/ctc/refundable/individual_max.yaml @@ -22,6 +22,20 @@ metadata: label: Child tax credit refundable maximum amount uprating: parameter: gov.irs.uprating + # 26 U.S.C. 24(i)(1) and (3): the $1,400 in 24(h)(5), plus its 1(f)(3) + # cost-of-living increase with calendar year 2017 as the base year, + # rounded down to a multiple of $100. The index's 2018 value covers + # calendar year 2017. Base mode adds values only after CBO's, above. + # Like the standard deduction, this stays on gov.irs.uprating, whose + # window ends in July (#9105; open #9621 moves it), not + # gov.irs.indexing.c_cpi_u, which the dependent amounts and educator cap + # use. gov.irs.uprating runs 0.6% to 1.0% below that index in 2028-2030 + # and about 1.0% below through 2037; + # gov/irs/deductions/standard/amount.yaml explains the split. + base: + period: 2018 + value: 1_400 + floor: true rounding: type: downwards interval: 100 @@ -48,6 +62,3 @@ metadata: href: https://www.irs.gov/pub/irs-drop/rp-19-44.pdf#page=10 - title: 2019 IRS data release href: https://www.irs.gov/pub/irs-drop/rp-18-57.pdf#page=12 - # IRC §24(i)(1) adjusts the $1,400 statutory base using 2017 as reference year. - # Current implementation uses incremental uprating from latest value, which - # produces correct results but differs from statutory base-year calculation. diff --git a/policyengine_us/parameters/gov/irs/deductions/itemized/medical/long_term_care_premium_limit.yaml b/policyengine_us/parameters/gov/irs/deductions/itemized/medical/long_term_care_premium_limit.yaml index 3c5896ffbfc..c63983ac966 100644 --- a/policyengine_us/parameters/gov/irs/deductions/itemized/medical/long_term_care_premium_limit.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/itemized/medical/long_term_care_premium_limit.yaml @@ -25,7 +25,11 @@ brackets: 2027-01-01: 500 metadata: uprating: - parameter: gov.bls.cpi.cpi_u_medical_care + parameter: gov.irs.indexing.medical_care_c_cpi_u + base: + period: 1997 + value: 200 + floor: true rounding: type: nearest interval: 10 @@ -53,7 +57,11 @@ brackets: 2027-01-01: 945 metadata: uprating: - parameter: gov.bls.cpi.cpi_u_medical_care + parameter: gov.irs.indexing.medical_care_c_cpi_u + base: + period: 1997 + value: 375 + floor: true rounding: type: nearest interval: 10 @@ -79,7 +87,11 @@ brackets: 2027-01-01: 1_890 metadata: uprating: - parameter: gov.bls.cpi.cpi_u_medical_care + parameter: gov.irs.indexing.medical_care_c_cpi_u + base: + period: 1997 + value: 750 + floor: true rounding: type: nearest interval: 10 @@ -105,7 +117,11 @@ brackets: 2027-01-01: 5_030 metadata: uprating: - parameter: gov.bls.cpi.cpi_u_medical_care + parameter: gov.irs.indexing.medical_care_c_cpi_u + base: + period: 1997 + value: 2_000 + floor: true rounding: type: nearest interval: 10 @@ -131,7 +147,11 @@ brackets: 2027-01-01: 6_290 metadata: uprating: - parameter: gov.bls.cpi.cpi_u_medical_care + parameter: gov.irs.indexing.medical_care_c_cpi_u + base: + period: 1997 + value: 2_500 + floor: true rounding: type: nearest interval: 10 @@ -141,12 +161,29 @@ metadata: amount_unit: currency-USD period: year label: Eligible long-term care premium limit - # 26 U.S.C. 213(d)(10)(B) indexes these amounts by the medical care - # component of the chained CPI-U for August of the preceding year, - # rounding each increase to the nearest $10. Neither CBO nor CMS projects - # that index, so years after the last published values use CBO's - # projection of the CPI-U medical care component, by calendar year, as a - # proxy (as long_term_health_insurance_premiums does). + # 26 U.S.C. 213(d)(10)(B)(i) increases each 1997 amount in (A), $200, + # $375, $750, $2,000 and $2,500, by its medical care cost adjustment and + # rounds each increase to the nearest $10. (B)(ii): "the medical care cost + # adjustment for any calendar year is the percentage (if any) by which— + # (I) the medical care component of the C-CPI-U (as defined in section + # 1(f)(6)) for August of the preceding calendar year, exceeds (II) such + # component of the CPI (as defined in section 1(f)(4)) for August of + # 1996, multiplied by the amount determined under section 1(f)(3)(B)." + # That amount, the C-CPI-U for 2016 over the CPI for 2016, is an all-items + # ratio of averages over the 12 months ending August 2016. The model + # retains the stated annual IRS limits. For unpublished limits, the index + # (gov.irs.indexing.medical_care_c_cpi_u) chooses the medical components' + # August-2016 ratio as a projection convention. It reproduces all five + # 2027 limits in Rev. Proc. 2026-35, section 3.29; that consistency does + # not identify the prescribed agency method. The index's 1997 value + # covers August 1996. After the last published August (2026), the + # index grows the chained component at CBO's projected rate for the + # unchained CPI-U medical care component, by calendar year. That annual + # growth proxies future chained August growth. From August 2016 to August 2026 + # the unchained component grew about 0.28 percentage points a year faster + # than the chained one (2.39% against 2.10%, cpi_u_medical_care_nsa_august + # and c_cpi_u_medical_care_august). If that gap persists, the projected + # limits run high by a margin that compounds each year. reference: - title: 26 U.S. Code § 213(d)(10) - Eligible long-term care premiums href: https://www.law.cornell.edu/uscode/text/26/213#d_10 diff --git a/policyengine_us/parameters/gov/irs/deductions/standard/amount.yaml b/policyengine_us/parameters/gov/irs/deductions/standard/amount.yaml index c711aea843e..174f86dbe68 100644 --- a/policyengine_us/parameters/gov/irs/deductions/standard/amount.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/standard/amount.yaml @@ -1,75 +1,156 @@ description: Federal deduction from AGI if not itemizing. +# Which 1(f)(3) index. These amounts, like the CTC's, project on +# gov.irs.uprating, the index the tax brackets and other chained IRS amounts +# use. Its window ends in July, not August as 1(f)(4) has it (#9105); open +# #9621 moves it, and these projections with it. The dependent amounts and +# the educator cap project on gov.irs.indexing.c_cpi_u instead: the +# dependent amounts' base years (1987, 1997) predate gov.irs.uprating's +# 2010 start, and that index reproduces get_irs_cola, which the dependent +# and educator projections used before. It reads the August window but, for +# projected years, CBO's calendar-year points, about 0.7% high (#9608). On +# the shipped C-CPI-U series, gov.irs.uprating runs 0.6% below +# gov.irs.indexing.c_cpi_u in 2028 and 1.0% below in 2029 and 2030, so from +# the 2024 base these amounts grow 0.4% to 0.9% less: $16,950 single in +# 2028 and $17,550 in 2030, against $17,000 and $17,700 on the other index. + SINGLE: - 2015-01-01: 6_300 - 2016-01-01: 6_300 - 2017-01-01: 6_350 - 2018-01-01: 12_000 - 2019-01-01: 12_200 - 2020-01-01: 12_400 - 2021-01-01: 12_550 - 2022-01-01: 12_950 - 2023-01-01: 13_850 - 2024-01-01: 14_600 - 2025-01-01: 15_750 - 2026-01-01: 16_100 - 2027-01-01: 16_600 + values: + 2015-01-01: 6_300 + 2016-01-01: 6_300 + 2017-01-01: 6_350 + 2018-01-01: 12_000 + 2019-01-01: 12_200 + 2020-01-01: 12_400 + 2021-01-01: 12_550 + 2022-01-01: 12_950 + 2023-01-01: 13_850 + 2024-01-01: 14_600 + 2025-01-01: 15_750 + 2026-01-01: 16_100 + 2027-01-01: 16_600 + metadata: + uprating: + parameter: gov.irs.uprating + # 26 U.S.C. 63(c)(7)(B)(ii): the $15,750 that (7)(A)(ii) puts in + # 63(c)(2)(C), plus its 1(f)(3) cost-of-living increase with calendar + # year 2024 as the base year, rounded down to a multiple of $50. The + # index's 2025 value covers calendar year 2024. + base: + period: 2025 + value: 15_750 + floor: true + rounding: + type: downwards + interval: 50 JOINT: - 2015-01-01: 12_600 - 2016-01-01: 12_600 - 2017-01-01: 12_700 - 2018-01-01: 24_000 - 2019-01-01: 24_400 - 2020-01-01: 24_800 - 2021-01-01: 25_100 - 2022-01-01: 25_900 - 2023-01-01: 27_700 - 2024-01-01: 29_200 - 2025-01-01: 31_500 - 2026-01-01: 32_200 - 2027-01-01: 33_200 + values: + 2015-01-01: 12_600 + 2016-01-01: 12_600 + 2017-01-01: 12_700 + 2018-01-01: 24_000 + 2019-01-01: 24_400 + 2020-01-01: 24_800 + 2021-01-01: 25_100 + 2022-01-01: 25_900 + 2023-01-01: 27_700 + 2024-01-01: 29_200 + 2025-01-01: 31_500 + 2026-01-01: 32_200 + 2027-01-01: 33_200 + metadata: + uprating: + # 26 U.S.C. 63(c)(2)(A): 200 percent of the 63(c)(2)(C) amount, so each + # projected year doubles the single amount; 63(c)(7)(B)(ii) indexes + # only the $23,625 and $15,750 amounts. Rounding to $100 clears float + # error from the ratio. + parameter: gov.irs.deductions.standard.amount.SINGLE + rounding: + type: nearest + interval: 100 SEPARATE: - 2015-01-01: 6_300 - 2016-01-01: 6_300 - 2017-01-01: 6_350 - 2018-01-01: 12_000 - 2019-01-01: 12_200 - 2020-01-01: 12_400 - 2021-01-01: 12_550 - 2022-01-01: 12_950 - 2023-01-01: 13_850 - 2024-01-01: 14_600 - 2025-01-01: 15_750 - 2026-01-01: 16_100 - 2027-01-01: 16_600 + values: + 2015-01-01: 6_300 + 2016-01-01: 6_300 + 2017-01-01: 6_350 + 2018-01-01: 12_000 + 2019-01-01: 12_200 + 2020-01-01: 12_400 + 2021-01-01: 12_550 + 2022-01-01: 12_950 + 2023-01-01: 13_850 + 2024-01-01: 14_600 + 2025-01-01: 15_750 + 2026-01-01: 16_100 + 2027-01-01: 16_600 + metadata: + uprating: + parameter: gov.irs.uprating + # 26 U.S.C. 63(c)(7)(B)(ii): the $15,750 that (7)(A)(ii) puts in + # 63(c)(2)(C), plus its 1(f)(3) cost-of-living increase with calendar + # year 2024 as the base year, rounded down to a multiple of $50. The + # index's 2025 value covers calendar year 2024. + base: + period: 2025 + value: 15_750 + floor: true + rounding: + type: downwards + interval: 50 HEAD_OF_HOUSEHOLD: - 2015-01-01: 9_250 - 2016-01-01: 9_300 - 2017-01-01: 9_350 - 2018-01-01: 18_000 - 2019-01-01: 18_350 - 2020-01-01: 18_650 - 2021-01-01: 18_800 - 2022-01-01: 19_400 - 2023-01-01: 20_800 - 2024-01-01: 21_900 - 2025-01-01: 23_625 - 2026-01-01: 24_150 - 2027-01-01: 24_925 + values: + 2015-01-01: 9_250 + 2016-01-01: 9_300 + 2017-01-01: 9_350 + 2018-01-01: 18_000 + 2019-01-01: 18_350 + 2020-01-01: 18_650 + 2021-01-01: 18_800 + 2022-01-01: 19_400 + 2023-01-01: 20_800 + 2024-01-01: 21_900 + 2025-01-01: 23_625 + 2026-01-01: 24_150 + 2027-01-01: 24_925 + metadata: + uprating: + parameter: gov.irs.uprating + # 26 U.S.C. 63(c)(7)(B)(ii): the $23,625 that (7)(A)(i) puts in + # 63(c)(2)(B), plus its 1(f)(3) cost-of-living increase with calendar + # year 2024 as the base year, rounded down to a multiple of $50. The + # index's 2025 value covers calendar year 2024. + base: + period: 2025 + value: 23_625 + floor: true + rounding: + type: downwards + interval: 50 SURVIVING_SPOUSE: - 2015-01-01: 12_600 - 2016-01-01: 12_600 - 2017-01-01: 12_700 - 2018-01-01: 24_000 - 2019-01-01: 24_400 - 2020-01-01: 24_800 - 2021-01-01: 25_100 - 2022-01-01: 25_900 - 2023-01-01: 27_700 - 2024-01-01: 29_200 - 2025-01-01: 31_500 - 2026-01-01: 32_200 - 2027-01-01: 33_200 + values: + 2015-01-01: 12_600 + 2016-01-01: 12_600 + 2017-01-01: 12_700 + 2018-01-01: 24_000 + 2019-01-01: 24_400 + 2020-01-01: 24_800 + 2021-01-01: 25_100 + 2022-01-01: 25_900 + 2023-01-01: 27_700 + 2024-01-01: 29_200 + 2025-01-01: 31_500 + 2026-01-01: 32_200 + 2027-01-01: 33_200 + metadata: + uprating: + # 26 U.S.C. 63(c)(2)(A): 200 percent of the 63(c)(2)(C) amount, so each + # projected year doubles the single amount; 63(c)(7)(B)(ii) indexes + # only the $23,625 and $15,750 amounts. Rounding to $100 clears float + # error from the ratio. + parameter: gov.irs.deductions.standard.amount.SINGLE + rounding: + type: nearest + interval: 100 metadata: unit: currency-USD label: Standard deduction @@ -110,8 +191,3 @@ metadata: - title: CBO Tax Parameters and Effective Marginal Tax Rates | Jan 2025 # 1. Tax Parameters. href: https://www.cbo.gov/system/files/2025-01/53724-2025-01-Tax-Parameters.xlsx - uprating: - parameter: gov.irs.uprating - rounding: - type: downwards - interval: 50 diff --git a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml index cfa5adf3ed8..faf0c3c8fb1 100644 --- a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/additional_earned_income.yaml @@ -1,6 +1,13 @@ description: The basic standard deduction of a filer who can be claimed as a dependent is limited to the greater of the floor or earned income plus this amount. values: - 0001-01-01: 350 + # 63(c)(5)(B)'s $250, indexed from its 1997 base year (63(c)(4)(B)(ii)). + # The IRS printed $250 for 1998 (Rev. Proc. 97-57) and for each year from + # 2000 to 2005 (Rev. Procs. 99-42 to 2004-71), and $300 for each year from + # 2006 to 2012 (Rev. Procs. 2005-70 to 2011-52). The 1999 amount is + # unchecked: Rev. Proc. 98-61's bulletin on irs.gov is a scanned image. + 1998-01-01: 250 + 2006-01-01: 300 + 2013-01-01: 350 2022-01-01: 400 2024-01-01: 450 2025-01-01: 450 @@ -10,17 +17,18 @@ metadata: unit: currency-USD period: year label: Dependent standard deduction earned income addition - # Values after the last IRS publication are computed in - # parameters/uprating_extensions.py per 26 U.S.C. 63(c)(4)(B)(ii): the - # statutory $250 increased by the 1(f)(3) cost-of-living adjustment with - # calendar year 1997 as the base year (C-CPI-U for the 12 months ending - # August 31 of the prior year), each increase rounded down to the next - # lowest multiple of $50 under 1(f)(7)(A). Computing from the $250 base - # rather than chaining from the rounded $450 keeps the projection from - # lagging the statute by a $50 step; those values supersede this - # uprating rule, which describes the index and rounding. uprating: - parameter: gov.irs.uprating + # 26 U.S.C. 63(c)(4)(B)(ii): the statutory $250 plus its 1(f)(3) + # cost-of-living increase with calendar year 1997 as the base year, + # rounded down to a multiple of $50 under 1(f)(7)(A). The index's 1998 + # value covers calendar year 1997. Projecting from the $250 base rather + # than chaining from a rounded published value keeps the projection + # from lagging the statute by a $50 step. + parameter: gov.irs.indexing.c_cpi_u + base: + period: 1998 + value: 250 + floor: true rounding: type: downwards interval: 50 @@ -47,3 +55,15 @@ metadata: href: https://www.irs.gov/pub/irs-drop/rp-19-44.pdf#page=13 - title: Rev. Proc. 2018-57, sec. 3.16(2) (tax year 2019) href: https://www.irs.gov/pub/irs-drop/rp-18-57.pdf#page=16 + - title: Rev. Proc. 2014-61, sec. 3.14(2) (tax year 2015) + href: https://www.irs.gov/pub/irs-drop/rp-14-61.pdf#page=13 + - title: Rev. Proc. 2013-15, sec. 3.07(2) (tax year 2013) + href: https://www.irs.gov/pub/irs-drop/rp-13-15.pdf#page=10 + - title: Rev. Proc. 2011-52, sec. 3.11(2) (tax year 2012) + href: https://www.irs.gov/pub/irs-drop/rp-11-52.pdf#page=13 + - title: Rev. Proc. 2005-70, sec. 3.10(2) (tax year 2006) + href: https://www.irs.gov/pub/irs-drop/rp-05-70.pdf#page=10 + - title: Rev. Proc. 2004-71, sec. 3.10(2) (tax year 2005) + href: https://www.irs.gov/pub/irs-drop/rp-04-71.pdf#page=8 + - title: Rev. Proc. 97-57, sec. 3.04(2), 1997-52 I.R.B. 20, 22-23 (tax year 1998) + href: https://www.irs.gov/pub/irs-irbs/irb97-52.pdf#page=23 diff --git a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml index 0fc8773576b..d3857ab59a7 100644 --- a/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml +++ b/policyengine_us/parameters/gov/irs/deductions/standard/dependent/amount.yaml @@ -22,14 +22,17 @@ metadata: unit: currency-USD period: year label: Dependent standard deduction floor - # Values after the CBO horizon are computed in - # parameters/uprating_extensions.py per 26 U.S.C. 63(c)(4)(B)(i): the - # statutory $500 increased by the 1(f)(3) cost-of-living adjustment with - # calendar year 1987 as the base year, each increase rounded down to the - # next lowest multiple of $50 under 1(f)(7)(A). Those values supersede - # this uprating rule, which describes the index and rounding. uprating: - parameter: gov.irs.uprating + # 26 U.S.C. 63(c)(4)(B)(i): the statutory $500 plus its 1(f)(3) + # cost-of-living increase with calendar year 1987 as the base year, + # rounded down to a multiple of $50 under 1(f)(7)(A). The index's 1988 + # value covers calendar year 1987. Base mode adds values only after + # CBO's, above. + parameter: gov.irs.indexing.c_cpi_u + base: + period: 1988 + value: 500 + floor: true rounding: type: downwards interval: 50 diff --git a/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/family.yaml b/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/family.yaml index 982b037d35e..09b2d3a264c 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/family.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/family.yaml @@ -33,15 +33,17 @@ metadata: unit: currency-USD period: year label: HSA contribution limit, family coverage - # Values after the last IRS publication are computed in - # parameters/uprating_extensions.py per 26 U.S.C. 223(g): the statutory - # $4,500 increased by the chained CPI-U cost-of-living adjustment with 1997 - # as the base year and the 12 months ending March 31 as the averaging - # window, each increase rounded to the nearest multiple of $50. Those values - # supersede this uprating rule, which names the index family and rounding - # (and lets reforms that re-index gov.irs.uprating parameters find it). uprating: - parameter: gov.irs.uprating + # 26 U.S.C. 223(g)(1): the statutory $4,500 in 223(b)(2)(B) plus its + # cost-of-living increase with calendar year 1997 as the base year and + # the 12 months ending March 31 as the averaging window, rounded to the + # nearest multiple of $50 under 223(g)(2). The index's 1998 value covers + # calendar year 1997. + parameter: gov.irs.indexing.hsa_c_cpi_u + base: + period: 1998 + value: 4_500 + floor: true rounding: type: nearest interval: 50 diff --git a/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/self_only.yaml b/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/self_only.yaml index b03bb6effa2..e78f098cb93 100644 --- a/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/self_only.yaml +++ b/policyengine_us/parameters/gov/irs/gross_income/health_savings_account_contributions/limit/self_only.yaml @@ -31,15 +31,17 @@ metadata: unit: currency-USD period: year label: HSA contribution limit, self-only coverage - # Values after the last IRS publication are computed in - # parameters/uprating_extensions.py per 26 U.S.C. 223(g): the statutory - # $2,250 increased by the chained CPI-U cost-of-living adjustment with 1997 - # as the base year and the 12 months ending March 31 as the averaging - # window, each increase rounded to the nearest multiple of $50. Those values - # supersede this uprating rule, which names the index family and rounding - # (and lets reforms that re-index gov.irs.uprating parameters find it). uprating: - parameter: gov.irs.uprating + # 26 U.S.C. 223(g)(1): the statutory $2,250 in 223(b)(2)(A) plus its + # cost-of-living increase with calendar year 1997 as the base year and + # the 12 months ending March 31 as the averaging window, rounded to the + # nearest multiple of $50 under 223(g)(2). The index's 1998 value covers + # calendar year 1997. + parameter: gov.irs.indexing.hsa_c_cpi_u + base: + period: 1998 + value: 2_250 + floor: true rounding: type: nearest interval: 50 diff --git a/policyengine_us/parameters/gov/irs/indexing/c_cpi_u.yaml b/policyengine_us/parameters/gov/irs/indexing/c_cpi_u.yaml new file mode 100644 index 00000000000..144b85ec25e --- /dev/null +++ b/policyengine_us/parameters/gov/irs/indexing/c_cpi_u.yaml @@ -0,0 +1,25 @@ +description: The IRS increases dollar amounts that the Internal Revenue Code indexes from a stated base year by the change in this C-CPI-U, which holds for each tax year the index for the calendar year before it under 26 U.S.C. 1(f)(3). +values: + # Computed in parameters/uprating_extensions.py (set_irs_c_cpi_u_index): + # from calendar year 2016, the C-CPI-U averaged over the 12 months ending + # August 31 (1(f)(6)(B)); before 2016, the CPI-U over the same months + # (1(f)(4)) times the 1(f)(3)(B) ratio of the two for 2016. A statute's + # base year B is this index's period B + 1. + # + # The dependent standard deduction amounts and the educator cap project + # on this index. The standard deduction and the CTC, which 1(f)(3) + # indexes the same way, stay on gov.irs.uprating, the index the tax + # brackets and other chained IRS amounts use, whose window ends in July + # (#9105; open #9621 moves it). For projected years this index reads + # CBO's calendar-year points, about 0.7% high (#9608). On the shipped + # series gov.irs.uprating runs 0.6% below this index in 2028 and 1.0% + # below in 2029 and 2030, so a 2024 base grows 0.4% to 0.9% less on it: + # the single standard deduction is $16,950 in 2028 and $17,550 in 2030, + # against $17,000 and $17,700 here. + 1988-01-01: 1 +metadata: + unit: /1 + label: C-CPI-U for base-year IRS indexing + reference: + - title: 26 U.S. Code § 1(f)(3)-(7) - Cost-of-living adjustment + href: https://www.law.cornell.edu/uscode/text/26/1#f_3 diff --git a/policyengine_us/parameters/gov/irs/indexing/hsa_c_cpi_u.yaml b/policyengine_us/parameters/gov/irs/indexing/hsa_c_cpi_u.yaml new file mode 100644 index 00000000000..ec605c2b89a --- /dev/null +++ b/policyengine_us/parameters/gov/irs/indexing/hsa_c_cpi_u.yaml @@ -0,0 +1,14 @@ +description: The IRS increases the health savings account contribution limits by the change in this C-CPI-U, which holds for each tax year the index for the calendar year before it under 26 U.S.C. 223(g)(1), averaged over the 12 months ending March 31. +values: + # Computed in parameters/uprating_extensions.py (set_hsa_c_cpi_u_index): + # for 1998, the 223(g)(1) denominator for calendar year 1997 + # (get_hsa_cola_denominator); from calendar year 2017, the C-CPI-U + # averaged over the 12 months ending March 31; for calendar years 1998 + # to 2016, the CPI-U over the same months on the denominator's scale. + 1998-01-01: 1 +metadata: + unit: /1 + label: C-CPI-U for HSA contribution limit indexing + reference: + - title: 26 U.S. Code § 223(g)(1) - Cost-of-living adjustment + href: https://www.law.cornell.edu/uscode/text/26/223#g_1 diff --git a/policyengine_us/parameters/gov/irs/indexing/medical_care_c_cpi_u.yaml b/policyengine_us/parameters/gov/irs/indexing/medical_care_c_cpi_u.yaml new file mode 100644 index 00000000000..0cde04380c0 --- /dev/null +++ b/policyengine_us/parameters/gov/irs/indexing/medical_care_c_cpi_u.yaml @@ -0,0 +1,25 @@ +description: The IRS increases the long-term care premium limits by the change in this medical care component of the C-CPI-U, which holds for each tax year the August index of the calendar year before it under 26 U.S.C. 213(d)(10)(B)(ii). +values: + # Computed in parameters/uprating_extensions.py + # (set_medical_care_c_cpi_u_index): from August 2017, the medical care + # component of the C-CPI-U for August; through August 2016, that + # component of the CPI-U times the two components' ratio for August 2016. + # With that ratio, each 1997 amount plus its increase rounded to the + # nearest $10 gives the five 2027 limits in Rev. Proc. 2026-35, section + # 3.29; some earlier published limits depart from it by $5 to $30 + # (tests/core/test_base_mode_uprating.py lists them). After the last + # published August, the index grows with CBO's calendar-year CPI-U + # medical care component. + # For unpublished limits, the model chooses this August-2016 medical + # splice as a projection convention. The statutory default conversion + # uses all-items indexes averaged over the 12 months ending August 2016. + # The 2027 match supports consistency with the IRS table; the available + # sources do not identify this splice as the prescribed agency method. + # CBO's annual unchained growth proxies future chained August growth. + 1997-01-01: 1 +metadata: + unit: /1 + label: Medical care C-CPI-U for long-term care premium limit indexing + reference: + - title: 26 U.S. Code § 213(d)(10)(B) - Indexing + href: https://www.law.cornell.edu/uscode/text/26/213#d_10_B diff --git a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/cpi.yaml b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/cpi.yaml new file mode 100644 index 00000000000..e049579e000 --- /dev/null +++ b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/cpi.yaml @@ -0,0 +1,13 @@ +description: New York City increases the income tax elimination credit income thresholds by the change in this Consumer Price Index for All Urban Consumers from its 2024 value, under Tax Law § 1310(h)(1)(B)(iii). +values: + # Computed in parameters/uprating_extensions.py + # (set_nyc_income_tax_elimination_credit_cpi): for each tax year, the + # CPI-U averaged over the 12 months ending August 31 of the year before + # (§ 1310(h)(3)(A)). Its 2025 value, the base, is the 2024 index. + 2025-01-01: 1 +metadata: + unit: /1 + label: NYC income tax elimination credit cost-of-living index + reference: + - title: NY Tax Law § 1310(h) + href: https://www.nysenate.gov/legislation/laws/TAX/1310 diff --git a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/head_of_household.yaml b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/head_of_household.yaml index 4c71f3b9652..545211a07da 100644 --- a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/head_of_household.yaml +++ b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/head_of_household.yaml @@ -9,9 +9,12 @@ metadata: # Tax Law § 1310(h)(1)(B)(iii) multiplies these amounts by one plus # the percentage by which the CPI-U for the preceding calendar year exceeds # the CPI-U for 2024, each year's CPI-U being the average for the 12 months - # ending August 31 (§ 1310(h)(3)(A)). Values after the last Department - # of Taxation and Finance publication are computed in - # parameters/uprating_extensions.py. + # ending August 31 (§ 1310(h)(3)(A)). The statute sets no rounding. + # `floor` holds the factor at one or above, since a CPI-U below its 2024 + # level exceeds it by no percentage. Base mode projects each bracket's + # amount from its 2025 value; the thresholds count dependents and stay. + # Each amount carries its own uprating: gov/local propagates metadata to + # children, so a scale-level uprating would reach the thresholds too. reference: - title: NY Tax Law § 1310(h)(1)(B)(ii) href: https://www.nysenate.gov/legislation/laws/TAX/1310 @@ -21,32 +24,88 @@ brackets: - threshold: 2025-01-01: 1 amount: - 2025-01-01: 31_503 + values: + 2025-01-01: 31_503 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 2 amount: - 2025-01-01: 36_824 + values: + 2025-01-01: 36_824 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 3 amount: - 2025-01-01: 46_512 + values: + 2025-01-01: 46_512 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 4 amount: - 2025-01-01: 53_711 + values: + 2025-01-01: 53_711 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 5 amount: - 2025-01-01: 59_928 + values: + 2025-01-01: 59_928 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 6 amount: - 2025-01-01: 65_712 + values: + 2025-01-01: 65_712 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 7 amount: - 2025-01-01: 74_565 + values: + 2025-01-01: 74_565 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 8 amount: - 2025-01-01: 88_361 + values: + 2025-01-01: 88_361 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true diff --git a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/joint.yaml b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/joint.yaml index 149aeb1f18c..454d32d4725 100644 --- a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/joint.yaml +++ b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/joint.yaml @@ -9,9 +9,12 @@ metadata: # Tax Law § 1310(h)(1)(B)(iii) multiplies these amounts by one plus # the percentage by which the CPI-U for the preceding calendar year exceeds # the CPI-U for 2024, each year's CPI-U being the average for the 12 months - # ending August 31 (§ 1310(h)(3)(A)). Values after the last Department - # of Taxation and Finance publication are computed in - # parameters/uprating_extensions.py. + # ending August 31 (§ 1310(h)(3)(A)). The statute sets no rounding. + # `floor` holds the factor at one or above, since a CPI-U below its 2024 + # level exceeds it by no percentage. Base mode projects each bracket's + # amount from its 2025 value; the thresholds count dependents and stay. + # Each amount carries its own uprating: gov/local propagates metadata to + # children, so a scale-level uprating would reach the thresholds too. reference: - title: NY Tax Law § 1310(h)(1)(B)(i) href: https://www.nysenate.gov/legislation/laws/TAX/1310 @@ -21,28 +24,77 @@ brackets: - threshold: 2025-01-01: 1 amount: - 2025-01-01: 36_789 + values: + 2025-01-01: 36_789 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 2 amount: - 2025-01-01: 46_350 + values: + 2025-01-01: 46_350 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 3 amount: - 2025-01-01: 54_545 + values: + 2025-01-01: 54_545 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 4 amount: - 2025-01-01: 61_071 + values: + 2025-01-01: 61_071 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 5 amount: - 2025-01-01: 68_403 + values: + 2025-01-01: 68_403 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 6 amount: - 2025-01-01: 75_204 + values: + 2025-01-01: 75_204 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 7 amount: - 2025-01-01: 91_902 + values: + 2025-01-01: 91_902 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true diff --git a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/separate.yaml b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/separate.yaml index d0ccea41ffb..fdb3895f89b 100644 --- a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/separate.yaml +++ b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/separate.yaml @@ -9,9 +9,12 @@ metadata: # Tax Law § 1310(h)(1)(B)(iii) multiplies these amounts by one plus # the percentage by which the CPI-U for the preceding calendar year exceeds # the CPI-U for 2024, each year's CPI-U being the average for the 12 months - # ending August 31 (§ 1310(h)(3)(A)). Values after the last Department - # of Taxation and Finance publication are computed in - # parameters/uprating_extensions.py. + # ending August 31 (§ 1310(h)(3)(A)). The statute sets no rounding. + # `floor` holds the factor at one or above, since a CPI-U below its 2024 + # level exceeds it by no percentage. Base mode projects each bracket's + # amount from its 2025 value; the thresholds count dependents and stay. + # Each amount carries its own uprating: gov/local propagates metadata to + # children, so a scale-level uprating would reach the thresholds too. reference: - title: NY Tax Law § 1310(h)(1)(B)(ii) href: https://www.nysenate.gov/legislation/laws/TAX/1310 @@ -21,32 +24,88 @@ brackets: - threshold: 2025-01-01: 1 amount: - 2025-01-01: 31_503 + values: + 2025-01-01: 31_503 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 2 amount: - 2025-01-01: 36_824 + values: + 2025-01-01: 36_824 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 3 amount: - 2025-01-01: 46_512 + values: + 2025-01-01: 46_512 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 4 amount: - 2025-01-01: 53_711 + values: + 2025-01-01: 53_711 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 5 amount: - 2025-01-01: 59_928 + values: + 2025-01-01: 59_928 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 6 amount: - 2025-01-01: 65_712 + values: + 2025-01-01: 65_712 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 7 amount: - 2025-01-01: 74_565 + values: + 2025-01-01: 74_565 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 8 amount: - 2025-01-01: 88_361 + values: + 2025-01-01: 88_361 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true diff --git a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/single.yaml b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/single.yaml index 27bb4a7fd61..94ed8e97433 100644 --- a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/single.yaml +++ b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/single.yaml @@ -9,9 +9,12 @@ metadata: # Tax Law § 1310(h)(1)(B)(iii) multiplies these amounts by one plus # the percentage by which the CPI-U for the preceding calendar year exceeds # the CPI-U for 2024, each year's CPI-U being the average for the 12 months - # ending August 31 (§ 1310(h)(3)(A)). Values after the last Department - # of Taxation and Finance publication are computed in - # parameters/uprating_extensions.py. + # ending August 31 (§ 1310(h)(3)(A)). The statute sets no rounding. + # `floor` holds the factor at one or above, since a CPI-U below its 2024 + # level exceeds it by no percentage. Base mode projects each bracket's + # amount from its 2025 value; the thresholds count dependents and stay. + # Each amount carries its own uprating: gov/local propagates metadata to + # children, so a scale-level uprating would reach the thresholds too. reference: - title: NY Tax Law § 1310(h)(1)(B)(ii) href: https://www.nysenate.gov/legislation/laws/TAX/1310 @@ -21,32 +24,88 @@ brackets: - threshold: 2025-01-01: 1 amount: - 2025-01-01: 31_503 + values: + 2025-01-01: 31_503 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 2 amount: - 2025-01-01: 36_824 + values: + 2025-01-01: 36_824 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 3 amount: - 2025-01-01: 46_512 + values: + 2025-01-01: 46_512 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 4 amount: - 2025-01-01: 53_711 + values: + 2025-01-01: 53_711 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 5 amount: - 2025-01-01: 59_928 + values: + 2025-01-01: 59_928 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 6 amount: - 2025-01-01: 65_712 + values: + 2025-01-01: 65_712 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 7 amount: - 2025-01-01: 74_565 + values: + 2025-01-01: 74_565 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 8 amount: - 2025-01-01: 88_361 + values: + 2025-01-01: 88_361 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true diff --git a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/surviving_spouse.yaml b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/surviving_spouse.yaml index 3d955b47d8f..83df2f797c9 100644 --- a/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/surviving_spouse.yaml +++ b/policyengine_us/parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination/income_threshold/surviving_spouse.yaml @@ -9,9 +9,12 @@ metadata: # Tax Law § 1310(h)(1)(B)(iii) multiplies these amounts by one plus # the percentage by which the CPI-U for the preceding calendar year exceeds # the CPI-U for 2024, each year's CPI-U being the average for the 12 months - # ending August 31 (§ 1310(h)(3)(A)). Values after the last Department - # of Taxation and Finance publication are computed in - # parameters/uprating_extensions.py. + # ending August 31 (§ 1310(h)(3)(A)). The statute sets no rounding. + # `floor` holds the factor at one or above, since a CPI-U below its 2024 + # level exceeds it by no percentage. Base mode projects each bracket's + # amount from its 2025 value; the thresholds count dependents and stay. + # Each amount carries its own uprating: gov/local propagates metadata to + # children, so a scale-level uprating would reach the thresholds too. reference: - title: NY Tax Law § 1310(h)(1)(B)(i) href: https://www.nysenate.gov/legislation/laws/TAX/1310 @@ -21,28 +24,77 @@ brackets: - threshold: 2025-01-01: 1 amount: - 2025-01-01: 36_789 + values: + 2025-01-01: 36_789 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 2 amount: - 2025-01-01: 46_350 + values: + 2025-01-01: 46_350 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 3 amount: - 2025-01-01: 54_545 + values: + 2025-01-01: 54_545 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 4 amount: - 2025-01-01: 61_071 + values: + 2025-01-01: 61_071 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 5 amount: - 2025-01-01: 68_403 + values: + 2025-01-01: 68_403 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 6 amount: - 2025-01-01: 75_204 + values: + 2025-01-01: 75_204 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true - threshold: 2025-01-01: 7 amount: - 2025-01-01: 91_902 + values: + 2025-01-01: 91_902 + metadata: + uprating: + parameter: gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + base: + period: 2025 + floor: true diff --git a/policyengine_us/parameters/gov/states/az/tax/income/deductions/standard/amount.yaml b/policyengine_us/parameters/gov/states/az/tax/income/deductions/standard/amount.yaml index 450bc8f7c69..d2b4554bef9 100644 --- a/policyengine_us/parameters/gov/states/az/tax/income/deductions/standard/amount.yaml +++ b/policyengine_us/parameters/gov/states/az/tax/income/deductions/standard/amount.yaml @@ -44,13 +44,12 @@ JOINT: unit: currency-USD period: year # The federal method makes the joint amount twice the single amount - # (26 U.S.C. 63(c)(2)(A)). With a 2026 joint amount of twice the single - # amount, a $100 round-down equals twice the single amount's $50 - # round-down. + # (26 U.S.C. 63(c)(2)(A)), so each projected year doubles the Arizona + # single amount. Rounding to $100 clears float error from the ratio. uprating: - parameter: gov.irs.uprating + parameter: gov.states.az.tax.income.deductions.standard.amount.SINGLE rounding: - type: downwards + type: nearest interval: 100 HEAD_OF_HOUSEHOLD: values: @@ -64,8 +63,17 @@ HEAD_OF_HOUSEHOLD: metadata: unit: currency-USD period: year + # A.R.S. 43-1041(H) indexes the $23,625 "in the same manner" as + # 26 U.S.C. 63(c)(7)(B)(ii) indexes the federal one: the 2025 amount plus + # its cost-of-living increase with calendar year 2024 as the base year, + # rounded down to a multiple of $50. The index's 2025 value covers + # calendar year 2024. uprating: parameter: gov.irs.uprating + base: + period: 2025 + value: 23_625 + floor: true rounding: type: downwards interval: 50 @@ -81,8 +89,17 @@ SINGLE: metadata: unit: currency-USD period: year + # A.R.S. 43-1041(H) indexes the $15,750 "in the same manner" as + # 26 U.S.C. 63(c)(7)(B)(ii) indexes the federal one: the 2025 amount plus + # its cost-of-living increase with calendar year 2024 as the base year, + # rounded down to a multiple of $50. The index's 2025 value covers + # calendar year 2024. uprating: parameter: gov.irs.uprating + base: + period: 2025 + value: 15_750 + floor: true rounding: type: downwards interval: 50 @@ -98,8 +115,17 @@ SEPARATE: metadata: unit: currency-USD period: year + # A.R.S. 43-1041(H) indexes the $15,750 "in the same manner" as + # 26 U.S.C. 63(c)(7)(B)(ii) indexes the federal one: the 2025 amount plus + # its cost-of-living increase with calendar year 2024 as the base year, + # rounded down to a multiple of $50. The index's 2025 value covers + # calendar year 2024. uprating: parameter: gov.irs.uprating + base: + period: 2025 + value: 15_750 + floor: true rounding: type: downwards interval: 50 diff --git a/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/amount.yaml b/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/amount.yaml index 3d688e9ee60..bbfdcf72894 100644 --- a/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/amount.yaml +++ b/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/amount.yaml @@ -7,14 +7,23 @@ values: 2024-01-01: 1_000 2025-01-01: 1_050 metadata: - # Values after the last Department of Revenue publication are computed in - # parameters/uprating_extensions.py per ORS 315.273(5): unchained U.S. - # City Average CPI-U for the 12 months ending August 31 of the prior year, - # over the 2022 Q2 average, applied to the $1,000 base with each increase - # rounded down to the next lower multiple of $50. unit: currency-USD period: year label: Oregon Child Tax Credit amount + uprating: + # ORS 315.273(5): the $1,000 base plus its cost-of-living increase, the + # change in the unchained U.S. City Average CPI-U for the 12 months + # ending August 31 of the prior year over its 2022 second-quarter + # average, rounded down to the next lower multiple of $50. The index's + # 2023 value holds that second-quarter average. + parameter: gov.states.or.tax.income.credits.ctc.cpi + base: + period: 2023 + value: 1_000 + floor: true + rounding: + type: downwards + interval: 50 reference: - title: 2023R1 House Bill 3235 Section 2 (3)(a) href: https://olis.oregonlegislature.gov/liz/2023R1/Downloads/MeasureDocument/HB3235/Enrolled#page=1 diff --git a/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/cpi.yaml b/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/cpi.yaml new file mode 100644 index 00000000000..80e29ff71d3 --- /dev/null +++ b/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/cpi.yaml @@ -0,0 +1,13 @@ +description: Oregon increases its Child Tax Credit amount and phase-out start by the change in this Consumer Price Index for All Urban Consumers from its second-quarter 2022 average, under ORS 315.273(5). +values: + # Computed in parameters/uprating_extensions.py (set_or_ctc_cpi): for + # 2023, the base, the monthly averaged CPI-U for the second quarter of + # 2022 (ORS 315.273(5)(b)-(c)); for each later tax year, the monthly + # averaged CPI-U for the 12 months ending August 31 of the year before. + 2023-01-01: 1 +metadata: + unit: /1 + label: Oregon Child Tax Credit cost-of-living index + reference: + - title: Oregon Revised Statutes Section 315.273(5) (cost-of-living adjustment) + href: https://oregon.public.law/statutes/ors_315.273 diff --git a/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/reduction/start.yaml b/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/reduction/start.yaml index 628f2c3b4e7..f9bfb47fc8b 100644 --- a/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/reduction/start.yaml +++ b/policyengine_us/parameters/gov/states/or/tax/income/credits/ctc/reduction/start.yaml @@ -4,14 +4,23 @@ values: 2024-01-01: 25_750 2025-01-01: 26_550 metadata: - # Values after the last Department of Revenue publication are computed in - # parameters/uprating_extensions.py per ORS 315.273(5): unchained U.S. - # City Average CPI-U for the 12 months ending August 31 of the prior year, - # over the 2022 Q2 average, applied to the $25,000 base with each increase - # rounded down to the next lower multiple of $50. unit: currency-USD period: year label: Oregon Child Tax Credit phase-out start + uprating: + # ORS 315.273(5): the $25,000 base plus its cost-of-living increase, the + # change in the unchained U.S. City Average CPI-U for the 12 months + # ending August 31 of the prior year over its 2022 second-quarter + # average, rounded down to the next lower multiple of $50. The index's + # 2023 value holds that second-quarter average. + parameter: gov.states.or.tax.income.credits.ctc.cpi + base: + period: 2023 + value: 25_000 + floor: true + rounding: + type: downwards + interval: 50 reference: - title: Oregon Revised Statutes Section 315.273 - 5(a) href: https://www.oregonlegislature.gov/bills_laws/ors/ors315.html diff --git a/policyengine_us/parameters/uprating_extensions.py b/policyengine_us/parameters/uprating_extensions.py index 34b57241fdd..0d94b2072c3 100644 --- a/policyengine_us/parameters/uprating_extensions.py +++ b/policyengine_us/parameters/uprating_extensions.py @@ -147,6 +147,13 @@ def get_cpi_u_average_for_12_months_ending_august( return get_average_for_12_months_ending_august(parameters.gov.bls.cpi.cpi_u, year) +def get_or_ctc_cpi_base(parameters: ParameterNode) -> float: + """ORS 315.273(5)(c): the monthly averaged CPI-U for the second quarter of + calendar year 2022, the base of the Oregon Kids' Credit adjustment.""" + cpi = parameters.gov.bls.cpi.cpi_u + return sum(cpi(f"2022-{month:02d}-01") for month in (4, 5, 6)) / 3 + + def get_or_ctc_cola(parameters: ParameterNode, tax_year: int) -> float: """Calculate the Oregon Kids' Credit cost-of-living adjustment. @@ -155,10 +162,10 @@ def get_or_ctc_cola(parameters: ParameterNode, tax_year: int) -> float: ending August 31 of the prior calendar year exceeds the monthly averaged index for the second quarter of calendar year 2022. """ - cpi = parameters.gov.bls.cpi.cpi_u - base = sum(cpi(f"2022-{month:02d}-01") for month in (4, 5, 6)) / 3 - window = get_average_for_12_months_ending_august(cpi, tax_year - 1) - return max(window / base - 1, 0) + window = get_average_for_12_months_ending_august( + parameters.gov.bls.cpi.cpi_u, tax_year - 1 + ) + return max(window / get_or_ctc_cpi_base(parameters) - 1, 0) def get_irs_cola_denominator(parameters: ParameterNode, base_year: int) -> float: @@ -201,80 +208,6 @@ def get_irs_cola( return max(chained / get_irs_cola_denominator(parameters, base_year) - 1, 0) -# 26 U.S.C. 63(c)(5) limits on a dependent's basic standard deduction: -# parameter name, statutory dollar amount, and 63(c)(4)(B) base year. -DEPENDENT_STANDARD_DEDUCTION_STATUTORY_BASES = ( - ("amount", 500, 1987), # 63(c)(5)(A) - ("additional_earned_income", 250, 1997), # 63(c)(5)(B) -) - - -def extend_dependent_standard_deduction_parameters( - parameters: ParameterNode, - end_year: int, -) -> None: - """Project the limits on a dependent's basic standard deduction. - - 26 U.S.C. 63(c)(4) increases the 63(c)(5)(A) floor ($500) and the - 63(c)(5)(B) earned income addition ($250) by the 1(f)(3) cost-of-living - adjustment, substituting calendar year 1987 and 1997 respectively for - 2016, and 1(f)(7)(A) rounds each increase down to the next lowest - multiple of $50. Each year is computed from the statutory base rather - than chained from the last rounded value, which can lag the statute by - a full $50 step; IRS and CBO values encoded in the YAML take precedence - for their own years. - """ - ROUNDING_INTERVAL = 50 - dependent = parameters.gov.irs.deductions.standard.dependent - for name, base, base_year in DEPENDENT_STANDARD_DEDUCTION_STATUTORY_BASES: - parameter = getattr(dependent, name) - first_projected_year = 1 + max( - int(value.instant_str[:4]) for value in parameter.values_list - ) - for year in range(first_projected_year, end_year + 1): - cola = get_irs_cola(parameters, year, base_year) - increase = math.floor(base * cola / ROUNDING_INTERVAL) * ROUNDING_INTERVAL - parameter.update( - period=f"year:{year}-01-01:1", value=float(base + increase) - ) - parameter.update( - start=instant(f"{end_year}-01-01"), - value=parameter(f"{end_year}-01-01"), - ) - - -# 26 U.S.C. 62(d)(3) indexing of the 62(a)(2)(D) educator expense cap: -# statutory dollar amount and 1(f)(3) base year. -EDUCATOR_EXPENSE_CAP_STATUTORY_BASE = (250, 2014) - - -def extend_educator_expense_cap(parameters: ParameterNode, end_year: int) -> None: - """Project the per-educator cap on the educator expense deduction. - - 26 U.S.C. 62(d)(3) increases the $250 amount in 62(a)(2)(D) by the - 1(f)(3) cost-of-living adjustment, substituting calendar year 2014 for - 2016, and rounds the increase to the nearest multiple of $50. Each year - is computed from the statutory base rather than chained from the last - rounded value, which can put a $50 step a year or more early or late; - IRS values encoded in the YAML take precedence for their own years. - """ - ROUNDING_INTERVAL = 50 - base, base_year = EDUCATOR_EXPENSE_CAP_STATUTORY_BASE - cap = parameters.gov.irs.ald.educator_expense.cap - first_projected_year = 1 + max( - int(value.instant_str[:4]) for value in cap.values_list - ) - for year in range(first_projected_year, end_year + 1): - cola = get_irs_cola(parameters, year, base_year) - # Nearest multiple of $50; an exact half rounds up. - increase = math.floor(base * cola / ROUNDING_INTERVAL + 0.5) * ROUNDING_INTERVAL - cap.update(period=f"year:{year}-01-01:1", value=float(base + increase)) - cap.update( - start=instant(f"{end_year}-01-01"), - value=cap(f"{end_year}-01-01"), - ) - - def get_average_for_12_months_ending_march(cpi: Parameter, year: int) -> float: """Average a monthly price index over the 12 months ending March 31. @@ -297,12 +230,7 @@ def get_average_for_12_months_ending_march(cpi: Parameter, year: int) -> float: ) -# 26 U.S.C. 223(b)(2) dollar amounts by coverage (parameter name, amount) and -# the base year 223(g)(1)(B)(i) substitutes for calendar year 2016. -HSA_CONTRIBUTION_LIMIT_STATUTORY_BASES = ( - ("self_only", 2_250), # 223(b)(2)(A) - ("family", 4_500), # 223(b)(2)(B) -) +# The base year 223(g)(1)(B)(i) substitutes for calendar year 2016. HSA_CONTRIBUTION_LIMIT_BASE_YEAR = 1997 @@ -354,74 +282,6 @@ def get_hsa_cola( return max(chained / denominator - 1, 0) -def extend_hsa_contribution_limits(parameters: ParameterNode, end_year: int) -> None: - """Project the HSA contribution limits for self-only and family coverage. - - 26 U.S.C. 223(g) increases the 223(b)(2) amounts ($2,250 self-only and - $4,500 family) by the cost-of-living adjustment in ``get_hsa_cola`` and - rounds each increase to the nearest multiple of $50. Each year is - computed from the statutory base rather than chained from the last - rounded value; IRS values encoded in the YAML take precedence for their - own years. - """ - ROUNDING_INTERVAL = 50 - limit = parameters.gov.irs.gross_income.health_savings_account_contributions.limit - denominator = get_hsa_cola_denominator(parameters) - colas = {} - for name, base in HSA_CONTRIBUTION_LIMIT_STATUTORY_BASES: - parameter = getattr(limit, name) - first_projected_year = 1 + max( - int(value.instant_str[:4]) for value in parameter.values_list - ) - for year in range(first_projected_year, end_year + 1): - if year not in colas: - colas[year] = get_hsa_cola(parameters, year, denominator) - # Nearest multiple of $50; an exact half rounds up. - increase = ( - math.floor(base * colas[year] / ROUNDING_INTERVAL + 0.5) - * ROUNDING_INTERVAL - ) - parameter.update( - period=f"year:{year}-01-01:1", value=float(base + increase) - ) - parameter.update( - start=instant(f"{end_year}-01-01"), - value=parameter(f"{end_year}-01-01"), - ) - - -def extend_or_ctc_parameters(parameters: ParameterNode, end_year: int) -> None: - """Project the Oregon Kids' Credit amount and phase-out start. - - ORS 315.273(5) recomputes both dollar amounts each tax year from the - statutory bases ($1,000 per child and a $25,000 income threshold), - applying the cost-of-living adjustment and rounding any increase down to - the next lower multiple of $50 (subsection (5)(d)). Each year is computed - from the bases rather than chained from later rounded values, so no - rounding residue compounds; Department of Revenue published values - encoded in the YAML take precedence for their own years. - """ - ROUNDING_INTERVAL = 50 - ctc = parameters.gov.states.children["or"].tax.income.credits.ctc - for parameter, base in ( - (ctc.amount, 1_000), - (ctc.reduction.start, 25_000), - ): - first_projected_year = 1 + max( - int(value.instant_str[:4]) for value in parameter.values_list - ) - for year in range(first_projected_year, end_year + 1): - cola = get_or_ctc_cola(parameters, year) - increase = math.floor(base * cola / ROUNDING_INTERVAL) * ROUNDING_INTERVAL - parameter.update( - period=f"year:{year}-01-01:1", value=float(base + increase) - ) - parameter.update( - start=instant(f"{end_year}-01-01"), - value=parameter(f"{end_year}-01-01"), - ) - - def get_nyc_income_tax_elimination_credit_cola( parameters: ParameterNode, tax_year: int ) -> float: @@ -439,37 +299,180 @@ def get_nyc_income_tax_elimination_credit_cola( return max(window / base - 1, 0) -def extend_nyc_income_tax_elimination_credit_thresholds( - parameters: ParameterNode, end_year: int -) -> None: - """Project the NYC income tax elimination credit income thresholds. - - Tax Law § 1310(h)(1)(B)(iii) multiplies the statutory amounts, which - apply to tax year 2025, by one plus the cost-of-living adjustment for - each tax year from 2026. Each year is computed from the statutory - amounts rather than chained from the prior year. The statute specifies - no rounding, so none is applied. Department of Taxation and Finance - published values encoded in the YAML take precedence for their own - years. +# Indices for base-mode uprating. Statutes that index a stated dollar amount +# from a base year give each tax year that amount plus its increase, the +# amount times the cost-of-living adjustment, rounded. Core's base mode +# (``metadata.uprating.base``) computes exactly that from an index: +# +# value(Y) = base + round(base * (index(Y) / index(base.period) - 1)) +# +# with ``base.floor`` holding the ratio at 1, for statutes that add "the +# percentage (if any) by which" the index exceeds its base-year level. Each +# index below holds, at tax year Y, the statute's index for the calendar year +# before Y, so a statute's base year B is ``base.period: B + 1``. The values +# run through ``end_year`` and hold from there. + + +def _set_annual_index(index: Parameter, values: Dict[int, float], end_year: int): + for year, value in values.items(): + index.update(period=f"year:{year}-01-01:1", value=value) + index.update(start=instant(f"{end_year}-01-01"), value=values[end_year]) + + +def _first_index_year(index: Parameter) -> int: + """The first tax year an index covers: its YAML placeholder's year.""" + return int(min(value.instant_str for value in index.values_list)[:4]) + + +def set_irs_c_cpi_u_index(parameters: ParameterNode, end_year: int) -> None: + """Fill ``gov.irs.indexing.c_cpi_u``, the 26 U.S.C. 1(f)(3) index. + + For tax year Y, the index for calendar year Y - 1: from 2016, the C-CPI-U + averaged over the 12 months ending August 31 (1(f)(6)(B)); before 2016, + ``get_irs_cola_denominator``'s value for that year, the CPI-U over the + same months times the 1(f)(3)(B) ratio for 2016. So for a provision that + substitutes base year B (2016 or earlier) for 2016 in 1(f)(3)(A)(ii), + index(Y) / index(B + 1) - 1 is ``get_irs_cola(parameters, Y, B)`` before + its floor at zero, which ``base.floor`` applies. Before 2018 the IRS + indexed by the CPI-U, and the ratio of two pre-2017 values is the CPI-U + ratio it used. """ - STATUTORY_YEAR = 2025 - thresholds = parameters.gov.local.ny.nyc.tax.income.credits.income_tax_elimination.income_threshold - for scale in thresholds.children.values(): - for bracket in scale.brackets: - amount = bracket.amount - base = amount(f"{STATUTORY_YEAR}-01-01") - first_projected_year = 1 + max( - int(value.instant_str[:4]) for value in amount.values_list + index = parameters.gov.irs.indexing.c_cpi_u + chained = parameters.gov.bls.cpi.c_cpi_u + values = {} + for year in range(_first_index_year(index), end_year + 1): + calendar_year = year - 1 + if calendar_year >= 2016: + values[year] = get_average_for_12_months_ending_august( + chained, calendar_year ) - for year in range(first_projected_year, end_year + 1): - cola = get_nyc_income_tax_elimination_credit_cola(parameters, year) - amount.update( - period=f"year:{year}-01-01:1", value=float(base * (1 + cola)) - ) - amount.update( - start=instant(f"{end_year}-01-01"), - value=amount(f"{end_year}-01-01"), + else: + values[year] = get_irs_cola_denominator(parameters, calendar_year) + _set_annual_index(index, values, end_year) + + +def set_hsa_c_cpi_u_index(parameters: ParameterNode, end_year: int) -> None: + """Fill ``gov.irs.indexing.hsa_c_cpi_u``, the 26 U.S.C. 223(g)(1) index. + + For tax year Y, the index for calendar year Y - 1, averaged over the 12 + months ending March 31, as 223(g)(1) applies 1(f)(4): for the 1997 base + year, ``get_hsa_cola_denominator``; from calendar year 2017, the C-CPI-U; + for calendar years 1998 to 2016, when 223(g) indexed by the CPI-U, the + CPI-U scaled to the denominator. So index(Y) / index(1998) - 1 is + ``get_hsa_cola(parameters, Y)`` before its floor at zero from 2018, and + the CPI-U adjustment before. + """ + index = parameters.gov.irs.indexing.hsa_c_cpi_u + cpi = parameters.gov.bls.cpi + denominator = get_hsa_cola_denominator(parameters) + cpi_u_base_year = get_average_for_12_months_ending_march( + cpi.cpi_u, HSA_CONTRIBUTION_LIMIT_BASE_YEAR + ) + values = {} + for year in range(_first_index_year(index), end_year + 1): + calendar_year = year - 1 + if calendar_year == HSA_CONTRIBUTION_LIMIT_BASE_YEAR: + values[year] = denominator + elif calendar_year >= 2017: + values[year] = get_average_for_12_months_ending_march( + cpi.c_cpi_u, calendar_year ) + else: + values[year] = ( + get_average_for_12_months_ending_march(cpi.cpi_u, calendar_year) + * denominator + / cpi_u_base_year + ) + _set_annual_index(index, values, end_year) + + +def set_medical_care_c_cpi_u_index(parameters: ParameterNode, end_year: int) -> None: + """Build the medical index for projecting long-term care premium limits. + + 26 U.S.C. 213(d)(10)(B)(ii) compares the medical care component of the + C-CPI-U for August of the year before the tax year with that component of + the CPI for August 1996, "multiplied by the amount determined under + section 1(f)(3)(B)". That default conversion uses the all-items indexes + averaged over the 12 months ending August 2016. The Secretary, in + consultation with the Secretary of Health and Human Services, must + prescribe an adjustment the Secretary determines more appropriate. The + available sources do not identify a prescribed replacement method. + + The model retains the stated annual IRS limits. For unpublished + limits, it chooses the medical components' August-2016 ratio as a + splice convention, joining their levels at that overlap. Each 1997 + amount plus its increase rounded to the nearest $10 then gives all five + 2027 limits in Rev. Proc. 2026-35, section 3.29. This consistency does + not identify the agency's exact method. + Earlier published limits depart from this formula (see + ``tests/core/test_base_mode_uprating.py``). + + For tax year Y, the index takes August of Y - 1 and scales CPI-U medical + values through August 2016 by that ratio. From August 2017, it reads + C-CPI-U medical values through the last published August. After that, + it grows the last observed level with CBO's calendar-year CPI-U medical + care growth (``gov.bls.cpi.cpi_u_medical_care``). That annual unchained + growth proxies future chained August growth. + """ + index = parameters.gov.irs.indexing.medical_care_c_cpi_u + cpi = parameters.gov.bls.cpi + unchained = cpi.cpi_u_medical_care_nsa_august + chained = cpi.c_cpi_u_medical_care_august + ratio_2016 = chained("2016-08-01") / unchained("2016-08-01") + last_august = max(int(value.instant_str[:4]) for value in chained.values_list) + last_chained = chained(f"{last_august}-08-01") + projection = cpi.cpi_u_medical_care + values = {} + for year in range(_first_index_year(index), end_year + 1): + august = year - 1 + if august <= 2016: + values[year] = unchained(f"{august}-08-01") * ratio_2016 + elif august <= last_august: + values[year] = chained(f"{august}-08-01") + else: + values[year] = ( + last_chained + * projection(f"{august}-01-01") + / projection(f"{last_august}-01-01") + ) + _set_annual_index(index, values, end_year) + + +def set_or_ctc_cpi(parameters: ParameterNode, end_year: int) -> None: + """Fill the Oregon Kids' Credit index, ORS 315.273(5). + + For the 2023 base year, ``get_or_ctc_cpi_base``, the second-quarter 2022 + CPI-U; for each later tax year Y, the CPI-U averaged over the 12 months + ending August 31 of Y - 1. So index(Y) / index(2023) - 1 is + ``get_or_ctc_cola(parameters, Y)`` before its floor at zero. + """ + index = parameters.gov.states.children["or"].tax.income.credits.ctc.cpi + first_year = _first_index_year(index) + values = {first_year: get_or_ctc_cpi_base(parameters)} + for year in range(first_year + 1, end_year + 1): + values[year] = get_cpi_u_average_for_12_months_ending_august( + parameters, year - 1 + ) + _set_annual_index(index, values, end_year) + + +def set_nyc_income_tax_elimination_credit_cpi( + parameters: ParameterNode, end_year: int +) -> None: + """Fill the NYC income tax elimination credit index, Tax Law § 1310(h). + + For tax year Y, the CPI-U averaged over the 12 months ending August 31 of + Y - 1 (§ 1310(h)(3)(A)); the 2025 value, the base for the statutory + amounts, is the 2024 index. So index(Y) / index(2025) - 1 is + ``get_nyc_income_tax_elimination_credit_cola(parameters, Y)`` before its + floor at zero. + """ + index = parameters.gov.local.ny.nyc.tax.income.credits.income_tax_elimination.cpi + values = { + year: get_cpi_u_average_for_12_months_ending_august(parameters, year - 1) + for year in range(_first_index_year(index), end_year + 1) + } + _set_annual_index(index, values, end_year) def get_projected_cpi_u_for_month(cpi: Parameter, month: Instant) -> float: @@ -1746,11 +1749,11 @@ def set_all_uprating_parameters(parameters: ParameterNode) -> ParameterNode: period_day=1, ) - # Oregon Kids' Credit dollar amounts follow the ORS 315.273(5) - # cost-of-living schedule (unchained CPI-U over a 2022 Q2 base), computed - # from the statutory base amounts. Must run after the CPI-U extension - # above so projected windows are available. - extend_or_ctc_parameters(parameters, end_year=END_YEAR) + # The Oregon Kids' Credit index under ORS 315.273(5) (unchained CPI-U + # over a 2022 Q2 base), which the credit amount and phase-out start + # follow from their statutory bases in base mode. Must run after the + # CPI-U extension above so projected windows are available. + set_or_ctc_cpi(parameters, end_year=END_YEAR) # Louisiana's standard deduction and age-65 retirement income exemption # follow R.S. 47:294(B) and 47:44.1(A): the prior year's amount times the @@ -1765,27 +1768,29 @@ def set_all_uprating_parameters(parameters: ParameterNode) -> ParameterNode: # since September 1988, rather than chaining annual rounded changes. extend_medicaid_spousal_impoverishment_standards(parameters, end_year=END_YEAR) - # The limits on a dependent's standard deduction follow 26 U.S.C. - # 63(c)(4)'s chained CPI-U schedule, computed from the statutory 1987 and - # 1997 bases. Must run after the Chained CPI-U extension above so + # The 26 U.S.C. 1(f)(3) index, which the limits on a dependent's standard + # deduction (63(c)(4), 1987 and 1997 bases) and the educator expense cap + # (62(d)(3), 2014 base) follow from their statutory bases in base mode. + # Must run after the Chained CPI-U and CPI-U extensions above so # projected windows are available. - extend_dependent_standard_deduction_parameters(parameters, end_year=END_YEAR) - - # The educator expense cap follows 26 U.S.C. 62(d)(3)'s chained CPI-U - # schedule, computed from the statutory $250 and 2014 base year. Must run - # after the Chained CPI-U extension above. - extend_educator_expense_cap(parameters, end_year=END_YEAR) - - # The HSA contribution limits follow 26 U.S.C. 223(g)'s chained CPI-U - # schedule (12 months ending March 31), computed from the statutory - # $2,250 and $4,500 and the 1997 base year. Must run after the Chained - # CPI-U and CPI-U extensions above so projected windows are available. - extend_hsa_contribution_limits(parameters, end_year=END_YEAR) - - # NYC income tax elimination credit thresholds follow the Tax Law - # § 1310(h)(1)(B)(iii) schedule (CPI-U for the 12 months ending August 31 - # over the 2024 index), computed from the statutory 2025 amounts. Must run - # after the CPI-U extension above so projected windows are available. - extend_nyc_income_tax_elimination_credit_thresholds(parameters, end_year=END_YEAR) + set_irs_c_cpi_u_index(parameters, end_year=END_YEAR) + + # The 26 U.S.C. 223(g) index (12 months ending March 31), which the HSA + # contribution limits follow from the statutory $2,250 and $4,500 and the + # 1997 base year. Must run after the Chained CPI-U and CPI-U extensions + # above so projected windows are available. + set_hsa_c_cpi_u_index(parameters, end_year=END_YEAR) + + # The 26 U.S.C. 213(d)(10)(B) medical care index, which the long-term + # care premium limits follow from their 1997 amounts. Must run after the + # CPI-U medical care extension above. + set_medical_care_c_cpi_u_index(parameters, end_year=END_YEAR) + + # The NYC income tax elimination credit index under Tax Law + # § 1310(h)(1)(B)(iii) (CPI-U for the 12 months ending August 31 over the + # 2024 index), which the thresholds follow from the statutory 2025 + # amounts. Must run after the CPI-U extension above so projected windows + # are available. + set_nyc_income_tax_elimination_credit_cpi(parameters, end_year=END_YEAR) return parameters diff --git a/policyengine_us/reforms/ssa/__init__.py b/policyengine_us/reforms/ssa/__init__.py index a32357de2e0..1f43cbbf13f 100644 --- a/policyengine_us/reforms/ssa/__init__.py +++ b/policyengine_us/reforms/ssa/__init__.py @@ -17,5 +17,6 @@ from .trustees_core_thresholds import ( TRUSTEES_CORE_THRESHOLD_ASSUMPTION, create_trustees_core_thresholds_reform, + trustees_core_threshold_parameters, trustees_core_thresholds_reform, ) diff --git a/policyengine_us/reforms/ssa/trustees_2026.py b/policyengine_us/reforms/ssa/trustees_2026.py index 3e679b77b4d..59301c2a600 100644 --- a/policyengine_us/reforms/ssa/trustees_2026.py +++ b/policyengine_us/reforms/ssa/trustees_2026.py @@ -398,6 +398,11 @@ def _rederive_reader( stay as stated. """ meta = normalize_uprating_metadata(parameter.metadata["uprating"]) + if "base" in meta: + raise ValueError( + f"{parameter.name} uprates by {path.name} from a statutory base " + "year, which the SSA Trustees 2026 assumptions don't re-derive." + ) if "at_defined_interval" in meta or "start_instant" in meta: raise ValueError( f"{parameter.name} uprates by {path.name} on a cadence or from a " diff --git a/policyengine_us/reforms/ssa/trustees_core_thresholds.py b/policyengine_us/reforms/ssa/trustees_core_thresholds.py index 4c34c86ada5..af4d636cf97 100644 --- a/policyengine_us/reforms/ssa/trustees_core_thresholds.py +++ b/policyengine_us/reforms/ssa/trustees_core_thresholds.py @@ -3,6 +3,8 @@ import math from typing import Any +from policyengine_core.periods import instant + from policyengine_us.model_api import Reform @@ -12,7 +14,11 @@ "Best-public Trustees tax-side approximation: keep Social Security " "benefit-tax thresholds fixed, but wage-index all federal income tax " "parameters that otherwise use IRS CPI uprating after 2034 using the " - "active NAWI path." + "active NAWI path. Parameters that follow one of those, such as the " + "joint standard deduction at twice the single amount, follow it onto " + "the wage path. Amounts a statute indexes from a base amount, such " + "as the head of household standard deduction, round their increase " + "over that base, as the statute does." ), "source": "SSA 2025 Trustees Report V.C.7 and OACT email clarification, May 6, 2026", "start_year": 2035, @@ -20,7 +26,11 @@ "parameter_groups": [ "all_gov_irs_uprating_parameters", ], - "uprating_parameter": "gov.irs.uprating", + "uprating_parameters": ( + "gov.irs.uprating", + "gov.irs.indexing.c_cpi_u", + "gov.irs.indexing.hsa_c_cpi_u", + ), "wage_index": "gov.ssa.nawi", "not_default_current_law": True, } @@ -59,8 +69,15 @@ def _get_parameter_by_name(parameters, name: str): def _iter_updatable_parameters( root, *, - uprating_parameter: str | None = None, + uprating_parameter: str | tuple[str, ...] | None = None, ) -> list: + """Parameters under ``root`` whose uprating names ``uprating_parameter``. + + ``uprating_parameter`` takes one parameter name or a tuple of them; with + ``None``, every parameter that names an uprating parameter qualifies. + """ + if isinstance(uprating_parameter, str): + uprating_parameter = (uprating_parameter,) candidates = [root] if hasattr(root, "get_descendants"): candidates.extend(root.get_descendants()) @@ -72,12 +89,28 @@ def _iter_updatable_parameters( uprating_name = _uprating_parameter_name(candidate) if uprating_name is None: continue - if uprating_parameter is not None and uprating_name != uprating_parameter: + if uprating_parameter is not None and uprating_name not in uprating_parameter: continue result.append(candidate) return result +def _statutory_base(parameter) -> float | None: + """The base amount of a parameter on core's base-mode uprating, else None. + + That is ``uprating.base.value``, or the parameter's value at + ``uprating.base.period`` when the block states no value. + """ + uprating = getattr(parameter, "metadata", {}).get("uprating") + if not isinstance(uprating, dict) or "base" not in uprating: + return None + base = uprating["base"] + value = base.get("value") + if value is None: + value = parameter(instant(base["period"])) + return float(value) + + def _apply_wage_growth_to_parameter( parameter, *, @@ -96,6 +129,7 @@ def _apply_wage_growth_to_parameter( # Validate that the referenced default uprating parameter exists. _get_parameter_by_name(parameters, uprating_name) values_by_year = {} + statutory_base = _statutory_base(parameter) for year in range(projection_base_year + 1, start_year): values_by_year[year] = float(parameter(f"{year}-01-01")) @@ -104,10 +138,19 @@ def _apply_wage_growth_to_parameter( base_nawi = float(parameters.gov.ssa.nawi(f"{start_year - 2}-01-01")) for year in range(start_year, end_year + 1): nawi_ratio = float(parameters.gov.ssa.nawi(f"{year - 1}-01-01")) / base_nawi - updated_value = _round_amount( - base_value * nawi_ratio, - rounding, - ) + if statutory_base is None: + updated_value = _round_amount( + base_value * nawi_ratio, + rounding, + ) + else: + # The statute rounds the increase over its base amount, as + # 63(c)(7)(B)(ii) does over the $23,625 head of household amount, + # so the wage path keeps the base plus whole rounding steps. + updated_value = statutory_base + _round_amount( + base_value * nawi_ratio - statutory_base, + rounding, + ) values_by_year[year] = updated_value for year, value in values_by_year.items(): @@ -117,12 +160,91 @@ def _apply_wage_growth_to_parameter( ) +def _apply_leader_growth_to_follower( + parameter, + leader, + *, + start_year: int, + end_year: int, +) -> None: + """Re-uprate a follower from its wage-indexed leader, as core does. + + A follower names another parameter as its uprating index, as the joint + standard deduction names the single amount. Core chains it from its + last value by the leader's ratio and rounds it, so from ``start_year`` + the follower takes its ``start_year - 1`` value times the leader's + growth since then. + """ + uprating = parameter.metadata.get("uprating") + rounding = uprating.get("rounding") if isinstance(uprating, dict) else None + base_value = float(parameter(f"{start_year - 1}-01-01")) + base_leader = float(leader(f"{start_year - 1}-01-01")) + for year in range(start_year, end_year + 1): + leader_ratio = float(leader(f"{year}-01-01")) / base_leader + parameter.update( + period=f"year:{year}-01-01:1", + value=_round_amount(base_value * leader_ratio, rounding), + ) + + def _federal_income_tax_roots(parameters) -> list: return [ parameters.gov.irs, ] +def _wage_indexing_plan(parameters) -> list[tuple[Any, Any]]: + """The parameters the reform re-projects, each with its leader. + + First every IRS parameter that uprates by one of the assumption's CPI + indices, in tree order, with no leader; then each parameter that uprates + by one of those, such as the joint standard deduction, which follows + the single amount, with that leader; then their own followers, a + generation at a time. A leader always comes before its followers. + """ + plan = [] + seen = set() + leaders = {} + for root in _federal_income_tax_roots(parameters): + for parameter in _iter_updatable_parameters( + root, + uprating_parameter=TRUSTEES_CORE_THRESHOLD_ASSUMPTION[ + "uprating_parameters" + ], + ): + if parameter.name in seen: + continue + seen.add(parameter.name) + plan.append((parameter, None)) + leaders[parameter.name] = parameter + while leaders: + followers = {} + for root in _federal_income_tax_roots(parameters): + for parameter in _iter_updatable_parameters( + root, uprating_parameter=tuple(leaders) + ): + if parameter.name in seen: + continue + seen.add(parameter.name) + plan.append((parameter, leaders[_uprating_parameter_name(parameter)])) + followers[parameter.name] = parameter + leaders = followers + return plan + + +def trustees_core_threshold_parameters(parameters) -> list: + """Every parameter the Trustees core-thresholds reform re-projects. + + The IRS parameters that uprate by one of + ``TRUSTEES_CORE_THRESHOLD_ASSUMPTION["uprating_parameters"]``, in tree + order, then the parameters that follow one of them (the joint and + surviving spouse standard deductions follow the single amount) and + their own followers. The reform re-projects exactly these, in this + order; some keep their values, such as amounts of zero. + """ + return [parameter for parameter, _ in _wage_indexing_plan(parameters)] + + def _parameters_have_long_run_projection(parameters, end_year: int) -> bool: parameter = parameters.gov.irs.income.bracket.thresholds.children["1"].SINGLE return any( @@ -141,24 +263,17 @@ def create_trustees_core_thresholds_reform( This is an explicit scenario assumption, not default current law. It leaves Social Security benefit-tax thresholds unchanged and wage-indexes federal IRS parameters that otherwise use CPI-linked IRS uprating from - ``start_year``. + ``start_year``. Parameters that uprate by one of those follow it. """ def modify_parameters(parameters): if not _parameters_have_long_run_projection(parameters, end_year): return parameters - seen = set() - for root in _federal_income_tax_roots(parameters): - for parameter in _iter_updatable_parameters( - root, - uprating_parameter=TRUSTEES_CORE_THRESHOLD_ASSUMPTION[ - "uprating_parameter" - ], - ): - if parameter.name in seen: - continue - seen.add(parameter.name) + # The same plan trustees_core_threshold_parameters lists, leaders + # before their followers. + for parameter, leader in _wage_indexing_plan(parameters): + if leader is None: _apply_wage_growth_to_parameter( parameter, parameters=parameters, @@ -166,6 +281,13 @@ def modify_parameters(parameters): end_year=end_year, projection_base_year=projection_base_year, ) + else: + _apply_leader_growth_to_follower( + parameter, + leader, + start_year=start_year, + end_year=end_year, + ) return parameters class reform(Reform): diff --git a/policyengine_us/tests/code_health/test_source_conflicts.py b/policyengine_us/tests/code_health/test_source_conflicts.py index 59c143f2fdc..d7ded8ef3ef 100644 --- a/policyengine_us/tests/code_health/test_source_conflicts.py +++ b/policyengine_us/tests/code_health/test_source_conflicts.py @@ -131,6 +131,7 @@ "policyengine_us/parameters/gov/irs/credits/residential_clean_energy/fuel_cell_cap_per_kw.yaml": 1, "policyengine_us/parameters/gov/irs/income/exemption/overtime/hce_salary_threshold.yaml": 1, "policyengine_us/parameters/gov/irs/income/exemption/overtime/salary_basis_threshold.yaml": 1, + "policyengine_us/parameters/gov/irs/indexing/medical_care_c_cpi_u.yaml": 1, "policyengine_us/parameters/gov/states/ar/ade/oec/sra/rates/no_copay_smi_threshold.yaml": 1, "policyengine_us/parameters/gov/states/ca/cpuc/income_sources.yaml": 1, "policyengine_us/parameters/gov/states/ca/hbex/premium_subsidy/fpl_limit.yaml": 1, diff --git a/policyengine_us/tests/core/test_base_mode_uprating.py b/policyengine_us/tests/core/test_base_mode_uprating.py new file mode 100644 index 00000000000..727b0deea1d --- /dev/null +++ b/policyengine_us/tests/core/test_base_mode_uprating.py @@ -0,0 +1,798 @@ +"""Base-mode uprating of amounts that statutes index from a base year. + +Core's base mode (``metadata.uprating.base``) projects each year after a +parameter's last stated value as + + base + round(base * (index(Y) / index(base.period) - 1)) + +with ``base.floor`` holding the index ratio at one or above, for statutes +that add "the percentage (if any) by which" the index exceeds its base-year +level. These tests check, on the shipped parameter tree: + +(a) the invariants of every base-mode parameter in every projected year + through 2100: a whole number of rounding steps above the base, never + below the base, and never falling while its index rises, from the last + stated value on; +(b) each projection against the formula recomputed here from the index; +(c) each parameter's uprating metadata against a table read from the + statute, and each projection against that table's constants, so a + wrong base, base period or rounding rule in the metadata fails; +(d) 26 U.S.C. 63(c)(2): the joint and surviving spouse standard deductions + equal twice the single amount, and the separate amount the single + amount, in every year; +(e) a back-test of the amounts the IRS printed against each statute's + formula on the model's price series, with each departure pinned. + +The tests for each program's own index (test_uprating_extensions.py, +test_hsa_contribution_limits.py, +test_nyc_income_tax_elimination_credit_indexing.py and test_or_ctc_sunset.py) +compare the projections with the cost-of-living helpers the retired +hand-coded extensions used. +""" + +import math +import numbers +from dataclasses import dataclass +from fractions import Fraction +from typing import Optional + +import pytest +from hypothesis import given, settings, strategies as st +from policyengine_core.parameters import Parameter +from policyengine_core.parameters.operations.get_parameter import get_parameter +from policyengine_core.parameters.operations.uprate_parameters import project_from_base + +from policyengine_us.parameters.uprating_extensions import ( + get_average_for_12_months_ending_august, + get_irs_cola, +) +from policyengine_us.system import system + +PARAMETERS = system.parameters +LAST_YEAR = 2100 +SD = PARAMETERS.gov.irs.deductions.standard.amount +LTC = PARAMETERS.gov.irs.deductions.itemized.medical.long_term_care_premium_limit +CTC = PARAMETERS.gov.irs.credits.ctc + + +def _base_mode_parameters(): + return [ + parameter + for parameter in PARAMETERS.get_descendants() + if isinstance(parameter, Parameter) + and isinstance(parameter.metadata.get("uprating"), dict) + and "base" in parameter.metadata["uprating"] + ] + + +BASE_MODE_PARAMETERS = _base_mode_parameters() +BASE_MODE_IDS = [parameter.name for parameter in BASE_MODE_PARAMETERS] + +NYC_THRESHOLDS = "gov.local.ny.nyc.tax.income.credits.income_tax_elimination" + + +def test_base_mode_covers_the_statutory_amounts(): + names = set(BASE_MODE_IDS) + expected = { + "gov.irs.deductions.standard.amount.SINGLE", + "gov.irs.deductions.standard.amount.SEPARATE", + "gov.irs.deductions.standard.amount.HEAD_OF_HOUSEHOLD", + "gov.irs.credits.ctc.amount.base[0].amount", + "gov.irs.credits.ctc.refundable.individual_max", + "gov.irs.deductions.standard.dependent.amount", + "gov.irs.deductions.standard.dependent.additional_earned_income", + "gov.irs.ald.educator_expense.cap", + "gov.irs.gross_income.health_savings_account_contributions.limit.self_only", + "gov.irs.gross_income.health_savings_account_contributions.limit.family", + "gov.states.or.tax.income.credits.ctc.amount", + "gov.states.or.tax.income.credits.ctc.reduction.start", + "gov.states.az.tax.income.deductions.standard.amount.SINGLE", + "gov.states.az.tax.income.deductions.standard.amount.SEPARATE", + "gov.states.az.tax.income.deductions.standard.amount.HEAD_OF_HOUSEHOLD", + *( + "gov.irs.deductions.itemized.medical.long_term_care_premium_limit" + f"[{bracket}].amount" + for bracket in range(5) + ), + } + assert expected <= names, expected - names + nyc = {name for name in names if name.startswith(NYC_THRESHOLDS)} + # Two tables of 7 brackets and three of 8, amounts only. + assert len(nyc) == 2 * 7 + 3 * 8 + assert all(name.endswith(".amount") for name in nyc) + assert names == expected | nyc + + +def _spec(parameter): + """Index, base period, base value, rounding and floor of a parameter.""" + meta = parameter.metadata["uprating"] + base = meta["base"] + period = base["period"] + value = base.get("value") + if value is None: + value = parameter(f"{period}-01-01") + index = get_parameter(PARAMETERS, meta["parameter"]) + return index, period, value, meta.get("rounding"), base.get("floor", False) + + +def _last_stated_year(parameter): + return max( + int(value.instant_str[:4]) + for value in parameter.values_list + if value.file_path is not None + ) + + +def _projected_years(parameter): + return range(_last_stated_year(parameter) + 1, LAST_YEAR + 1) + + +def _projection(base, index_at_year, index_at_base, rounding, floor): + """One projection from recorded decimals; no snap or precision guessing.""" + if math.isinf(base): + return float(base) + if rounding is None: + ratio = index_at_year / index_at_base + return float(base * (max(ratio, 1.0) if floor else ratio)) + ratio = _exact(index_at_year) / _exact(index_at_base) + if floor: + ratio = max(ratio, Fraction(1)) + step = _exact(rounding["interval"]) + intervals = _exact(base) * (ratio - 1) / step + whole, remainder = divmod(intervals.numerator, intervals.denominator) + kind = rounding["type"] + if kind == "upwards": + whole += bool(remainder) + elif kind == "nearest": + whole += 2 * remainder >= intervals.denominator + else: + assert kind == "downwards", kind + return float(_exact(base) + whole * step) + + +@pytest.mark.parametrize("parameter", BASE_MODE_PARAMETERS, ids=BASE_MODE_IDS) +def test_projections_keep_the_base_mode_invariants(parameter): + index, period, base, rounding, floor = _spec(parameter) + years = list(_projected_years(parameter)) + assert years, parameter.name + # Start from the last stated year, so the step from the last IRS or CBO + # value to the first projected value is checked too. + last_stated = f"{_last_stated_year(parameter)}-01-01" + previous_value, previous_index = parameter(last_stated), index(last_stated) + for year in years: + value = parameter(f"{year}-01-01") + if rounding is not None: + steps = (value - base) / rounding["interval"] + assert steps == pytest.approx(round(steps), abs=1e-9), year + if floor: + assert value >= base, year + current_index = index(f"{year}-01-01") + if previous_index is not None and current_index >= previous_index: + assert value >= previous_value, year + previous_value, previous_index = value, current_index + # Projections hold their last value. + assert parameter(f"{LAST_YEAR + 50}-01-01") == parameter(f"{LAST_YEAR}-01-01") + + +@pytest.mark.parametrize("parameter", BASE_MODE_PARAMETERS, ids=BASE_MODE_IDS) +def test_projections_match_the_formula_from_the_index(parameter): + index, period, base, rounding, floor = _spec(parameter) + for year in _projected_years(parameter): + expected = _projection( + base, index(f"{year}-01-01"), index(f"{period}-01-01"), rounding, floor + ) + actual = parameter(f"{year}-01-01") + if rounding is None: + assert actual == pytest.approx(expected, rel=1e-12), year + else: + assert actual == expected, year + + +# (c) The statute, read independently of the metadata. Each row gives the +# index, the base amount, the base period in the index's own periods, whether +# the statute floors the adjustment at zero ("the percentage (if any) by +# which"), and how it rounds the increase. Each index holds at period Y the +# price level of calendar year Y - 1 (for the medical care index, August of +# Y - 1; for Oregon's, period 2023 holds the second quarter of 2022), so a +# statute's base year B is period B + 1. + + +@dataclass(frozen=True) +class Statute: + citation: str + index: str + # None: the base is the parameter's own value at the base period. + base: Optional[float] + period: int + floor: bool + # "downwards", "upwards" or "nearest"; None for no rounding. + rounding: Optional[str] + interval: Optional[int] + + +IRS_UPRATING = "gov.irs.uprating" +IRS_C_CPI_U = "gov.irs.indexing.c_cpi_u" +# 1(f)(3)(A): "the percentage (if any) by which" the C-CPI-U exceeds its +# base-year level, so every 1(f)(3) amount floors the adjustment. +SD_SINGLE = Statute( + # 63(c)(7)(A)(ii) puts $15,750 in 63(c)(2)(C); (7)(B)(ii) indexes it with + # 2024 as the base year, increases rounded to the next lowest $50. + "26 U.S.C. 63(c)(7)(A)(ii), (B)(ii)", + IRS_UPRATING, + 15_750, + 2025, + True, + "downwards", + 50, +) +LTC_INDEX = "gov.irs.indexing.medical_care_c_cpi_u" +LTC_CITATION = "26 U.S.C. 213(d)(10)(A), (B)" +NYC_INDEX = f"{NYC_THRESHOLDS}.cpi" +OR_INDEX = "gov.states.or.tax.income.credits.ctc.cpi" +AZ_SD = "gov.states.az.tax.income.deductions.standard.amount" +STATUTE = { + "gov.irs.deductions.standard.amount.SINGLE": SD_SINGLE, + # 63(c)(2)(C), "any other case", covers separate returns too. + "gov.irs.deductions.standard.amount.SEPARATE": SD_SINGLE, + "gov.irs.deductions.standard.amount.HEAD_OF_HOUSEHOLD": Statute( + "26 U.S.C. 63(c)(7)(A)(i), (B)(ii)", + IRS_UPRATING, + 23_625, + 2025, + True, + "downwards", + 50, + ), + # A.R.S. 43-1041(A) sets Arizona's amounts to the federal 2025 ones, and + # 43-1041(H) indexes them "in the same manner in which the federal basic + # standard deduction is adjusted for inflation pursuant to section 63". + **{ + f"{AZ_SD}.{status}": Statute( + "A.R.S. 43-1041(A), (H)", + IRS_UPRATING, + base, + 2025, + True, + "downwards", + 50, + ) + for status, base in [ + ("SINGLE", 15_750), + ("SEPARATE", 15_750), + ("HEAD_OF_HOUSEHOLD", 23_625), + ] + }, + # 24(h)(2) $2,200; 24(i)(2) base year 2024; 24(i)(3) next lowest $100. + "gov.irs.credits.ctc.amount.base[0].amount": Statute( + "26 U.S.C. 24(h)(2), (i)(2)-(3)", + IRS_UPRATING, + 2_200, + 2025, + True, + "downwards", + 100, + ), + # 24(h)(5)(A) $1,400; 24(i)(1) base year 2017; 24(i)(3) next lowest $100. + "gov.irs.credits.ctc.refundable.individual_max": Statute( + "26 U.S.C. 24(h)(5)(A), (i)(1), (i)(3)", + IRS_UPRATING, + 1_400, + 2018, + True, + "downwards", + 100, + ), + # 213(d)(10)(A)'s 1997 amounts; (B)(ii) compares August of the preceding + # year with August 1996, "the percentage (if any)"; (B)(i) rounds each + # increase to the nearest $10. + **{ + "gov.irs.deductions.itemized.medical.long_term_care_premium_limit" + f"[{bracket}].amount": Statute( + LTC_CITATION, LTC_INDEX, base, 1997, True, "nearest", 10 + ) + for bracket, base in enumerate((200, 375, 750, 2_000, 2_500)) + }, + # 63(c)(5)(A) $500 and (B) $250; 63(c)(4)(B)(i) base year 1987 and + # (ii) 1997; 63(c)(4) rounds increases to the next lowest $50. + "gov.irs.deductions.standard.dependent.amount": Statute( + "26 U.S.C. 63(c)(4)(B)(i), (c)(5)(A)", + IRS_C_CPI_U, + 500, + 1988, + True, + "downwards", + 50, + ), + "gov.irs.deductions.standard.dependent.additional_earned_income": Statute( + "26 U.S.C. 63(c)(4)(B)(ii), (c)(5)(B)", + IRS_C_CPI_U, + 250, + 1998, + True, + "downwards", + 50, + ), + # 62(a)(2)(D) $250; 62(d)(3) base year 2014, nearest $50. + "gov.irs.ald.educator_expense.cap": Statute( + "26 U.S.C. 62(a)(2)(D), (d)(3)", + IRS_C_CPI_U, + 250, + 2015, + True, + "nearest", + 50, + ), + # 223(b)(2) $2,250 and $4,500; 223(g)(1) base year 1997 on 12 months + # ending March 31; 223(g)(2) nearest $50. + "gov.irs.gross_income.health_savings_account_contributions.limit.self_only": ( + Statute( + "26 U.S.C. 223(b)(2)(A), (g)", + "gov.irs.indexing.hsa_c_cpi_u", + 2_250, + 1998, + True, + "nearest", + 50, + ) + ), + "gov.irs.gross_income.health_savings_account_contributions.limit.family": ( + Statute( + "26 U.S.C. 223(b)(2)(B), (g)", + "gov.irs.indexing.hsa_c_cpi_u", + 4_500, + 1998, + True, + "nearest", + 50, + ) + ), + # ORS 315.273(3)(a) $1,000 and $25,000; (5)(b) "the percentage (if any)" + # over the second quarter of 2022; (5)(d) next lower multiple of $50. + "gov.states.or.tax.income.credits.ctc.amount": Statute( + "ORS 315.273(3)(a), (5)", OR_INDEX, 1_000, 2023, True, "downwards", 50 + ), + "gov.states.or.tax.income.credits.ctc.reduction.start": Statute( + "ORS 315.273(3)(a), (5)", OR_INDEX, 25_000, 2023, True, "downwards", 50 + ), +} +# NY Tax Law 1310(h)(1)(B)(iii): each 2025 amount times one plus the +# percentage by which the CPI for the preceding year exceeds the 2024 CPI; no +# rounding. A CPI below its 2024 level exceeds it by no percentage, hence the +# floor. The 2025 amounts are the base. +NYC_STATUTE = Statute( + "NY Tax Law 1310(h)(1)(B)(iii)", NYC_INDEX, None, 2025, True, None, None +) +# The joint and surviving spouse amounts are 200% of the 63(c)(2)(C) amount +# (63(c)(2)(A)), so they follow SINGLE; rounding to $100 only clears float +# error, since twice a multiple of $50 is a multiple of $100. +SD_FOLLOWER_UPRATING = { + "parameter": "gov.irs.deductions.standard.amount.SINGLE", + "rounding": {"type": "nearest", "interval": 100}, +} + + +def _statute(name): + if name.startswith(NYC_THRESHOLDS): + return NYC_STATUTE + return STATUTE[name] + + +def _metadata_spec(statute): + """The uprating metadata block the statute implies.""" + base = {"period": statute.period} + if statute.base is not None: + base["value"] = statute.base + if statute.floor: + base["floor"] = True + spec = {"parameter": statute.index, "base": base} + if statute.rounding is not None: + spec["rounding"] = {"type": statute.rounding, "interval": statute.interval} + return spec + + +def test_the_statute_table_covers_every_base_mode_parameter(): + nyc = [name for name in BASE_MODE_IDS if name.startswith(NYC_THRESHOLDS)] + assert set(BASE_MODE_IDS) == set(STATUTE) | set(nyc) + + +@pytest.mark.parametrize("parameter", BASE_MODE_PARAMETERS, ids=BASE_MODE_IDS) +def test_uprating_metadata_matches_the_statute(parameter): + assert parameter.metadata["uprating"] == _metadata_spec(_statute(parameter.name)) + + +@pytest.mark.parametrize("status", ["JOINT", "SURVIVING_SPOUSE"]) +def test_joint_and_surviving_spouse_follow_the_single_amount(status): + assert getattr(SD, status).metadata["uprating"] == SD_FOLLOWER_UPRATING + + +def _exact(value): + if isinstance(value, numbers.Integral) and not isinstance(value, bool): + return Fraction(int(value)) + return Fraction(repr(float(value))) + + +def _statutory_value(statute, base, year): + """The single value required by the table's exact decimal rounding rule.""" + index = get_parameter(PARAMETERS, statute.index) + rounding = ( + {"type": statute.rounding, "interval": statute.interval} + if statute.rounding is not None + else None + ) + return _projection( + base, + index(f"{year}-01-01"), + index(f"{statute.period}-01-01"), + rounding, + statute.floor, + ) + + +@pytest.mark.parametrize("parameter", BASE_MODE_PARAMETERS, ids=BASE_MODE_IDS) +def test_projections_follow_the_statute_table(parameter): + """Every projected year from 2028 to 2100 against the table's constants + and the index the table names. Stated IRS and CBO values come first: + the CTC's run to 2035, the refundable maximum's to 2034.""" + statute = _statute(parameter.name) + base = statute.base + if base is None: + base = parameter(f"{statute.period}-01-01") + first = max(2028, _last_stated_year(parameter) + 1) + for year in range(first, LAST_YEAR + 1): + value = parameter(f"{year}-01-01") + expected = _statutory_value(statute, base, year) + if statute.rounding is None: + assert value == pytest.approx(expected, rel=1e-12), year + else: + assert value == expected, (year, value, expected) + + +def test_joint_standard_deduction_is_twice_the_single_amount_in_every_year(): + """63(c)(2)(A): the joint and surviving spouse amount is 200% of the (C) + amount; (C), "any other case", covers single and separate filers alike, + so SEPARATE equals SINGLE. 63(c)(7)(B)(ii) indexes only the (B) and (C) + amounts, for head of household and single filers.""" + # 2015 is the first year amount.yaml states. + for year in range(2015, LAST_YEAR + 1): + period = f"{year}-01-01" + single = SD.SINGLE(period) + assert SD.JOINT(period) == 2 * single, year + assert SD.SURVIVING_SPOUSE(period) == 2 * single, year + assert SD.SEPARATE(period) == single, year + + +# Back-test: the printed amounts against the statute's formula, on the +# model's price series and the statute's own window (the C-CPI-U averaged +# over the 12 months ending August 31, 1(f)(4) and (6)), not +# gov.irs.uprating, whose window ends in July (#9105). A year whose window +# the series does not fully observe is skipped: the window helper carries +# the last observation flat, which the IRS never does. + +CHAINED = PARAMETERS.gov.bls.cpi.c_cpi_u +CHAINED_MONTHS = {value.instant_str for value in CHAINED.values_list} +# February instants past the observations hold annual projection points. +LAST_OBSERVED_MONTH = max( + instant for instant in CHAINED_MONTHS if not instant.endswith("-02-01") +) + + +def _window_observed(year): + """Whether the series observes each month of the window for tax year + ``year``: September of ``year - 2`` through August of ``year - 1``.""" + months = [f"{year - 2}-{month:02d}-01" for month in range(9, 13)] + [ + f"{year - 1}-{month:02d}-01" for month in range(1, 9) + ] + return all( + month in CHAINED_MONTHS and month <= LAST_OBSERVED_MONTH for month in months + ) + + +def test_back_test_skips_only_the_unobserved_windows(): + """2026 reads Sep 2024-Aug 2025, all observed. c_cpi_u.yaml holds no + October 2025 value and ends at June 2026, inside the 2027 window.""" + assert all(_window_observed(year) for year in range(2013, 2027)) + assert not _window_observed(2027) + + +def _statutory_cola(year, base_year): + """The 1(f)(3) adjustment for ``year`` as TCJA wrote it: the C-CPI-U + over the base year's CPI-U times the 1(f)(3)(B) ratio. + + For tax years before 2018 the IRS divided the CPI-U by the CPI-U. The + earned income addition and educator cap back-tests reach back to 2013 + and 2016, and recomputing those years with the CPI-U numerator gives the + same rounded amounts ($350; $250), so the chained formula stands in for + the older one there. + """ + if base_year <= 2016: + return get_irs_cola(PARAMETERS, year, base_year) + numerator = get_average_for_12_months_ending_august(CHAINED, year - 1) + denominator = get_average_for_12_months_ending_august(CHAINED, base_year) + return max(numerator / denominator - 1, 0) + + +def _down(increase, interval): + return math.floor(round(increase / interval, 9)) * interval + + +def _nearest(increase, interval): + return round(round(increase / interval, 9)) * interval + + +# (label, parameter, base, base year, first year, last year, interval, +# rounding, {year: (printed, formula)} departures) +BACK_TESTS = [ + # 63(c)(7)(A)-(B) as TCJA enacted them: $12,000 and $18,000 from 2017. + ( + "standard deduction single, TCJA", + SD.SINGLE, + 12_000, + 2017, + 2018, + 2024, + 50, + _down, + {2022: (12_950, 12_900)}, + ), + ( + "standard deduction head of household, TCJA", + SD.HEAD_OF_HOUSEHOLD, + 18_000, + 2017, + 2018, + 2024, + 50, + _down, + {2020: (18_650, 18_600), 2021: (18_800, 18_850)}, + ), + # As OBBBA amended them: $15,750 and $23,625 from 2024. + ( + "standard deduction single", + SD.SINGLE, + 15_750, + 2024, + 2025, + 2027, + 50, + _down, + {}, + ), + ( + "standard deduction head of household", + SD.HEAD_OF_HOUSEHOLD, + 23_625, + 2024, + 2025, + 2027, + 50, + _down, + # The printed 2026 increase, $525, is no multiple of $50. + {2026: (24_150, 24_125)}, + ), + # 24(i)(2): $2,200 from 2024; 24(h)(5) and (i)(1): $1,400 from 2017. + ( + "child tax credit", + CTC.amount.base.brackets[0].amount, + 2_200, + 2024, + 2025, + 2027, + 100, + _down, + {}, + ), + ( + "child tax credit refundable maximum", + CTC.refundable.individual_max, + 1_400, + 2017, + 2018, + 2027, + 100, + _down, + {}, + ), + # 63(c)(4)(B): $500 from 1987 and $250 from 1997. + ( + "dependent standard deduction floor", + PARAMETERS.gov.irs.deductions.standard.dependent.amount, + 500, + 1987, + 2018, + 2027, + 50, + _down, + {}, + ), + ( + "dependent standard deduction earned income addition", + PARAMETERS.gov.irs.deductions.standard.dependent.additional_earned_income, + 250, + 1997, + 2013, + 2027, + 50, + _down, + {}, + ), + # 62(d)(3): $250 from 2014, to the nearest $50. + ( + "educator expense cap", + PARAMETERS.gov.irs.ald.educator_expense.cap, + 250, + 2014, + 2016, + 2027, + 50, + _nearest, + {}, + ), +] + + +@pytest.mark.parametrize( + "label, parameter, base, base_year, first, last, interval, rule, departures", + BACK_TESTS, + ids=[case[0] for case in BACK_TESTS], +) +def test_printed_amounts_against_the_statutory_formula( + label, parameter, base, base_year, first, last, interval, rule, departures +): + found = {} + for year in range(first, last + 1): + if not _window_observed(year): + continue + printed = parameter(f"{year}-01-01") + formula = base + rule(base * _statutory_cola(year, base_year), interval) + if printed != pytest.approx(formula, abs=1e-6): + found[year] = (printed, formula) + assert found == departures + + +def test_earned_income_addition_before_tcja_follows_the_cpi_u(): + """63(c)(5)(B)'s $250 under 63(c)(4)(B)(ii), before TCJA: 1(f)(3) then + divided the CPI-U for the preceding calendar year by the CPI-U for 1997, + each averaged over the 12 months ending August 31 (1(f)(4)). The amounts + the IRS printed from 1998 ($250, $300 from 2006, $350 from 2013) match + $250 plus that increase rounded down to $50 in every year, and agree + with ``base.value`` at the 1998 base period.""" + addition = PARAMETERS.gov.irs.deductions.standard.dependent.additional_earned_income + cpi_u = PARAMETERS.gov.bls.cpi.cpi_u + base = get_average_for_12_months_ending_august(cpi_u, 1997) + for year in range(1998, 2018): + numerator = get_average_for_12_months_ending_august(cpi_u, year - 1) + cola = max(numerator / base - 1, 0) + assert addition(f"{year}-01-01") == 250 + _down(250 * cola, 50), year + assert addition("1997-01-01") is None + + +# The model's medical August-2016 splice, a projection convention, +# reproduces every 2027 limit in Rev. Proc. +# 2026-35 section 3.29; earlier printed limits depart by $5 to $30. +# Section 1(f)(3)(B)'s default uses all-items averages over the 12 months +# ending August 2016. +# This back-test compares IRS amounts with the chosen model projection. +LTC_BASES = (200, 375, 750, 2_000, 2_500) +# The $375 limits the IRS printed before 2027 end in 0, where the $375 plus +# an increase rounded to $10 ends in 5. +LTC_DEPARTURES = { + 200: {}, + 375: { + 2013: (680, 685), + 2014: (700, 695), + 2015: (710, 715), + 2016: (730, 735), + 2017: (770, 765), + 2018: (780, 775), + 2019: (790, 785), + 2020: (810, 815), + 2021: (850, 845), + 2022: (850, 845), + 2023: (890, 895), + 2024: (880, 875), + 2025: (900, 905), + 2026: (930, 935), + }, + 750: {2021: (1_690, 1_680), 2022: (1_690, 1_700), 2025: (1_800, 1_810)}, + 2_000: { + 2018: (4_160, 4_150), + 2019: (4_220, 4_210), + 2020: (4_350, 4_340), + 2021: (4_520, 4_490), + 2022: (4_510, 4_530), + 2024: (4_710, 4_680), + 2025: (4_810, 4_820), + }, + 2_500: { + 2018: (5_200, 5_190), + 2019: (5_270, 5_260), + 2021: (5_640, 5_610), + 2022: (5_640, 5_660), + 2024: (5_880, 5_850), + }, +} + + +@pytest.mark.parametrize("bracket, base", list(enumerate(LTC_BASES))) +def test_printed_long_term_care_limits_against_the_model_projection(bracket, base): + index = PARAMETERS.gov.irs.indexing.medical_care_c_cpi_u + amount = LTC.brackets[bracket].amount + found = {} + for year in range(2013, 2028): + printed = amount(f"{year}-01-01") + ratio = index(f"{year}-01-01") / index("1997-01-01") + formula = base + _nearest(base * (ratio - 1), 10) + if printed != pytest.approx(formula, abs=1e-6): + found[year] = (printed, formula) + assert found == LTC_DEPARTURES[base] + assert 2027 not in found + + +@pytest.mark.parametrize( + "base, index, interval, kind, expected", + [ + (100, 1.0099999999995, 1, "downwards", 100), + (100, 1.0100000000005, 1, "upwards", 102), + (100, 1.01, 1, "downwards", 101), + (100, 1.01, 1, "upwards", 101), + (100, math.nextafter(1.005, 0), 1, "nearest", 100), + (100, 1.005, 1, "nearest", 101), + (100, math.nextafter(1.005, math.inf), 1, "nearest", 101), + (100, 0.995, 1, "nearest", 100), + (100, 0.985, 1, "nearest", 99), + (375, 2.32, 10, "nearest", 875), + (1400, 1.4, 10, "downwards", 1960), + ], +) +def test_exact_projection_has_one_boundary_outcome( + base, index, interval, kind, expected +): + """Final core and independent oracle select the same single outcome.""" + rounding = {"interval": interval, "type": kind} + assert _projection(base, index, 1, rounding, False) == expected + assert project_from_base(base, index, 1, (interval, kind)) == expected + + +@pytest.mark.parametrize("floor", [False, True]) +@pytest.mark.parametrize("base", [-math.inf, math.inf]) +def test_projection_keeps_the_final_infinite_base_guard(base, floor): + for rounding in (None, {"interval": 1, "type": "downwards"}): + parsed = None if rounding is None else (1, "downwards") + assert _projection(base, 1e-300, 1e300, rounding, floor) == base + assert project_from_base(base, 1e-300, 1e300, parsed, floor) == base + + +@settings(max_examples=25, deadline=None) +@given( + base=st.integers(min_value=1, max_value=10000), + current=st.integers(min_value=1, max_value=20000), + initial=st.integers(min_value=1, max_value=10000), + interval=st.sampled_from([1, 10, 50, 100]), + kind=st.sampled_from(["downwards", "upwards", "nearest"]), + floor=st.booleans(), +) +def test_projection_oracle_agrees_and_adjacent_indices_are_monotone( + base, current, initial, interval, kind, floor +): + """Positive-base projections agree exactly and never fall as indices rise.""" + current /= 100 + initial /= 100 + indices = [math.nextafter(current, 0), current, math.nextafter(current, math.inf)] + rounding = {"interval": interval, "type": kind} + expected = [_projection(base, value, initial, rounding, floor) for value in indices] + actual = [ + project_from_base(base, value, initial, (interval, kind), floor) + for value in indices + ] + assert actual == expected + assert actual == sorted(actual) + if floor: + assert all(value >= base for value in actual) + for value in actual: + assert (_exact(value) - _exact(base)) % _exact(interval) == 0 + # Unrounded projections retain the final engine's floating-point order. + expected_unrounded = ( + base * max(current / initial, 1.0) if floor else base * (current / initial) + ) + assert _projection(base, current, initial, None, floor) == expected_unrounded + assert project_from_base(base, current, initial, None, floor) == expected_unrounded diff --git a/policyengine_us/tests/core/test_hsa_contribution_limits.py b/policyengine_us/tests/core/test_hsa_contribution_limits.py index d561c34c3cc..53aba22064f 100644 --- a/policyengine_us/tests/core/test_hsa_contribution_limits.py +++ b/policyengine_us/tests/core/test_hsa_contribution_limits.py @@ -32,7 +32,6 @@ from policyengine_core.parameters.operations.get_parameter import get_parameter from policyengine_us.parameters.uprating_extensions import ( - HSA_CONTRIBUTION_LIMIT_STATUTORY_BASES, get_average_for_12_months_ending_march, get_hsa_cola, ) @@ -40,7 +39,8 @@ LIMIT = "gov.irs.gross_income.health_savings_account_contributions.limit" END_YEAR = 2100 -BASES = dict(HSA_CONTRIBUTION_LIMIT_STATUTORY_BASES) +# 26 U.S.C. 223(b)(2) dollar amounts by coverage. +BASES = {"self_only": 2_250, "family": 4_500} # (self-only, family) limits from the IRS publication for each year: Notice # 2004-2 (2004), then the Rev. Proc. for each year cited in the parameter files diff --git a/policyengine_us/tests/core/test_long_term_care_premium_properties.py b/policyengine_us/tests/core/test_long_term_care_premium_properties.py index e93f308ed5f..a5359cd45d2 100644 --- a/policyengine_us/tests/core/test_long_term_care_premium_properties.py +++ b/policyengine_us/tests/core/test_long_term_care_premium_properties.py @@ -44,8 +44,10 @@ exactly that amount. 7. A supplied subtotal holds no computed long-term care premiums and no applied exclusion. -8. Years after the last published table: every amount is a multiple of $10, - amounts rise with age, and no amount falls from one year to the next. +8. Years after the last published table: every amount is its 1997 amount in + 213(d)(10)(A) plus a multiple of $10, as 213(d)(10)(B) rounds the + increase, amounts rise with age, and no amount falls from one year to the + next. """ import numpy as np @@ -77,6 +79,8 @@ 2027: (500, 945, 1_890, 5_030, 6_290), # Rev. Proc. 2026-35 } BAND_TOPS = (40, 50, 60, 70) +# 213(d)(10)(A): the 1997 limits the (B) increases build on. +STATUTORY_LIMITS = (200, 375, 750, 2_000, 2_500) LAST_PUBLISHED = max(PUBLISHED_LIMITS) EDGE_AGES = [0, 18, 39, 40, 41, 50, 51, 60, 61, 70, 71, 95] @@ -108,7 +112,7 @@ def test_limits_after_the_last_published_year(): ages = np.array([30, 45, 55, 65, 75], dtype=float) for year in range(LAST_PUBLISHED + 1, LAST_PUBLISHED + 10): amounts = _limit_parameter(year).calc(ages, right=True) - assert (amounts % 10 == 0).all(), (year, amounts) + assert ((amounts - STATUTORY_LIMITS) % 10 == 0).all(), (year, amounts) assert (np.diff(amounts) > 0).all(), (year, amounts) assert (amounts >= previous).all(), (year, amounts, previous) previous = amounts diff --git a/policyengine_us/tests/core/test_nyc_income_tax_elimination_credit_indexing.py b/policyengine_us/tests/core/test_nyc_income_tax_elimination_credit_indexing.py index aee3ded77fb..ed01564b84b 100644 --- a/policyengine_us/tests/core/test_nyc_income_tax_elimination_credit_indexing.py +++ b/policyengine_us/tests/core/test_nyc_income_tax_elimination_credit_indexing.py @@ -11,9 +11,10 @@ The model computes the adjustment in ``parameters/uprating_extensions.py`` -(``get_nyc_income_tax_elimination_credit_cola``) and projects the thresholds -from the statutory 2025 amounts -(``extend_nyc_income_tax_elimination_credit_thresholds``). These tests check: +(``get_nyc_income_tax_elimination_credit_cola``), fills the index it rests on +(``set_nyc_income_tax_elimination_credit_cpi``), and core's base-mode +uprating projects the thresholds from the statutory 2025 amounts. These tests +check: (a) the 2026 thresholds on the live parameters against a factor computed here by hand from the 24 monthly CPI-U values in ``cpi_u.yaml``; @@ -22,23 +23,29 @@ (c) that every projected year scales the statutory amounts by one plus that year's adjustment, with one factor shared by every bracket and filing status, rather than chaining from the prior year; -(d) the Oregon Kids' Credit adjustment, which now shares the same window +(d) that the thresholds, which count dependents, never move; +(e) the Oregon Kids' Credit adjustment, which now shares the same window helper, at its tax year 2026 value. """ from fractions import Fraction +from pathlib import Path from types import SimpleNamespace import pytest +import yaml from hypothesis import given, settings from hypothesis import strategies as st from policyengine_core.parameters import Parameter, ParameterNode +from policyengine_core.parameters.operations.uprate_parameters import ( + uprate_parameters, +) from policyengine_us.parameters.uprating_extensions import ( - extend_nyc_income_tax_elimination_credit_thresholds, get_nyc_income_tax_elimination_credit_cola, get_or_ctc_cola, + set_nyc_income_tax_elimination_credit_cpi, ) from policyengine_us.system import system @@ -364,26 +371,61 @@ def test_thresholds_hold_their_last_projected_value_after_2100(): assert bracket.amount("2150-01-01") == bracket.amount("2100-01-01") +@pytest.mark.parametrize("year", (2025,) + PROJECTED_YEARS + (2100, 2150)) +def test_bracket_thresholds_count_dependents_in_every_year(year): + """Only the income amounts index; the dependent counts never move. + + gov/local propagates metadata to its children, so a scale-level uprating + would reach these thresholds too; each amount carries its own instead. + """ + for status in STATUTORY_THRESHOLDS: + for bracket, (dependents, _) in _brackets(status): + assert bracket.threshold(f"{year}-01-01") == dependents, status + assert "uprating" not in bracket.threshold.metadata, status + + # Projection on a synthetic parameter tree, exercising behaviour the live # series cannot reach: deflation and a published value. +THRESHOLD_DIR = ( + Path(__file__).parents[2] + / "parameters/gov/local/ny/nyc/tax/income/credits/income_tax_elimination" + / "income_threshold" +) + + +def _shipped_amount_uprating(status): + """The uprating each bracket amount carries in ``status``'s YAML file.""" + brackets = yaml.safe_load((THRESHOLD_DIR / f"{status}.yaml").read_text())[ + "brackets" + ] + upratings = [bracket["amount"]["metadata"]["uprating"] for bracket in brackets] + assert all(uprating == upratings[0] for uprating in upratings), status + return upratings[0] + + def _synthetic_threshold_parameters(cpi_values, published=None): """A tree holding a synthetic CPI-U series and the statutory thresholds. ``published`` maps (status, dependents) to {year: value} entries encoded after 2025, as a Department of Taxation and Finance publication would be. + Each amount carries the uprating its shipped YAML file gives it. """ published = published or {} data = {} for status, statutory in STATUTORY_THRESHOLDS.items(): + uprating = _shipped_amount_uprating(status) brackets = [] for dependents, amount in statutory.items(): amounts = {"2025-01-01": amount} for year, value in published.get((status, dependents), {}).items(): amounts[f"{year}-01-01"] = value brackets.append( - {"threshold": {"2025-01-01": dependents}, "amount": amounts} + { + "threshold": {"2025-01-01": dependents}, + "amount": {"values": amounts, "metadata": {"uprating": uprating}}, + } ) data[status] = { "metadata": { @@ -393,16 +435,34 @@ def _synthetic_threshold_parameters(cpi_values, published=None): }, "brackets": brackets, } - thresholds = ParameterNode("income_threshold", data=data) - credits = SimpleNamespace( - income_tax_elimination=SimpleNamespace(income_threshold=thresholds) - ) - nyc = SimpleNamespace(tax=SimpleNamespace(income=SimpleNamespace(credits=credits))) - gov = SimpleNamespace( - bls=SimpleNamespace(cpi=SimpleNamespace(cpi_u=Parameter("cpi_u", cpi_values))), - local=SimpleNamespace(ny=SimpleNamespace(nyc=nyc)), + parameters = ParameterNode( + "", + data={ + "gov": { + "bls": {"cpi": {"cpi_u": {"values": cpi_values}}}, + "local": { + "ny": { + "nyc": { + "tax": { + "income": { + "credits": { + "income_tax_elimination": { + "cpi": {"values": {"2025-01-01": 1}}, + "income_threshold": data, + } + } + } + } + } + } + }, + } + }, ) - return SimpleNamespace(gov=gov), thresholds + set_nyc_income_tax_elimination_credit_cpi(parameters, end_year=2030) + uprate_parameters(parameters) + credit = parameters.gov.local.ny.nyc.tax.income.credits.income_tax_elimination + return parameters, credit.income_threshold def _rising_then_falling_series(): @@ -416,16 +476,13 @@ def _rising_then_falling_series(): return values -def test_extension_recomputes_each_year_from_the_statutory_amounts(): +def test_base_mode_recomputes_each_year_from_the_statutory_amounts(): # Adjustments: 2026 +10%, 2027 +20%, 2028 floored at 0 (index 270 below # 300), 2029 +5%, and 2030 +5% (the last projection point persists). # Thresholds may fall from one year to the next, since each adjustment # measures against 2024 rather than the prior year, but never below the # statutory amounts. - parameters, thresholds = _synthetic_threshold_parameters( - _rising_then_falling_series() - ) - extend_nyc_income_tax_elimination_credit_thresholds(parameters, end_year=2030) + _, thresholds = _synthetic_threshold_parameters(_rising_then_falling_series()) factors = {2025: 1, 2026: 1.1, 2027: 1.2, 2028: 1, 2029: 1.05, 2030: 1.05} for status, statutory in STATUTORY_THRESHOLDS.items(): scale = thresholds.children[status] @@ -437,15 +494,14 @@ def test_extension_recomputes_each_year_from_the_statutory_amounts(): assert bracket.amount("2040-01-01") == bracket.amount("2030-01-01") -def test_extension_keeps_published_values_and_projects_after_them(): +def test_base_mode_keeps_published_values_and_projects_after_them(): # A published 2026 value for one bracket takes precedence for 2026; 2027 # still applies its adjustment to the statutory amount, not to the # published value. Other brackets are projected from 2026 as usual. published = {("joint", 1): {2026: 40_000}} - parameters, thresholds = _synthetic_threshold_parameters( + _, thresholds = _synthetic_threshold_parameters( _rising_then_falling_series(), published ) - extend_nyc_income_tax_elimination_credit_thresholds(parameters, end_year=2030) joint = thresholds.children["joint"].brackets assert joint[0].amount("2026-01-01") == 40_000 assert joint[0].amount("2027-01-01") == pytest.approx(36_789 * 1.2, rel=1e-12) diff --git a/policyengine_us/tests/core/test_state_uprating_rounding.py b/policyengine_us/tests/core/test_state_uprating_rounding.py index b2060f4ad75..36c0fc63d24 100644 --- a/policyengine_us/tests/core/test_state_uprating_rounding.py +++ b/policyengine_us/tests/core/test_state_uprating_rounding.py @@ -1,6 +1,7 @@ """Regression coverage for state parameter uprating and rounding.""" -from math import isinf +from fractions import Fraction +from math import floor, isinf import pytest @@ -279,26 +280,30 @@ def test_az_standard_deduction_is_indexed_like_the_federal_basic_amount(status): # equal the federal ones in every later year. A parent-level uprating key # used to leave Arizona at its 2025 amounts from 2026 on. 2027 is the # federal amount in Rev. Proc. 2026-35 sec. 3.15(1). After 2027 this checks - # the model's projection, which uprates the rounded 2027 amount. + # the model's projection: 26 U.S.C. 63(c)(7)(B)(ii) adds to the 2025 amount + # its cost-of-living increase since calendar year 2024 (the index's 2025 + # value), rounded down to a multiple of $50. arizona = getattr( SYSTEM.parameters.gov.states.az.tax.income.deductions.standard.amount, status ) federal = getattr(SYSTEM.parameters.gov.irs.deductions.standard.amount, status) uprating = SYSTEM.parameters.gov.irs.uprating - base_2027 = arizona("2027-01-01") - previous = arizona("2025-01-01") - for year in range(2025, 2036): + base = arizona("2025-01-01") + previous = base + for year in range(2025, 2101): period = f"{year}-01-01" amount = arizona(period) assert amount == federal(period), (status, year) assert amount >= previous, (status, year) previous = amount if year > 2027: - # 26 U.S.C. 63(c)(7)(B)(ii): round increases down to a multiple - # of $50. - factor = uprating(period) / uprating("2027-01-01") - assert amount == base_2027 * factor // 50 * 50, (status, year) - assert arizona("2035-01-01") > base_2027 + increase = Fraction(base) * ( + Fraction(repr(uprating(period))) + / Fraction(repr(uprating("2025-01-01"))) + - 1 + ) + assert amount == base + floor(increase / 50) * 50, (status, year) + assert arizona("2035-01-01") > arizona("2027-01-01") def test_az_joint_standard_deduction_is_twice_the_single_amount(): @@ -306,6 +311,10 @@ def test_az_joint_standard_deduction_is_twice_the_single_amount(): # return is 200% of the single amount, so the Arizona joint amount, # indexed in the same manner, is twice the Arizona single amount. amount = SYSTEM.parameters.gov.states.az.tax.income.deductions.standard.amount - for year in range(2025, 2036): + assert amount.JOINT.metadata["uprating"] == { + "parameter": "gov.states.az.tax.income.deductions.standard.amount.SINGLE", + "rounding": {"type": "nearest", "interval": 100}, + } + for year in range(2025, 2101): period = f"{year}-01-01" assert amount.JOINT(period) == 2 * amount.SINGLE(period), year diff --git a/policyengine_us/tests/core/test_trustees_2026_economic_assumptions.py b/policyengine_us/tests/core/test_trustees_2026_economic_assumptions.py index 138df9217a6..3878a2a6a10 100644 --- a/policyengine_us/tests/core/test_trustees_2026_economic_assumptions.py +++ b/policyengine_us/tests/core/test_trustees_2026_economic_assumptions.py @@ -45,10 +45,12 @@ TRUSTEES_2025_SOI_INCOME_UPRATING_PARAMETERS, ) from policyengine_us.reforms.ssa.trustees_2026 import ( + _rederive_reader, apply_trustees_2026_path_readers, trustees_2026_path_readers, ) from policyengine_us.reforms.ssa.trustees_core_thresholds import ( + TRUSTEES_CORE_THRESHOLD_ASSUMPTION, _iter_updatable_parameters, ) from policyengine_us.system import system @@ -879,6 +881,11 @@ def _tree_with_reader(values, **uprating): }, "cadence", ), + ( + {"2026-01-01": 100}, + {"base": {"period": 2026, "value": 100, "floor": True}}, + "statutory base", + ), ], ) def test_a_reader_outside_the_rule_stops_the_assumption(values, uprating, message): @@ -887,6 +894,28 @@ def test_a_reader_outside_the_rule_stops_the_assumption(values, uprating, messag apply_trustees_2026_path_readers(tree) +@pytest.mark.parametrize("path", [NAWI, UPRATING]) +def test_rederive_reader_refuses_a_base_mode_reader(path): + """Base mode projects from a statutory base, not from the last stated + value, so re-deriving it as core's chained uprating would be wrong.""" + tree = _tree_with_reader( + {"2026-01-01": 100}, base={"period": 2026, "value": 100, "floor": True} + ) + reader = tree.gov.ssa.reader + reader.metadata["uprating"]["parameter"] = path + before = [(value.instant_str, value.value) for value in reader.values_list] + with pytest.raises(ValueError, match="from a statutory base year"): + _rederive_reader( + reader, + get_parameter(tree, path), + last_unchanged_year=2027, + end_year=2100, + ) + assert [(value.instant_str, value.value) for value in reader.values_list] == ( + before + ) + + YEARS = st.integers(1990, 2150) @@ -999,13 +1028,41 @@ def _core_thresholds_under(reforms): thresholds = { parameter.name: {year: parameter(f"{year}-01-01") for year in range(2027, 2101)} for parameter in _iter_updatable_parameters( - parameters.gov.irs, uprating_parameter="gov.irs.uprating" + parameters.gov.irs, + uprating_parameter=TRUSTEES_CORE_THRESHOLD_ASSUMPTION[ + "uprating_parameters" + ], ) } - return nawi, thresholds - - -def _round_like_core_thresholds(amount, rounding): + # The joint and surviving spouse amounts follow the single amount. + standard = parameters.gov.irs.deductions.standard.amount + followers = { + status: { + year: getattr(standard, status)(f"{year}-01-01") + for year in range(2027, 2101) + } + for status in ("JOINT", "SURVIVING_SPOUSE") + } + return nawi, thresholds, followers + + +def _statutory_base(parameter): + """A base-mode parameter's base amount, else None.""" + uprating = parameter.metadata.get("uprating") + if not isinstance(uprating, dict) or "base" not in uprating: + return None + base = uprating["base"] + if base.get("value") is not None: + return base["value"] + return parameter(f"{base['period']}-01-01") + + +def _round_like_core_thresholds(amount, rounding, base=None): + """The core-thresholds reform's rounding, half up for nearest. With a + statutory base, it rounds the increase over the base, as the statute + does; otherwise the amount.""" + if base is not None: + return base + _round_like_core_thresholds(amount - base, rounding) if not rounding: return amount if rounding["type"] == "downwards": @@ -1037,20 +1094,21 @@ def test_core_thresholds_follow_the_trustees_2026_nawi(order): """ for cached in (_reformed_system, _applied_once, _end_to_end, _cap_policy_run): cached.cache_clear() - nawi, thresholds = _core_thresholds_under(COMPOSITIONS[order]) + nawi, thresholds, followers = _core_thresholds_under(COMPOSITIONS[order]) for year in range(2026, 2101): assert nawi[year] == pytest.approx(_tr_nawi(year), rel=1e-12) assert len(thresholds) > 100 for path, values in thresholds.items(): default = get_parameter(system.parameters, path) rounding = _rounding(default.metadata["uprating"]) + statutory_base = _statutory_base(default) base = default("2034-01-01") for year, value in values.items(): if year <= 2034: expected = default(f"{year}-01-01") else: expected = _round_like_core_thresholds( - base * (nawi[year - 1] / nawi[2033]), rounding + base * (nawi[year - 1] / nawi[2033]), rounding, statutory_base ) assert value == pytest.approx(expected, rel=1e-12), (path, year) for path in ( @@ -1065,5 +1123,12 @@ def test_core_thresholds_follow_the_trustees_2026_nawi(order): * _value(system.parameters, NAWI, year - 1) / _value(system.parameters, NAWI, 2033), rounding, + _statutory_base(default), ) assert thresholds[path][year] != on_default_nawi + # 26 U.S.C. 63(c)(2)(A): the joint and surviving spouse amounts, which + # follow the single amount, stay at twice it on the Trustees' NAWI. + single = thresholds["gov.irs.deductions.standard.amount.SINGLE"] + for status, values in followers.items(): + for year, value in values.items(): + assert value == 2 * single[year], (status, year) diff --git a/policyengine_us/tests/policy/baseline/parameters/test_uprating_extensions.py b/policyengine_us/tests/policy/baseline/parameters/test_uprating_extensions.py index aab6438e4ca..6e3774b1158 100644 --- a/policyengine_us/tests/policy/baseline/parameters/test_uprating_extensions.py +++ b/policyengine_us/tests/policy/baseline/parameters/test_uprating_extensions.py @@ -8,25 +8,35 @@ import yaml from policyengine_core.parameters import Parameter, ParameterNode +from policyengine_core.parameters.operations.uprate_parameters import ( + uprate_parameters, +) from policyengine_core.variables.variable import QuantityType from policyengine_us.system import system from policyengine_us.tools.default_uprating import NO_DEFAULT_UPRATING_VARIABLES from policyengine_us.tools.per_capita_uprating import per_capita_path from policyengine_us.parameters.uprating_extensions import ( - DEPENDENT_STANDARD_DEDUCTION_STATUTORY_BASES, - EDUCATOR_EXPENSE_CAP_STATUTORY_BASE, LONG_RUN_CBO_INCOME_BY_SOURCE_PARAMETERS, - extend_dependent_standard_deduction_parameters, - extend_educator_expense_cap, get_irs_cola, get_irs_cola_denominator, round_social_security_amount, round_social_security_payroll_cap, + set_irs_c_cpi_u_index, ) PARAMETERS = system.parameters +PARAMETER_DIR = Path(__file__).parents[4] / "parameters" + +# 26 U.S.C. 63(c)(5) limits on a dependent's basic standard deduction: +# parameter name, statutory dollar amount, and 63(c)(4)(B) base year. +DEPENDENT_STANDARD_DEDUCTION_STATUTORY_BASES = ( + ("amount", 500, 1987), # 63(c)(5)(A) + ("additional_earned_income", 250, 1997), # 63(c)(5)(B) +) +# 26 U.S.C. 62(d)(3): the 62(a)(2)(D) $250 and its 1(f)(3) base year. +EDUCATOR_EXPENSE_CAP_STATUTORY_BASE = (250, 2014) def test_all_uprating_factors_extend_to_2100(): @@ -1040,7 +1050,10 @@ def test_dependent_standard_deduction_encoded_values_take_precedence(): statute_differs = [] for name, base, base_year in DEPENDENT_STANDARD_DEDUCTION_STATUTORY_BASES: parameter = getattr(dependent, name) - # The 0001 placeholder in additional_earned_income.yaml is not a year. + # From TCJA's 2018, when 1(f)(3) moved to the C-CPI-U that + # statutory_dependent_standard_deduction_amount reads. The earlier + # earned income additions follow the CPI-U; test_base_mode_uprating.py + # checks them. encoded = { year: value for year, value in encoded_dependent_standard_deduction_values(name).items() @@ -1058,53 +1071,82 @@ def test_dependent_standard_deduction_encoded_values_take_precedence(): assert statute_differs -def test_dependent_standard_deduction_extension_starts_after_last_encoded_year(): - """A non-statutory last encoded value is kept; later years are computed.""" +def _months(start_year, level): + """A monthly index at ``level`` from September through the next August.""" + return { + **{f"{start_year}-{month:02d}-01": level for month in range(9, 13)}, + **{f"{start_year + 1}-{month:02d}-01": level for month in range(1, 9)}, + } - def months(start_year, level): - return { - **{f"{start_year}-{month:02d}-01": level for month in range(9, 13)}, - **{f"{start_year + 1}-{month:02d}-01": level for month in range(1, 9)}, - } - cpi = SimpleNamespace( - cpi_u=Parameter( - "cpi_u", data={**months(1986, 40), **months(1996, 100), **months(2015, 200)} - ), - # Monthly observations end in August 2030; 2032 holds a projection. - c_cpi_u=Parameter( - "c_cpi_u", - data={**months(2015, 150), **months(2029, 190), "2032-02-01": 205}, - ), - ) - # A node, so Parameter.update can reach a parent. - dependent = ParameterNode( - "dependent", +def _shipped_metadata(relative_path): + """The metadata block of a parameter YAML file in this package.""" + return yaml.safe_load((PARAMETER_DIR / relative_path).read_text())["metadata"] + + +def _synthetic_irs_c_cpi_u_tree(*, cpi_u, c_cpi_u, first_index_year, irs): + """A tree with synthetic CPI series, the 1(f)(3) index and ``irs``.""" + return ParameterNode( + "", data={ - "amount": {"values": {"2018-01-01": 1_050, "2030-01-01": 1_234}}, - "additional_earned_income": { - "values": {"2018-01-01": 350, "2030-01-01": 999} - }, + "gov": { + "bls": { + "cpi": { + "cpi_u": {"values": cpi_u}, + "c_cpi_u": {"values": c_cpi_u}, + } + }, + "irs": { + "indexing": { + "c_cpi_u": {"values": {f"{first_index_year}-01-01": 1}} + }, + **irs, + }, + } }, ) - parameters = SimpleNamespace( - gov=SimpleNamespace( - bls=SimpleNamespace(cpi=cpi), - irs=SimpleNamespace( - deductions=SimpleNamespace( - standard=SimpleNamespace(dependent=dependent) - ) - ), - ) + + +def test_dependent_standard_deduction_base_mode_starts_after_last_encoded_year(): + """A non-statutory last encoded value is kept; later years come from the + statutory base through the shipped base-mode metadata.""" + dependent_path = "gov/irs/deductions/standard/dependent" + parameters = _synthetic_irs_c_cpi_u_tree( + cpi_u={**_months(1986, 40), **_months(1996, 100), **_months(2015, 200)}, + # Monthly observations end in August 2030; 2032 holds a projection. + c_cpi_u={**_months(2015, 150), **_months(2029, 190), "2032-02-01": 205}, + first_index_year=1988, + irs={ + "deductions": { + "standard": { + "dependent": { + "amount": { + "values": {"2018-01-01": 1_050, "2030-01-01": 1_234}, + "metadata": _shipped_metadata( + f"{dependent_path}/amount.yaml" + ), + }, + "additional_earned_income": { + "values": {"2018-01-01": 350, "2030-01-01": 999}, + "metadata": _shipped_metadata( + f"{dependent_path}/additional_earned_income.yaml" + ), + }, + } + } + } + }, ) - extend_dependent_standard_deduction_parameters(parameters, 2033) + set_irs_c_cpi_u_index(parameters, 2033) + uprate_parameters(parameters) + dependent = parameters.gov.irs.deductions.standard.dependent # Encoded years keep their values, statutory or not. assert dependent.amount("2029-01-01") == 1_050 assert dependent.amount("2030-01-01") == 1_234 assert dependent.additional_earned_income("2029-01-01") == 350 assert dependent.additional_earned_income("2030-01-01") == 999 - # Denominators: 1987 base 40 x 150 / 200 = 30; 1997 base 100 x 150 / 200 = 75. + # Index bases: 1987 is 40 x 150 / 200 = 30; 1997 is 100 x 150 / 200 = 75. # 2031 reads the observed Sep 2029-Aug 2030 window (190); 2032 has no # observed month and no projection point of its own, so it reads 190 too. # Floor: $500 x (190 / 30 - 1) = $2,666.67, rounded down to $2,650. @@ -1207,41 +1249,35 @@ def test_educator_expense_cap_projections_follow_statute(): assert cap(f"{year}-01-01") == 400, year -def test_educator_expense_cap_extension_rounds_the_base_increase_to_nearest_50(): - """Encoded years are kept; later years round the $250 base's increase.""" - - def months(start_year, level): - return { - **{f"{start_year}-{month:02d}-01": level for month in range(9, 13)}, - **{f"{start_year + 1}-{month:02d}-01": level for month in range(1, 9)}, - } - - cpi = SimpleNamespace( - cpi_u=Parameter("cpi_u", data={**months(2013, 100), **months(2015, 200)}), +def test_educator_expense_cap_base_mode_rounds_the_base_increase_to_nearest_50(): + """Encoded years are kept; later years round the $250 base's increase + through the shipped base-mode metadata.""" + parameters = _synthetic_irs_c_cpi_u_tree( + cpi_u={**_months(2013, 100), **_months(2015, 200)}, # Monthly observations end in August 2030; 2032 holds a projection. - c_cpi_u=Parameter( - "c_cpi_u", - data={**months(2015, 150), **months(2029, 102), "2032-02-01": 126}, - ), - ) - # A node, so Parameter.update can reach a parent. - educator_expense = ParameterNode( - "educator_expense", - data={"cap": {"values": {"2002-01-01": 250, "2030-01-01": 999}}}, - ) - parameters = SimpleNamespace( - gov=SimpleNamespace( - bls=SimpleNamespace(cpi=cpi), - irs=SimpleNamespace(ald=SimpleNamespace(educator_expense=educator_expense)), - ) + c_cpi_u={**_months(2015, 150), **_months(2029, 102), "2032-02-01": 126}, + first_index_year=2015, + irs={ + "ald": { + "educator_expense": { + "cap": { + "values": {"2002-01-01": 250, "2030-01-01": 999}, + "metadata": _shipped_metadata( + "gov/irs/ald/educator_expense/cap.yaml" + ), + } + } + } + }, ) - extend_educator_expense_cap(parameters, 2033) + set_irs_c_cpi_u_index(parameters, 2033) + uprate_parameters(parameters) - cap = educator_expense.cap + cap = parameters.gov.irs.ald.educator_expense.cap # Encoded years keep their values, statutory or not. assert cap("2029-01-01") == 250 assert cap("2030-01-01") == 999 - # Denominator: 2014 base 100 x 150 / 200 = 75. 2031 reads the observed + # Index base: 2014 is 100 x 150 / 200 = 75. 2031 reads the observed # Sep 2029-Aug 2030 window (102); 2032 has no observed month and no # projection point of its own, so it reads 102 too. # $250 x (102 / 75 - 1) = $90, nearest to $100 (rounding down gives $50). diff --git a/policyengine_us/tests/policy/contrib/ssa/test_trustees_core_thresholds.py b/policyengine_us/tests/policy/contrib/ssa/test_trustees_core_thresholds.py index dd0f0d5942a..c1adfba7321 100644 --- a/policyengine_us/tests/policy/contrib/ssa/test_trustees_core_thresholds.py +++ b/policyengine_us/tests/policy/contrib/ssa/test_trustees_core_thresholds.py @@ -1,12 +1,32 @@ import math from functools import lru_cache +from policyengine_core.parameters import Parameter + from policyengine_us import CountryTaxBenefitSystem +from policyengine_us.reforms.ssa import trustees_core_threshold_parameters from policyengine_us.reforms.ssa.trustees_core_thresholds import ( TRUSTEES_CORE_THRESHOLD_ASSUMPTION, create_trustees_core_thresholds_reform, ) +STANDARD = "gov.irs.deductions.standard.amount" +STANDARD_DEDUCTIONS = tuple( + f"{STANDARD}.{status}" + for status in ( + "SINGLE", + "JOINT", + "SEPARATE", + "HEAD_OF_HOUSEHOLD", + "SURVIVING_SPOUSE", + ) +) +# IRS indices the reform leaves on prices. 213(d)(10)(B) indexes the +# long-term care premium limits by medical care prices; before this index +# existed they uprated by gov.bls.cpi.cpi_u_medical_care, outside the +# reform's selection, and they stay off the wage path. +EXCLUDED_IRS_INDICES = {"gov.irs.indexing.medical_care_c_cpi_u"} + @lru_cache def _parameters(reform=None): @@ -31,8 +51,10 @@ def test_metadata_marks_trustees_core_thresholds_as_explicit_assumption(): "all_gov_irs_uprating_parameters" in TRUSTEES_CORE_THRESHOLD_ASSUMPTION["parameter_groups"] ) - assert ( - TRUSTEES_CORE_THRESHOLD_ASSUMPTION["uprating_parameter"] == "gov.irs.uprating" + assert TRUSTEES_CORE_THRESHOLD_ASSUMPTION["uprating_parameters"] == ( + "gov.irs.uprating", + "gov.irs.indexing.c_cpi_u", + "gov.irs.indexing.hsa_c_cpi_u", ) assert "OACT email clarification" in TRUSTEES_CORE_THRESHOLD_ASSUMPTION["source"] @@ -57,6 +79,9 @@ def test_reform_leaves_long_run_economic_assumptions_unchanged(): def test_reform_only_changes_federal_irs_uprating_parameters(): + """The reform moves IRS parameters on the CPI indices it names, and + parameters that uprate by one of those, such as the joint standard + deduction, which follows the single amount.""" baseline = _parameters() reformed = _trustees_parameters() reformed_parameters_by_name = { @@ -64,7 +89,7 @@ def test_reform_only_changes_federal_irs_uprating_parameters(): for parameter in [reformed, *reformed.get_descendants()] if parameter.__class__.__name__ == "Parameter" } - changed_names = [] + uprating_by_name = {} for parameter in [baseline, *baseline.get_descendants()]: if parameter.__class__.__name__ != "Parameter": @@ -76,14 +101,32 @@ def test_reform_only_changes_federal_irs_uprating_parameters(): continue uprating = parameter.metadata.get("uprating") - uprating_parameter = ( + assert parameter.name.startswith("gov.irs.") + uprating_by_name[parameter.name] = ( uprating.get("parameter") if isinstance(uprating, dict) else uprating ) - assert parameter.name.startswith("gov.irs.") - assert uprating_parameter == "gov.irs.uprating" - changed_names.append(parameter.name) - assert changed_names + indices = TRUSTEES_CORE_THRESHOLD_ASSUMPTION["uprating_parameters"] + for name, uprating_parameter in uprating_by_name.items(): + assert ( + uprating_parameter in indices or uprating_parameter in uprating_by_name + ), name + assert set(uprating_by_name.values()) >= set(indices) + standard = "gov.irs.deductions.standard.amount" + for status in ("JOINT", "SURVIVING_SPOUSE"): + assert uprating_by_name[f"{standard}.{status}"] == f"{standard}.SINGLE" + + +def test_joint_standard_deduction_stays_twice_the_single_amount(): + """26 U.S.C. 63(c)(2)(A): 200% of the single amount, on the wage path too.""" + standard = _trustees_parameters().gov.irs.deductions.standard.amount + baseline = _parameters().gov.irs.deductions.standard.amount + for year in range(2026, 2101): + period = f"{year}-01-01" + assert standard.JOINT(period) == 2 * standard.SINGLE(period), year + assert standard.SURVIVING_SPOUSE(period) == standard.JOINT(period), year + assert standard.SEPARATE(period) == standard.SINGLE(period), year + assert standard.SINGLE("2100-01-01") != baseline.SINGLE("2100-01-01") def test_reported_social_security_components_use_aggregate_ss_uprater(): @@ -233,3 +276,66 @@ def test_reform_does_not_change_state_parameters_using_irs_uprating(): for year in [2034, 2035, 2040, 2100]: instant = f"{year}-01-01" assert reformed_state_ctc(instant) == baseline_state_ctc(instant) + + +def test_head_of_household_stays_its_base_plus_whole_50_dollar_steps(): + """26 U.S.C. 63(c)(7)(B)(ii) rounds the increase over $23,625 down to a + multiple of $50, so on the wage path too the head of household amount + is $23,625 plus whole $50 steps. The single amount's base, $15,750, is a + multiple of $50, so rounding its increase gives the values that + rounding its total gave before.""" + reformed = _trustees_parameters() + standard = reformed.gov.irs.deductions.standard.amount + nawi = reformed.gov.ssa.nawi + base_nawi = float(nawi("2033-01-01")) + head_2034 = float(standard.HEAD_OF_HOUSEHOLD("2034-01-01")) + single_2034 = float(standard.SINGLE("2034-01-01")) + for year in range(2035, 2101): + ratio = float(nawi(f"{year - 1}-01-01")) / base_nawi + head = standard.HEAD_OF_HOUSEHOLD(f"{year}-01-01") + assert (head - 23_625) % 50 == 0, year + assert head == 23_625 + math.floor((head_2034 * ratio - 23_625) / 50) * 50 + # The arithmetic before increases were rounded: the total, down to $50. + single = standard.SINGLE(f"{year}-01-01") + assert single == math.floor(single_2034 * ratio / 50) * 50, year + + +def test_core_threshold_parameters_list_what_the_reform_changes(): + """The public list crfb-tob-impacts and others can read: every parameter + the reform re-projects, leaders before followers, once each.""" + baseline = _parameters() + reformed = _trustees_parameters() + listed = trustees_core_threshold_parameters(baseline) + names = [parameter.name for parameter in listed] + assert len(names) == len(set(names)) + assert names == [p.name for p in trustees_core_threshold_parameters(baseline)] + assert set(STANDARD_DEDUCTIONS) <= set(names) + for follower in ("JOINT", "SURVIVING_SPOUSE"): + assert names.index(f"{STANDARD}.SINGLE") < names.index(f"{STANDARD}.{follower}") + + reformed_by_name = { + parameter.name: parameter + for parameter in reformed.get_descendants() + if isinstance(parameter, Parameter) + } + changed = set() + for parameter in baseline.get_descendants(): + if not isinstance(parameter, Parameter): + continue + reformed_parameter = reformed_by_name[parameter.name] + for year in (2035, 2036, 2040, 2050, 2075, 2100): + if parameter(f"{year}-01-01") != reformed_parameter(f"{year}-01-01"): + changed.add(parameter.name) + break + assert changed <= set(names), changed - set(names) + assert set(STANDARD_DEDUCTIONS) <= changed + + +def test_every_irs_index_is_wage_indexed_or_excluded(): + """A parameter moved to a new IRS index leaves the Trustees set unless + the index joins the assumption's tuple or this exclusion list.""" + indexing = _parameters().gov.irs.indexing + indices = {child.name for child in indexing.children.values()} + selected = set(TRUSTEES_CORE_THRESHOLD_ASSUMPTION["uprating_parameters"]) + assert not selected & EXCLUDED_IRS_INDICES + assert indices == (selected - {"gov.irs.uprating"}) | EXCLUDED_IRS_INDICES diff --git a/pyproject.toml b/pyproject.toml index af0a2ebf43b..0022bc088b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ dependencies = [ # pandas 3 copy-on-write enables the shallow-copy fast path in dataset # extension and is available on every supported Python version. "pandas>=3.0", - "policyengine-core>=3.33.1", + "policyengine-core>=3.36.0", "spm-calculator>=1.1.0,<1.2", "tables>=3.9", "tqdm>=4.67.1", diff --git a/source_conflicts/candidates.yaml b/source_conflicts/candidates.yaml index f93ec386157..310b82401aa 100644 --- a/source_conflicts/candidates.yaml +++ b/source_conflicts/candidates.yaml @@ -14224,7 +14224,7 @@ candidates: state: unreviewed note: 'PE-US follows IRS practice: projections after the published limits use 12-month windows ending March 31, except the 2016 C-CPI-U-to-CPI ratio, which keeps the window ending August 31, and the docstring says these - windows reproduce every published 2019-2027 limit (get_hsa_cola and extend_hsa_contribution_limits in uprating_extensions.py, + windows reproduce every published 2019-2027 limit (get_hsa_cola and set_hsa_c_cpi_u_index in uprating_extensions.py, limit/self_only.yaml, limit/family.yaml). The statute-first rule requires changing conflicting projections; verify the statutory window substitution first, and preserve the distinction from published limits fixed through 2027.' @@ -14322,6 +14322,51 @@ candidates: Massachusetts, Maryland, Michigan, Nebraska, Vermont and Wisconsin in medically needy. The stricter result arises only in a narrow band, for example a spouse''s income between $473 and $497 a month against poverty-level standards. Ruled by the project lead, 2026-11-10: https://github.com/PolicyEngine/policyengine-us/pull/10640#issuecomment-6812820779' +- id: us:long-term-care-premium-index-adjustment + program: income-tax + years: + from: 2018 + type: tax + question: Which adjustment prescribed under section 213(d)(10)(B)(ii), if any, explains the published long-term care + premium limits, and does it support the model's August-2016 medical-component conversion beyond the stated IRS tables? + sources: + - kind: statute + citation: 26 U.S.C. 213(d)(10)(A)-(B) + url: https://uscode.house.gov/us/usc/119-120/t26/s213/ + - kind: statute + citation: 26 U.S.C. 1(f)(3)(B), (4), (6) + url: https://uscode.house.gov/us/usc/119-120/t26/s1/ + - kind: guidance + citation: Rev. Proc. 2017-58, section 3.26 + url: https://www.irs.gov/pub/irs-drop/rp-17-58.pdf#page=17 + - kind: guidance + citation: Rev. Proc. 2026-35, section 3.29 + url: https://www.irs.gov/pub/irs-drop/rp-26-35.pdf#page=17 + readings: + statute: Section 213(d)(10)(B) compares the preceding August's medical C-CPI-U with the August-1996 medical CPI + multiplied by section 1(f)(3)(B)'s all-items 2016 conversion, and rounds the increase to the nearest $10. + The Secretary, in consultation with the Secretary of Health and Human Services, must prescribe a replacement + adjustment if the Secretary determines it more appropriate; that adjustment replaces the default. + other: The IRS gives annual limits in the revenue procedures. Those tables establish the stated amounts but do + not identify the model's medical-component August-2016 conversion or its future growth method as a prescribed adjustment. + unresolved: The model's conversion reproduces the five 2027 limits, while the back-test records differences in + earlier years. That agreement does not establish which exact adjustment the Secretary prescribed, if any, + or which conversion, window and publication vintage should govern projections beyond the stated tables. + pe_us: + follows: unknown + code: + - policyengine_us/parameters/gov/irs/indexing/medical_care_c_cpi_u.yaml + - policyengine_us/parameters/uprating_extensions.py + - policyengine_us/parameters/gov/irs/deductions/itemized/medical/long_term_care_premium_limit.yaml + - policyengine_us/tests/core/test_base_mode_uprating.py + prs: + - https://github.com/PolicyEngine/policyengine-us/pull/10783 + state: open + note: The model retains the stated annual IRS limits. It normalizes the index with the medical components' + August-2016 ratio and projects future growth with CBO's calendar-year unchained medical CPI, two distinct + modeling assumptions. The back-test also covers years before 2018; those differences may need separate explanations. + The applicable agency prescription remains unresolved, with no confirmed incorrect IRS or model outcome. + This entry changes no parameter values and leaves the full-country, all-parameter, Trustees-parity and full-CI merge holds in force. - id: us:mortgage-interest-limit-ratio-rounding program: income-tax years: diff --git a/uv.lock b/uv.lock index 4e100608103..ae2a993b4e5 100644 --- a/uv.lock +++ b/uv.lock @@ -1786,7 +1786,7 @@ wheels = [ [[package]] name = "policyengine-core" -version = "3.34.2" +version = "3.36.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "dpath" }, @@ -1806,9 +1806,9 @@ dependencies = [ { name = "standard-imghdr" }, { name = "wheel" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/fe/cd/aa35767157e856da69d3abe40cc43465f055fbac914a7040df9fdf799a6d/policyengine_core-3.34.2.tar.gz", hash = "sha256:669eceecc8ce1036af977df1d4a495134ccdab916b4118f4700a69af6e7f46a4", size = 745403, upload-time = "2026-10-31T08:10:05.237Z" } +sdist = { url = "https://files.pythonhosted.org/packages/16/0a/c897947bcc65d2529fd21fe55e5f06a3e4983547ab03ac1e3f443baa2751/policyengine_core-3.36.0.tar.gz", hash = "sha256:5cb39a1d32991d70dcd4afed53f2ec8cc1777ea54f218353dfe7d62d7de4d52d", size = 811544, upload-time = "2026-11-13T12:13:06.026Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d6/89/c0d594c000c8e038808a4a984317d5bdeae15d0b36649d8ea1cb56be8e96/policyengine_core-3.34.2-py3-none-any.whl", hash = "sha256:47c258e26f86382eff87711d40ace9359bdc478fe679530de3609d5b351da48b", size = 307223, upload-time = "2026-10-31T08:10:03.329Z" }, + { url = "https://files.pythonhosted.org/packages/d6/07/f0d649c065a12ca9ef35543ced8bb5b1b51bc1b2373c90c6f5c5ad39b69b/policyengine_core-3.36.0-py3-none-any.whl", hash = "sha256:eb7943fe5f1c63a3b70d60e673924a0703d5608dee330a4bcadb6911e0243b98", size = 317669, upload-time = "2026-11-13T12:13:04.33Z" }, ] [[package]] @@ -1845,7 +1845,7 @@ requires-dist = [ { name = "jupyter-book", marker = "extra == 'dev'", specifier = ">=1.0.4.post1" }, { name = "microdf-python", specifier = ">=1.0.0" }, { name = "pandas", specifier = ">=3.0" }, - { name = "policyengine-core", specifier = ">=3.33.1" }, + { name = "policyengine-core", specifier = ">=3.36.0" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.9.0" }, { name = "setuptools", marker = "extra == 'dev'", specifier = ">=80.9.0" }, { name = "spm-calculator", specifier = ">=1.1.0,<1.2" },