Skip to content

Commit

Permalink
upstream master
Browse files Browse the repository at this point in the history
Merge branch 'master' of https://github.com/PolicyEngine/policyengine-us into hua7450/issue5109
  • Loading branch information
hua7450 authored Dec 19, 2024
2 parents 2c52eec + 73d6f6d commit d42c1cc
Show file tree
Hide file tree
Showing 18 changed files with 603 additions and 30 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@ 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.162.0] - 2024-12-18 02:31:13

### Added

- Add non-refundable credits to state dependent exemption reform.

## [1.161.3] - 2024-12-18 02:17:13

### Fixed

- New York Working Families Tax Credit parameter structure.
- New York exemptions child definition.

## [1.161.2] - 2024-12-15 23:08:57

### Fixed

- NYWFTC EITC older children eligibility.

## [1.161.1] - 2024-12-13 23:43:04

### Added

- Capability to select custom start time for simulations; this is a patch for structural reforms that occur at non-default time periods.

## [1.161.0] - 2024-12-12 05:36:14

### Added

- Nebraska military retirement benefit exclusion.

## [1.160.0] - 2024-12-05 16:48:14

### Added
Expand Down Expand Up @@ -10377,6 +10408,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[1.162.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.161.3...1.162.0
[1.161.3]: https://github.com/PolicyEngine/policyengine-us/compare/1.161.2...1.161.3
[1.161.2]: https://github.com/PolicyEngine/policyengine-us/compare/1.161.1...1.161.2
[1.161.1]: https://github.com/PolicyEngine/policyengine-us/compare/1.161.0...1.161.1
[1.161.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.160.0...1.161.0
[1.160.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.159.0...1.160.0
[1.159.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.158.0...1.159.0
[1.158.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.157.0...1.158.0
Expand Down
27 changes: 27 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8798,3 +8798,30 @@
added:
- Second earner tax reform.
date: 2024-12-05 16:48:14
- bump: minor
changes:
added:
- Nebraska military retirement benefit exclusion.
date: 2024-12-12 05:36:14
- bump: patch
changes:
added:
- Capability to select custom start time for simulations; this is a patch for
structural reforms that occur at non-default time periods.
date: 2024-12-13 23:43:04
- bump: patch
changes:
fixed:
- NYWFTC EITC older children eligibility.
date: 2024-12-15 23:08:57
- bump: patch
changes:
fixed:
- New York Working Families Tax Credit parameter structure.
- New York exemptions child definition.
date: 2024-12-18 02:17:13
- bump: minor
changes:
added:
- Add non-refundable credits to state dependent exemption reform.
date: 2024-12-18 02:31:13
152 changes: 152 additions & 0 deletions docs/usage/structural_reform_dating.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Inputting Dates for Structural Reforms\n",
"\n",
"\"Structural\" reforms are those reforms that modify not only set values in the tax-benefit system, but also the formulas used to calculate taxes and benefits. These are typcially larger, more involved reforms that require custom coding.\n",
"\n",
"Due to the current limitations of the `Microsimulation` class, a code patch is required when running structural reforms with parameters that begin at any date other than January 1st of the current year. \n",
"\n",
"For example, the code cell below illustrates a standard way to instantiating a structural reform, without the patch, when simulating in 2024:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/miniconda3/envs/us-3.11/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Diff: -2605373719.2974854\n"
]
}
],
"source": [
"from policyengine_us import Microsimulation\n",
"from policyengine_core.reforms import Reform\n",
"\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()}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The cell below shows a series of reforms that begin in 2026, later than the current year. To effectively handle this case, we need to add an argument to the `Microsimulation` classes that we call. \n",
"\n",
"This argument, called `start_instant`, should be set to the same date as the start of the reforms, in ISO date format. In the case of the example below, this is `2026-01-01`, so our altered call to `Microsimulation` looks like:\n",
"\n",
"```\n",
"baseline_sim_2 = Microsimulation(start_instant=\"2026-01-01\")\n",
"reformed_sim_2 = Microsimulation(reform=reform_2, start_instant=\"2026-01-01\")\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Diff: -2605373719.2974854\n"
]
}
],
"source": [
"from policyengine_us import Microsimulation\n",
"from policyengine_core.reforms import Reform\n",
"\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",
"reformed_sim_2 = Microsimulation(reform=reform_2, start_instant=\"2026-01-01\")\n",
"baseline_salt_2 = baseline_sim_2.calculate(\"salt_deduction\", period=2026)\n",
"reformed_salt_2 = reformed_sim_2.calculate(\"salt_deduction\", period=2026)\n",
"print(f\"Diff: {reformed_salt_2.sum() - baseline_salt_2.sum()}\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "us-3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: New York limits the Working Families Tax Credit to children below this age.
description: New York limits the Working Families Tax Credit to children at or below this age.
metadata:
unit: year
period: year
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: Nebraska limits the military retirement benefits to filers this age or older.

values:
2015-01-01: 67

metadata:
unit: year
period: year
label: Nebraska military retirement benefits age threshold
reference:
- title: 2021 Nebraska Individual Income Tax Booklet
href: https://revenue.nebraska.gov/sites/revenue.nebraska.gov/files/doc/f_1040n_booklet.pdf#page=16
- title: 2022 NE income tax form and instruction booklet
href: https://revenue.nebraska.gov/sites/revenue.nebraska.gov/files/doc/2022_Ne_Individual_Income_Tax_Booklet_8-307-2022_final_8.pdf#page=3
- 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
description: Nebraska subtracts this fraction of military retirement benefits from federal adjusted gross income.
values:
2021-01-01: 0.4
2022-01-01: 1

metadata:
label: Nebraska military retirement subtraction fraction
unit: /1
period: year
reference:
- title: 2021 Nebraska Individual Income Tax Booklet
href: https://revenue.nebraska.gov/sites/revenue.nebraska.gov/files/doc/f_1040n_booklet.pdf#page=16
- title: 2022 NE income tax form and instruction booklet
href: https://revenue.nebraska.gov/sites/revenue.nebraska.gov/files/doc/2022_Ne_Individual_Income_Tax_Booklet_8-307-2022_final_8.pdf#page=3
- 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)
href: https://nebraskalegislature.gov/laws/statutes.php?statute=77-2716

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ description: Nebraska subtracts these sources from adjusted gross income.
values:
2021-01-01:
- ne_social_security_subtraction
- ne_military_retirement_subtraction
2024-01-01:
- ne_social_security_subtraction
- taxable_public_pension_income
- ne_military_retirement_subtraction


metadata:
Expand Down
9 changes: 9 additions & 0 deletions policyengine_us/reforms/state_dependent_exemptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,12 @@ Vermont: Remove the dependents from the personal exemptions
Virginia: Only apply the personal exemptions to the head and spouse
West Virginia: Change the `tax_unit_size` to `head_spouse_count`
Wisconsin: Change the `tax_unit_size` to `head_spouse_count`
Arizona: Neutralize dependent exemptions
Arkansas: Neutralize dependent exemptions
Delaware: Change the `tax_unit_size` to `head_spouse_count`
Idaho: Neutralize dependent exemptions CTC
Iowa: Change the `tax_unit_size` to `head_spouse_count`
Kentucky: Change the `tax_unit_size` in family_size to `head_spouse_count`
Maine: Neutralize dependent exemptions
Nebraska: Change the `tax_unit_size` to `head_spouse_count`
Oklahoma: Remove CTC portion and update return
Loading

0 comments on commit d42c1cc

Please sign in to comment.