Skip to content

Commit

Permalink
New York exemptions child definition
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelMakarchuk committed Dec 17, 2024
1 parent 19a1d20 commit b504dee
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 39 deletions.
1 change: 1 addition & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
changes:
fixed:
- New York Working Families Tax Credit parameter structure.
- New York exemptions child definition.
76 changes: 41 additions & 35 deletions docs/usage/structural_reform_dating.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,33 @@
"from policyengine_us import Microsimulation\n",
"from policyengine_core.reforms import Reform\n",
"\n",
"reform_1 = Reform.from_dict({\n",
" \"gov.contrib.salt_phase_out.in_effect\": {\n",
" \"2024-01-01.2100-12-31\": True\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].rate\": {\n",
" \"2024-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].threshold\": {\n",
" \"2024-01-01.2100-12-31\": 200000\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].rate\": {\n",
" \"2024-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].threshold\": {\n",
" \"2024-01-01.2100-12-31\": 400000\n",
" }\n",
"}, country_id=\"us\")\n",
"reform_1 = Reform.from_dict(\n",
" {\n",
" \"gov.contrib.salt_phase_out.in_effect\": {\n",
" \"2024-01-01.2100-12-31\": True\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].rate\": {\n",
" \"2024-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].threshold\": {\n",
" \"2024-01-01.2100-12-31\": 200000\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].rate\": {\n",
" \"2024-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].threshold\": {\n",
" \"2024-01-01.2100-12-31\": 400000\n",
" },\n",
" },\n",
" country_id=\"us\",\n",
")\n",
"\n",
"\n",
"baseline_sim_1 = Microsimulation()\n",
"reformed_sim_1 = Microsimulation(reform=reform_1)\n",
"baseline_salt_1 = baseline_sim_1.calculate(\"salt_deduction\", period=2026)\n",
"reformed_salt_1 = reformed_sim_1.calculate(\"salt_deduction\", period=2026)\n",
"print(f\"Diff: {reformed_salt_1.sum() - baseline_salt_1.sum()}\")\n"
"print(f\"Diff: {reformed_salt_1.sum() - baseline_salt_1.sum()}\")"
]
},
{
Expand Down Expand Up @@ -95,23 +98,26 @@
"from policyengine_us import Microsimulation\n",
"from policyengine_core.reforms import Reform\n",
"\n",
"reform_2 = Reform.from_dict({\n",
" \"gov.contrib.salt_phase_out.in_effect\": {\n",
" \"2026-01-01.2100-12-31\": True\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].rate\": {\n",
" \"2026-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].threshold\": {\n",
" \"2026-01-01.2100-12-31\": 200000\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].rate\": {\n",
" \"2026-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].threshold\": {\n",
" \"2026-01-01.2100-12-31\": 400000\n",
" }\n",
"}, country_id=\"us\")\n",
"reform_2 = Reform.from_dict(\n",
" {\n",
" \"gov.contrib.salt_phase_out.in_effect\": {\n",
" \"2026-01-01.2100-12-31\": True\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].rate\": {\n",
" \"2026-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.joint[1].threshold\": {\n",
" \"2026-01-01.2100-12-31\": 200000\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].rate\": {\n",
" \"2026-01-01.2100-12-31\": 0.001\n",
" },\n",
" \"gov.contrib.salt_phase_out.rate.other[1].threshold\": {\n",
" \"2026-01-01.2100-12-31\": 400000\n",
" },\n",
" },\n",
" country_id=\"us\",\n",
")\n",
"\n",
"\n",
"baseline_sim_2 = Microsimulation(start_instant=\"2026-01-01\")\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ metadata:
- title: 2023 Nebraska Individual Income Tax Booklet
href: https://revenue.nebraska.gov/sites/revenue.nebraska.gov/files/doc/tax-forms/2023/incometax/f_1040n_booklet_2023_Final.pdf#page=19
- title: Nebraska Revised Statute 77-2716 (15)(a)
href: https://nebraskalegislature.gov/laws/statutes.php?statute=77-2716
href: https://nebraskalegislature.gov/laws/statutes.php?statute=77-2716
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def formula(person, period, parameters):
child_dependent = person("is_child_dependent", period)
wftc_eligible_child = person("ny_wftc_eligible_child", period)
return child_dependent & ~wftc_eligible_child
return person("is_tax_unit_dependent", period)
return person("tax_unit_child_dependents", period)

class ny_exemptions(Variable):
value_type = float
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
absolute_error_margin: 0
input:
state_code: NY
tax_unit_count_dependents: 2
tax_unit_child_dependents: 2
output:
ny_exemptions: 2_000
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,30 @@
younger_eitc: 0
ny_eitc: 1_006.46
ny_working_families_tax_credit: 550

- name: 2026 test with two dependents, one older child and one younger
period: 2026
absolute_error_margin: 1
reforms: policyengine_us.reforms.states.ny.wftc.ny_working_families_tax_credit.ny_working_families_tax_credit
input:
gov.contrib.states.ny.wftc.in_effect: true
people:
person1:
age: 40
employment_income: 30_000
person2:
age: 40
person3:
age: 19
is_full_time_student: true
person4:
age: 10
tax_units:
tax_unit:
members: [person1, person2, person3, person4]
households:
household:
members: [person1, person2, person3, person4]
state_code: NY
output:
ny_exemptions: 1_000
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ny_exemptions(Variable):
defined_for = StateCode.NY

def formula(tax_unit, period, parameters):
count_dependents = tax_unit("tax_unit_count_dependents", period)
count_dependents = tax_unit("tax_unit_child_dependents", period)
dependent_exemption = parameters(
period
).gov.states.ny.tax.income.exemptions.dependent
Expand Down

0 comments on commit b504dee

Please sign in to comment.