From 60339a60c2745c6e9964939dc59e58f6671bd802 Mon Sep 17 00:00:00 2001 From: mitchellpound Date: Sat, 21 Oct 2023 09:23:48 -0600 Subject: [PATCH 1/6] Fixed circularity for CO in state_income_tax var --- .../tax/income/additions/co_state_addback.py | 20 +++++-------------- .../gov/states/tax/income/state_income_tax.py | 2 +- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py b/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py index d4ca2cd45..45156587a 100644 --- a/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py +++ b/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py @@ -15,18 +15,8 @@ class co_state_addback(Variable): def formula(tax_unit, period, parameters): federal_itemizer = tax_unit("tax_unit_itemizes", period) - state_inctax = max_(0, tax_unit("state_income_tax", period)) - property_taxes = add(tax_unit, period, ["real_estate_taxes"]) - # follow worksheet on page 5 of 2021 Book cited above: - irs_schA_line_5d = state_inctax + property_taxes - irs_schA_line_5e = tax_unit("salt_deduction", period) - ws_line_a = where( - irs_schA_line_5d > irs_schA_line_5e, - max_(0, irs_schA_line_5e - property_taxes), - state_inctax, - ) - p = parameters(period).gov.irs.deductions - ws_line_b = add(tax_unit, period, p.itemized_deductions) - ws_line_c = tax_unit("standard_deduction", period) - ws_line_d = max_(0, ws_line_b - ws_line_c) - return federal_itemizer * min_(ws_line_a, ws_line_d) + # Colorado only requires taxpayers to add back state income tax from + # Federal Schedule A (line 5a). It does not require taxpayers to + # add back state real estate or property tax from Schedule A + state_inctax = max_(0, tax_unit("statelocal_sales_or_prior_inctax", period)) + return federal_itemizer * state_inctax diff --git a/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py b/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py index 19560004e..eb6cdb0fc 100644 --- a/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py +++ b/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py @@ -10,7 +10,7 @@ class state_income_tax(Variable): adds = [ # state income tax variables listed in alphabetical order: "ca_income_tax", - # "co_income_tax", --- activating will cause circular logic errors + "co_income_tax", #--- activating will cause circular logic errors "dc_income_tax", "ia_income_tax", "il_income_tax", From 5ca626a158d8901e4024e554ee397b20994fdd70 Mon Sep 17 00:00:00 2001 From: mitchellpound Date: Sat, 21 Oct 2023 14:35:12 -0600 Subject: [PATCH 2/6] Fixed MO circularity in state_income_tax --- .../mo/tax/income/taxable_income/mo_net_state_income_taxes.py | 2 +- .../variables/gov/states/tax/income/state_income_tax.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py b/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py index 1bd42e2b5..2c613661f 100644 --- a/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py +++ b/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py @@ -20,7 +20,7 @@ def formula(tax_unit, period, parameters): p = parameters(period).gov.irs.deductions.itemized salt_cap = p.salt_and_real_estate.cap[filing_status] - uncapped_itax = max_(0, add(tax_unit, period, ["state_income_tax"])) + uncapped_itax = max_(0, add(tax_unit, period, ["statelocal_sales_or_prior_inctax"])) uncapped_ptax = add(tax_unit, period, ["real_estate_taxes"]) uncapped_salt = uncapped_itax + uncapped_ptax diff --git a/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py b/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py index eb6cdb0fc..da49d267f 100644 --- a/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py +++ b/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py @@ -10,7 +10,7 @@ class state_income_tax(Variable): adds = [ # state income tax variables listed in alphabetical order: "ca_income_tax", - "co_income_tax", #--- activating will cause circular logic errors + "co_income_tax", "dc_income_tax", "ia_income_tax", "il_income_tax", @@ -23,7 +23,7 @@ class state_income_tax(Variable): "me_income_tax", "mn_income_tax", "mt_income_tax", - # "mo_income_tax", --- activating will cause circular logic errors + "mo_income_tax", "nc_income_tax", "nd_income_tax", "ne_income_tax", From 2a355813326880632d6aa07d924bd43bf0e697b9 Mon Sep 17 00:00:00 2001 From: mitchellpound Date: Mon, 23 Oct 2023 20:31:11 -0600 Subject: [PATCH 3/6] Fixed tests --- .../mo_net_state_income_taxes.yaml | 8 +++--- .../tax/income/additions/co_state_addback.py | 26 ++++++++++++++----- .../mo_net_state_income_taxes.py | 4 ++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/fiscalsim_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.yaml b/fiscalsim_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.yaml index e8707e5d5..2d14e7f93 100644 --- a/fiscalsim_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.yaml +++ b/fiscalsim_us/tests/policy/baseline/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.yaml @@ -3,7 +3,7 @@ absolute_error_margin: 0 input: filing_status: SINGLE - state_income_tax: 0 + prior_year_state_income_tax_paid: 0 state_code: MO output: mo_net_state_income_taxes: 0.0 @@ -13,7 +13,7 @@ absolute_error_margin: 0.01 input: filing_status: SINGLE - state_income_tax: 23_000 + prior_year_state_income_tax_paid: 23_000 state_code: MO output: mo_net_state_income_taxes: 10_000 @@ -24,7 +24,7 @@ input: filing_status: SINGLE real_estate_taxes: 4_000 - state_income_tax: 3_000 + prior_year_state_income_tax_paid: 3_000 state_code: MO output: mo_net_state_income_taxes: 3_000 @@ -35,7 +35,7 @@ input: filing_status: JOINT real_estate_taxes: 4_000 - state_income_tax: 8_000 + prior_year_state_income_tax_paid: 8_000 state_code: MO output: mo_net_state_income_taxes: 6_666.67 # = 10_000 * 2/3 diff --git a/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py b/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py index 45156587a..efcb3b96b 100644 --- a/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py +++ b/fiscalsim_us/variables/gov/states/co/tax/income/additions/co_state_addback.py @@ -8,15 +8,27 @@ class co_state_addback(Variable): unit = USD definition_period = YEAR reference = ( - "https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2021.pdf#page=5" - "https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2022.pdf#page=5" + "https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2021.pdf#page=5", + "https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2022.pdf#page=5", + "https://tax.colorado.gov/sites/tax/files/documents/ITT_State_Income_Tax_Addback_Jan_2023.pdf", ) defined_for = StateCode.CO def formula(tax_unit, period, parameters): federal_itemizer = tax_unit("tax_unit_itemizes", period) - # Colorado only requires taxpayers to add back state income tax from - # Federal Schedule A (line 5a). It does not require taxpayers to - # add back state real estate or property tax from Schedule A - state_inctax = max_(0, tax_unit("statelocal_sales_or_prior_inctax", period)) - return federal_itemizer * state_inctax + + salt_deduct = tax_unit("salt_deduction", period) + local_taxes = add( + tax_unit, period, ["prior_year_local_income_tax_paid"] + ) + property_taxes = add(tax_unit, period, ["real_estate_taxes"]) + state_addback = max_(0, salt_deduct - local_taxes - property_taxes) + + # return the max between the "extra" itemized deductions above the std + # and the state taxes included in the SALT deduction + p = parameters(period).gov.irs.deductions + item_deducts = add(tax_unit, period, p.itemized_deductions) + std_deducts = tax_unit("standard_deduction", period) + alt_addback = max_(0, item_deducts - std_deducts) + + return federal_itemizer * min_(state_addback, alt_addback) diff --git a/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py b/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py index 2c613661f..63da281de 100644 --- a/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py +++ b/fiscalsim_us/variables/gov/states/mo/tax/income/taxable_income/mo_net_state_income_taxes.py @@ -20,7 +20,9 @@ def formula(tax_unit, period, parameters): p = parameters(period).gov.irs.deductions.itemized salt_cap = p.salt_and_real_estate.cap[filing_status] - uncapped_itax = max_(0, add(tax_unit, period, ["statelocal_sales_or_prior_inctax"])) + uncapped_itax = max_( + 0, add(tax_unit, period, ["prior_year_state_income_tax_paid"]) + ) uncapped_ptax = add(tax_unit, period, ["real_estate_taxes"]) uncapped_salt = uncapped_itax + uncapped_ptax From 2dd8ee9907e4d06cdc68e3fc48b2bdd8788034c8 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Tue, 24 Oct 2023 09:10:27 -0600 Subject: [PATCH 4/6] Updated version in setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b7c132e5d..a4594894d 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="fiscalsim-us", - version="0.2.3", + version="0.2.4", author="Center for Growth and Opportunity at Utah State University (CGO)", author_email="fiscalsim@thecgo.org", long_description=readme, From 964d773e818c946c3bde5264767866ea0011ee44 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Tue, 24 Oct 2023 09:12:08 -0600 Subject: [PATCH 5/6] Updated CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad434620..c58e5f853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.4] - 2023-10-24 10:00:00 + +### Added + +- Fixed circularity in CO tax logic +- Fixed circularity in MO tax logic + ## [0.2.3] - 2023-10-13 16:00:00 ### Added @@ -171,6 +178,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First prototype version based off of openfisca-us and tax-calculator. +[0.2.4]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.3...v0.2.4 [0.2.3]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.2...v0.2.3 [0.2.2]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.1...v0.2.2 [0.2.1]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.0...v0.2.1 From cc3e12d81fd34410fa757373c7120fa7c56ec4aa Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Tue, 24 Oct 2023 09:13:35 -0600 Subject: [PATCH 6/6] Updated changelog.yaml --- changelog.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.yaml b/changelog.yaml index 5fffd669b..78b4d1bf5 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -157,3 +157,9 @@ - adjusted `salt_deduction.py` to calculate based on the added variables - Adds three files `prior_year_state_income_tax_paid.py`, `prior_year_local_income_tax_paid.py`, and `sales_or_prior_year_state_and_local_income_tax.py` date: 2023-10-13 16:00:00 +- bump: patch + changes: + added: + - Fixed circularity in CO tax logic + - Fixed circularity in MO tax logic + date: 2023-10-24 10:00:00