diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b04880b46a..0f965a8a83d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,18 +5,6 @@ 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). -## [1.137.3] - 2024-11-01 16:53:33 - -### Fixed - -- Colorado 2023 sales tax refund. - -## [1.137.2] - 2024-11-01 10:27:40 - -### Fixed - -- Branch improvements. - ## [1.137.1] - 2024-10-31 18:57:07 ### Fixed @@ -10132,8 +10120,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -[1.137.3]: https://github.com/PolicyEngine/policyengine-us/compare/1.137.2...1.137.3 -[1.137.2]: https://github.com/PolicyEngine/policyengine-us/compare/1.137.1...1.137.2 [1.137.1]: https://github.com/PolicyEngine/policyengine-us/compare/1.137.0...1.137.1 [1.137.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.136.2...1.137.0 [1.136.2]: https://github.com/PolicyEngine/policyengine-us/compare/1.136.1...1.136.2 diff --git a/changelog.yaml b/changelog.yaml index c80a1d64bfc..3a4b8857901 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -8580,13 +8580,3 @@ fixed: - remove uprating for SNAP variables that don't change date: 2024-10-31 18:57:07 -- bump: patch - changes: - fixed: - - Branch improvements. - date: 2024-11-01 10:27:40 -- bump: patch - changes: - fixed: - - Colorado 2023 sales tax refund. - date: 2024-11-01 16:53:33 diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb2d..24b5d89551d 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + fixed: + - Change _lsr to _behavioral_response. diff --git a/policyengine_us/parameters/gov/states/co/tax/income/credits/sales_tax_refund/amount/amount.yaml b/policyengine_us/parameters/gov/states/co/tax/income/credits/sales_tax_refund/amount/amount.yaml index ed0ce57b613..69a408902c3 100644 --- a/policyengine_us/parameters/gov/states/co/tax/income/credits/sales_tax_refund/amount/amount.yaml +++ b/policyengine_us/parameters/gov/states/co/tax/income/credits/sales_tax_refund/amount/amount.yaml @@ -1,13 +1,13 @@ description: Colorado provides a flat sales tax refund credit of this amount. values: - 2023-01-01: 800 + 2023-01-01: 661 metadata: period: year unit: year label: Colorado sales tax refund credit flat amount reference: - - title: 2023 Colorado Individual Tax Filing Guide 104 Book, Line 34 - href: https://tax.colorado.gov/sites/tax/files/documents/Book0104_2023.pdf#page=9 + - title: 2023 Colorado Individual Income Tax Filing Guide + href: https://leg.colorado.gov/sites/default/files/documents/2023A/bills/fn/2023a_hb1311_00.pdf#page=3 - title: Colorado General Assembly HB23-1311 Identical Temporary TABOR Refund href: https://leg.colorado.gov/bills/hb23-1311#:~:text=The%20act%20creates%20a%20new,2022%2D23%20state%20fiscal%20year diff --git a/policyengine_us/system.py b/policyengine_us/system.py index e224cbe7e90..7124fef795f 100644 --- a/policyengine_us/system.py +++ b/policyengine_us/system.py @@ -106,14 +106,20 @@ def __init__(self, *args, **kwargs): employment_income = self.get_holder("employment_income") for known_period in employment_income.get_known_periods(): array = employment_income.get_array(known_period) - self.set_input("employment_income_before_lsr", known_period, array) + self.set_input( + "employment_income_before_behavioral_response", + known_period, + array, + ) employment_income.delete_arrays(known_period) self_employment_income = self.get_holder("self_employment_income") for known_period in employment_income.get_known_periods(): array = self_employment_income.get_array(known_period) self.set_input( - "self_employment_income_before_lsr", known_period, array + "self_employment_income_before_behavioral_response", + known_period, + array, ) self_employment_income.delete_arrays(known_period) @@ -121,7 +127,9 @@ def __init__(self, *args, **kwargs): for known_period in weekly_hours.get_known_periods(): array = weekly_hours.get_array(known_period) self.set_input( - "weekly_hours_worked_before_lsr", known_period, array + "weekly_hours_worked_before_behavioral_response", + known_period, + array, ) weekly_hours.delete_arrays(known_period) @@ -160,14 +168,20 @@ def __init__(self, *args, **kwargs): employment_income = self.get_holder("employment_income") for known_period in employment_income.get_known_periods(): array = employment_income.get_array(known_period) - self.set_input("employment_income_before_lsr", known_period, array) + self.set_input( + "employment_income_before_behavioral_response", + known_period, + array, + ) employment_income.delete_arrays(known_period) self_employment_income = self.get_holder("self_employment_income") for known_period in self_employment_income.get_known_periods(): array = self_employment_income.get_array(known_period) self.set_input( - "self_employment_income_before_lsr", known_period, array + "self_employment_income_before_behavioral_response", + known_period, + array, ) self_employment_income.delete_arrays(known_period) @@ -175,7 +189,9 @@ def __init__(self, *args, **kwargs): for known_period in weekly_hours.get_known_periods(): array = weekly_hours.get_array(known_period) self.set_input( - "weekly_hours_worked_before_lsr", known_period, array + "weekly_hours_worked_before_behavioral_response", + known_period, + array, ) weekly_hours.delete_arrays(known_period) @@ -200,9 +216,9 @@ def __init__(self, *args, **kwargs): "capital_gains", ] ] + [ - "employment_income_before_lsr", - "self_employment_income_before_lsr", - "weekly_hours_worked_before_lsr", + "employment_income_before_behavioral_response", + "self_employment_income_before_behavioral_response", + "weekly_hours_worked_before_behavioral_response", "capital_gains_before_response", ] diff --git a/policyengine_us/tests/policy/baseline/gov/states/co/tax/income/credits/sales_tax_refund/co_sales_tax_refund.yaml b/policyengine_us/tests/policy/baseline/gov/states/co/tax/income/credits/sales_tax_refund/co_sales_tax_refund.yaml index 6bd01b1a159..56626acc30e 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/co/tax/income/credits/sales_tax_refund/co_sales_tax_refund.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/co/tax/income/credits/sales_tax_refund/co_sales_tax_refund.yaml @@ -32,7 +32,7 @@ co_sales_tax_refund_eligible: true filing_status: SINGLE output: - co_sales_tax_refund: 800 + co_sales_tax_refund: 661 - name: Joint calculation period: 2022 @@ -51,20 +51,3 @@ filing_status: SEPARATE output: co_sales_tax_refund: 234 - -- name: Integration test - period: 2023 - input: - people: - person1: - age: 40 - person2: - age: 40 - tax_units: - tax_unit: - members: [person1, person2] - co_modified_agi: 60_001 - co_sales_tax_refund_eligible: true - filing_status: JOINT - output: - co_sales_tax_refund: 1_600 diff --git a/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/student/is_snap_ineligible_student.yaml b/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/student/is_snap_ineligible_student.yaml index 3b2c6d2572b..51394b19b7a 100644 --- a/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/student/is_snap_ineligible_student.yaml +++ b/policyengine_us/tests/policy/baseline/gov/usda/snap/eligibility/student/is_snap_ineligible_student.yaml @@ -4,7 +4,7 @@ is_full_time_student: true age: 18 is_disabled: false - weekly_hours_worked_before_lsr: false + weekly_hours_worked_before_behavioral_response: false is_parent: false output: is_snap_ineligible_student: true @@ -15,7 +15,7 @@ is_full_time_student: true age: 17 is_disabled: false - weekly_hours_worked_before_lsr: false + weekly_hours_worked_before_behavioral_response: false is_parent: false output: is_snap_ineligible_student: false diff --git a/policyengine_us/variables/gov/simulation/capital_gains_responses.py b/policyengine_us/variables/gov/simulation/capital_gains_responses.py index 16d3a9d48b6..fbde3aa9b68 100644 --- a/policyengine_us/variables/gov/simulation/capital_gains_responses.py +++ b/policyengine_us/variables/gov/simulation/capital_gains_responses.py @@ -96,6 +96,8 @@ def formula(person, period, parameters): response_factor = np.exp(elasticity * tax_rate_change) - 1 response = capital_gains * response_factor + print(response.sum()) + return response diff --git a/policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py b/policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py index 8a3db1efbf9..101d5776e0c 100644 --- a/policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py +++ b/policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py @@ -67,7 +67,7 @@ def formula(person, period, parameters): return np.clip(relative_change, -wage_change_bound, wage_change_bound) -class income_elasticity_lsr(Variable): +class income_elasticity_behavioral_response(Variable): value_type = float entity = Person label = "income elasticity of labor supply response" @@ -77,9 +77,11 @@ class income_elasticity_lsr(Variable): def formula(person, period, parameters): lsr = parameters(period).gov.simulation.labor_supply_responses - employment_income = person("employment_income_before_lsr", period) + employment_income = person( + "employment_income_before_behavioral_response", period + ) self_employment_income = person( - "self_employment_income_before_lsr", period + "self_employment_income_before_behavioral_response", period ) earnings = employment_income + self_employment_income income_change = person("relative_income_change", period) @@ -136,9 +138,9 @@ def formula(person, period, parameters): 1_726e3, ] - earnings = person("employment_income_before_lsr", period) + person( - "self_employment_income_before_lsr", period - ) + earnings = person( + "employment_income_before_behavioral_response", period + ) + person("self_employment_income_before_behavioral_response", period) earnings_decile = ( np.searchsorted(earnings_decile_markers, earnings) + 1 ) @@ -178,7 +180,7 @@ def formula(person, period, parameters): return elasticities -class substitution_elasticity_lsr(Variable): +class substitution_elasticity_behavioral_response(Variable): value_type = float entity = Person label = "substitution elasticity of labor supply response" @@ -188,9 +190,11 @@ class substitution_elasticity_lsr(Variable): def formula(person, period, parameters): lsr = parameters(period).gov.simulation.labor_supply_responses - employment_income = person("employment_income_before_lsr", period) + employment_income = person( + "employment_income_before_behavioral_response", period + ) self_employment_income = person( - "self_employment_income_before_lsr", period + "self_employment_income_before_behavioral_response", period ) earnings = employment_income + self_employment_income wage_change = person("relative_wage_change", period) @@ -241,22 +245,24 @@ def formula(person, period, parameters): "self_employment_income_behavioral_response" ) branch.set_input( - "employment_income_before_lsr", + "employment_income_before_behavioral_response", period, - person("employment_income_before_lsr", period), + person("employment_income_before_behavioral_response", period), ) branch.set_input( - "self_employment_income_before_lsr", + "self_employment_income_before_behavioral_response", period, - person("self_employment_income_before_lsr", period), + person( + "self_employment_income_before_behavioral_response", period + ), ) response = add( person, period, [ - "income_elasticity_lsr", - "substitution_elasticity_lsr", + "income_elasticity_behavioral_response", + "substitution_elasticity_behavioral_response", ], ) simulation = person.simulation @@ -280,9 +286,11 @@ class employment_income_behavioral_response(Variable): def formula(person, period, parameters): lsr = person("labor_supply_behavioral_response", period) - employment_income = person("employment_income_before_lsr", period) + employment_income = person( + "employment_income_before_behavioral_response", period + ) self_employment_income = person( - "self_employment_income_before_lsr", period + "self_employment_income_before_behavioral_response", period ) earnings = employment_income + self_employment_income emp_share = np.ones_like(earnings) diff --git a/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption.py b/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption.py index 57cd7ce7899..4ee5e2eafa3 100644 --- a/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption.py +++ b/policyengine_us/variables/gov/states/il/tax/income/exemptions/il_personal_exemption.py @@ -1,7 +1,4 @@ from policyengine_us.model_api import * -from policyengine_us.variables.gov.states.il.tax.income.exemptions.il_personal_exemption_eligibility_status import ( - ILPersonalExemptionEligibilityStatus, -) class il_personal_exemption(Variable): @@ -17,6 +14,8 @@ def formula(tax_unit, period, parameters): "il_personal_exemption_eligibility_status", period ) + eligibility_status = il_is_personal_exemption_eligible.possible_values + personal_exemption_amount = parameters( period ).gov.states.il.tax.income.exemption.personal @@ -24,9 +23,9 @@ def formula(tax_unit, period, parameters): return personal_exemption_amount * select( [ il_is_personal_exemption_eligible - == ILPersonalExemptionEligibilityStatus.BOTH_ELIGIBLE, + == eligibility_status.BOTH_ELIGIBLE, il_is_personal_exemption_eligible - == ILPersonalExemptionEligibilityStatus.PARTIALLY_ELIGIBLE, + == eligibility_status.PARTIALLY_ELIGIBLE, ], [2, 1], 0, diff --git a/policyengine_us/variables/gov/usda/snap/eligibility/student/is_snap_ineligible_student.py b/policyengine_us/variables/gov/usda/snap/eligibility/student/is_snap_ineligible_student.py index e235cc80c2f..d1de642908d 100644 --- a/policyengine_us/variables/gov/usda/snap/eligibility/student/is_snap_ineligible_student.py +++ b/policyengine_us/variables/gov/usda/snap/eligibility/student/is_snap_ineligible_student.py @@ -17,7 +17,9 @@ def formula(person, period, parameters): p = parameters(period).gov.usda.snap.student age_eligible = p.age_threshold.calc(age) disabled = person("is_disabled", period) - hours_worked = person("weekly_hours_worked_before_lsr", period) + hours_worked = person( + "weekly_hours_worked_before_behavioral_response", period + ) hours_eligible = hours_worked >= p.working_hours_threshold # The parental status applies to children under 6 (under 12 # if no care available) diff --git a/policyengine_us/variables/household/cliff.py b/policyengine_us/variables/household/cliff.py index 476ba0d0b8f..2339a033909 100644 --- a/policyengine_us/variables/household/cliff.py +++ b/policyengine_us/variables/household/cliff.py @@ -48,7 +48,6 @@ def formula(person, period, parameters): alt_person = alt_sim.person netinc_alt = alt_person.household("household_net_income", period) increase[mask] += netinc_alt[mask] - netinc_base[mask] - del sim.branches[f"cliff_for_adult_{adult_index}"] return where(increase < 0, -increase, 0) diff --git a/policyengine_us/variables/household/income/person/weekly_hours_worked.py b/policyengine_us/variables/household/income/person/weekly_hours_worked.py index 158cfe5f2a0..a1597f8d28b 100644 --- a/policyengine_us/variables/household/income/person/weekly_hours_worked.py +++ b/policyengine_us/variables/household/income/person/weekly_hours_worked.py @@ -9,12 +9,12 @@ class weekly_hours_worked(Variable): documentation = "Hours worked per week on average." definition_period = YEAR adds = [ - "weekly_hours_worked_before_lsr", + "weekly_hours_worked_before_behavioral_response", "weekly_hours_worked_behavioural_response", ] -class weekly_hours_worked_before_lsr(Variable): +class weekly_hours_worked_before_behavioral_response(Variable): value_type = float entity = Person label = "average weekly hours worked (before labor supply responses)" @@ -30,14 +30,22 @@ class weekly_hours_worked_behavioural_response_income_elasticity(Variable): definition_period = YEAR def formula(person, period, parameters): - original = person("weekly_hours_worked_before_lsr", period) + original = person( + "weekly_hours_worked_before_behavioral_response", period + ) lsr = person("labor_supply_behavioral_response", period) if (lsr != 0).any(): - income_effect = person("income_elasticity_lsr", period) + income_effect = person( + "income_elasticity_behavioral_response", period + ) else: income_effect = 0 - original_emp = person("employment_income_before_lsr", period) - original_self_emp = person("self_employment_income_before_lsr", period) + original_emp = person( + "employment_income_before_behavioral_response", period + ) + original_self_emp = person( + "self_employment_income_before_behavioral_response", period + ) original_earnings = original_emp + original_self_emp lsr_relative_change = np.where( original_earnings == 0, 0, income_effect / original_earnings @@ -55,14 +63,22 @@ class weekly_hours_worked_behavioural_response_substitution_elasticity( definition_period = YEAR def formula(person, period, parameters): - original = person("weekly_hours_worked_before_lsr", period) + original = person( + "weekly_hours_worked_before_behavioral_response", period + ) lsr = person("labor_supply_behavioral_response", period) if (lsr != 0).any(): - substitution_effect = person("substitution_elasticity_lsr", period) + substitution_effect = person( + "substitution_elasticity_behavioral_response", period + ) else: substitution_effect = 0 - original_emp = person("employment_income_before_lsr", period) - original_self_emp = person("self_employment_income_before_lsr", period) + original_emp = person( + "employment_income_before_behavioral_response", period + ) + original_self_emp = person( + "self_employment_income_before_behavioral_response", period + ) original_earnings = original_emp + original_self_emp lsr_relative_change = np.where( original_earnings == 0, 0, substitution_effect / original_earnings diff --git a/policyengine_us/variables/household/marginal_tax_rate.py b/policyengine_us/variables/household/marginal_tax_rate.py index fd435b48b51..8bd43395ec3 100644 --- a/policyengine_us/variables/household/marginal_tax_rate.py +++ b/policyengine_us/variables/household/marginal_tax_rate.py @@ -46,7 +46,6 @@ def formula(person, period, parameters): netinc_alt = alt_person.household("household_net_income", period) increase = netinc_alt - netinc_base mtr_values += where(mask, 1 - increase / delta, 0) - del sim.branches[f"mtr_for_adult_{adult_index}"] return mtr_values diff --git a/policyengine_us/variables/input/income.py b/policyengine_us/variables/input/income.py index 02a1995bdf3..b164af677b7 100644 --- a/policyengine_us/variables/input/income.py +++ b/policyengine_us/variables/input/income.py @@ -4,7 +4,7 @@ label = "Income" -class employment_income_before_lsr(Variable): +class employment_income_before_behavioral_response(Variable): value_type = float entity = Person label = "employment income before labor supply responses" @@ -13,7 +13,7 @@ class employment_income_before_lsr(Variable): uprating = "calibration.gov.irs.soi.employment_income" -class self_employment_income_before_lsr(Variable): +class self_employment_income_before_behavioral_response(Variable): value_type = float entity = Person label = "self-employment income before labor supply responses" @@ -30,7 +30,7 @@ class employment_income(Variable): unit = USD definition_period = YEAR adds = [ - "employment_income_before_lsr", + "employment_income_before_behavioral_response", "employment_income_behavioral_response", ] uprating = "calibration.gov.irs.soi.employment_income" @@ -44,7 +44,7 @@ class self_employment_income(Variable): documentation = "Self-employment non-farm income." definition_period = YEAR adds = [ - "self_employment_income_before_lsr", + "self_employment_income_before_behavioral_response", "self_employment_income_behavioral_response", ] uprating = "calibration.gov.irs.soi.self_employment_income" diff --git a/setup.py b/setup.py index 13497b33f36..f5e112af8d7 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="policyengine-us", - version="1.137.3", + version="1.137.1", author="PolicyEngine", author_email="hello@policyengine.org", long_description=readme,