Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change _lsr to _behavioral_response #5286

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add back


### 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
Expand Down Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add back

[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
Expand Down
10 changes: 0 additions & 10 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8580,13 +8580,3 @@
fixed:
- remove uprating for SNAP variables that don't change
date: 2024-10-31 18:57:07
- bump: patch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add back

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
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
fixed:
- Change _lsr to _behavioral_response.
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back


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
34 changes: 25 additions & 9 deletions policyengine_us/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,30 @@ 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)

weekly_hours = self.get_holder("weekly_hours_worked")
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)

Expand Down Expand Up @@ -160,22 +168,30 @@ 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)

weekly_hours = self.get_holder("weekly_hours_worked")
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)

Expand All @@ -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",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,20 +51,3 @@
filing_status: SEPARATE
output:
co_sales_tax_refund: 234

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add back

- 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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
response_factor = np.exp(elasticity * tax_rate_change) - 1
response = capital_gains * response_factor

print(response.sum())

Check warning on line 99 in policyengine_us/variables/gov/simulation/capital_gains_responses.py

View check run for this annotation

Codecov / codecov/patch

policyengine_us/variables/gov/simulation/capital_gains_responses.py#L99

Added line #L99 was not covered by tests

return response


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
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"
Expand All @@ -77,9 +77,11 @@

def formula(person, period, parameters):
lsr = parameters(period).gov.simulation.labor_supply_responses
employment_income = person("employment_income_before_lsr", period)
employment_income = person(

Check warning on line 80 in policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py

View check run for this annotation

Codecov / codecov/patch

policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py#L80

Added line #L80 was not covered by tests
"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)
Expand Down Expand Up @@ -136,9 +138,9 @@
1_726e3,
]

earnings = person("employment_income_before_lsr", period) + person(
"self_employment_income_before_lsr", period
)
earnings = person(

Check warning on line 141 in policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py

View check run for this annotation

Codecov / codecov/patch

policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py#L141

Added line #L141 was not covered by tests
"employment_income_before_behavioral_response", period
) + person("self_employment_income_before_behavioral_response", period)
earnings_decile = (
np.searchsorted(earnings_decile_markers, earnings) + 1
)
Expand Down Expand Up @@ -178,7 +180,7 @@
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"
Expand All @@ -188,9 +190,11 @@

def formula(person, period, parameters):
lsr = parameters(period).gov.simulation.labor_supply_responses
employment_income = person("employment_income_before_lsr", period)
employment_income = person(

Check warning on line 193 in policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py

View check run for this annotation

Codecov / codecov/patch

policyengine_us/variables/gov/simulation/labor_supply_response/labor_supply_response.py#L193

Added line #L193 was not covered by tests
"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)
Expand Down Expand Up @@ -241,22 +245,24 @@
"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
Expand All @@ -280,9 +286,11 @@

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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change back

ILPersonalExemptionEligibilityStatus,
)


class il_personal_exemption(Variable):
Expand All @@ -17,16 +14,18 @@ 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

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion policyengine_us/variables/household/cliff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
Loading