Skip to content

Commit

Permalink
Merge pull request #316 from PSLmodels/taxcalc-new-version
Browse files Browse the repository at this point in the history
Use next Tax-Calculator version
  • Loading branch information
martinholmer authored Dec 1, 2024
2 parents 33a1f10 + ee90eb5 commit 4fba122
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 140 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

setup(
name="tmd",
version="0.6.0",
version="0.6.1",
packages=find_packages(),
python_requires=">=3.10,<3.13",
install_requires=[
"policyengine_us==1.55.0",
"tables", # required by policyengine_us
"taxcalc>=4.3.3",
"taxcalc>=4.3.4",
"scikit-learn",
"torch",
"tensorboard",
Expand Down
34 changes: 17 additions & 17 deletions tests/expected_tax_expenditures
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
YR,KIND,EST= 2023 paytax 1595.0
YR,KIND,EST= 2023 iitax 2507.0
YR,KIND,EST= 2023 ctc 130.2
YR,KIND,EST= 2023 eitc 69.6
YR,KIND,EST= 2023 social_security_partial_taxability 35.9
YR,KIND,EST= 2023 niit -54.0
YR,KIND,EST= 2023 cgqd_tax_preference 220.9
YR,KIND,EST= 2023 qbid 58.0
YR,KIND,EST= 2023 salt 21.2
YR,KIND,EST= 2026 paytax 1852.5
YR,KIND,EST= 2026 iitax 3160.8
YR,KIND,EST= 2026 ctc 44.7
YR,KIND,EST= 2026 eitc 78.1
YR,KIND,EST= 2026 social_security_partial_taxability 47.7
YR,KIND,EST= 2026 niit -53.8
YR,KIND,EST= 2026 cgqd_tax_preference 224.8
YR,KIND,EST= 2023 paytax 1579.5
YR,KIND,EST= 2023 iitax 2527.0
YR,KIND,EST= 2023 ctc 129.0
YR,KIND,EST= 2023 eitc 68.3
YR,KIND,EST= 2023 social_security_partial_taxability 35.8
YR,KIND,EST= 2023 niit -52.5
YR,KIND,EST= 2023 cgqd_tax_preference 219.7
YR,KIND,EST= 2023 qbid 52.1
YR,KIND,EST= 2023 salt 21.1
YR,KIND,EST= 2026 paytax 1832.8
YR,KIND,EST= 2026 iitax 3188.6
YR,KIND,EST= 2026 ctc 43.9
YR,KIND,EST= 2026 eitc 77.1
YR,KIND,EST= 2026 social_security_partial_taxability 47.5
YR,KIND,EST= 2026 niit -52.1
YR,KIND,EST= 2026 cgqd_tax_preference 222.2
YR,KIND,EST= 2026 qbid -0.0
YR,KIND,EST= 2026 salt 165.5
YR,KIND,EST= 2026 salt 165.0
4 changes: 2 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def compare(name, act, exp, tol):
compare("wght_sum", wght.sum(), 184e6, 0.01)
hiagi = agi >= 1e6
compare("wght_sum_hiagi", (wght * hiagi).sum(), 0.875e6, 0.01)
compare("wght_itax_sum", (wght * itax).sum(), 1595e9, 0.01)
compare("wght_itax_sum_hiagi", ((wght * itax) * hiagi).sum(), 902e9, 0.01)
compare("wght_itax_sum", (wght * itax).sum(), 1666e9, 0.01)
compare("wght_itax_sum_hiagi", ((wght * itax) * hiagi).sum(), 911e9, 0.01)
# count weighted number of tax units with zero agi by filing status
agi0 = agi == 0
compare("wght_sum_agi0_fs0", (wght * agi0).sum(), 16.22e6, 0.01)
Expand Down
25 changes: 19 additions & 6 deletions tests/test_tax_revenue.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,26 @@
FIRST_CYR = 2021
LAST_CYR = 2033

DEFAULT_RELTOL_ITAX = 0.10
DEFAULT_RELTOL_ITAX = 0.010
RELTOL_ITAX = {
2022: 0.13,
2021: 0.095,
2022: 0.090,
2024: 0.060,
2025: 0.050,
2026: 0.100,
2027: 0.060,
2028: 0.070,
2029: 0.075,
2030: 0.080,
2031: 0.085,
2032: 0.090,
2033: 0.090,
}
DEFAULT_RELTOL_PTAX = 0.02
DEFAULT_RELTOL_PTAX = 0.010
RELTOL_PTAX = {
2021: 0.05,
2021: 0.095,
2022: 0.020,
2024: 0.020,
}


Expand Down Expand Up @@ -93,7 +106,7 @@ def test_tax_revenue(
else:
if emsg:
reltol = RELTOL_ITAX.get(year, DEFAULT_RELTOL_ITAX)
emsg += f"\nRELTOL_ITAX= {reltol:4.2f}"
emsg += f"\nRELTOL_ITAX= {reltol:5.3f}"
reltol = RELTOL_PTAX.get(year, DEFAULT_RELTOL_PTAX)
emsg += f"\nRELTOL_PTAX= {reltol:4.2f}"
emsg += f"\nRELTOL_PTAX= {reltol:5.3f}"
raise ValueError(emsg)
96 changes: 0 additions & 96 deletions tmd/areas/weights/xx.log

This file was deleted.

20 changes: 14 additions & 6 deletions tmd/create_taxcalc_growth_factors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
LAST_YEAR = 2074

AWAGE_INDEX = 6
ASCHCI_INDEX = 7
ASCHEI_INDEX = 9
AINTS_INDEX = 11
ADIVS_INDEX = 12
ACGNS_INDEX = 13
ASOCSEC_INDEX = 14
AUCOMP_INDEX = 15


PGFFILE = STORAGE_FOLDER / "input" / "puf_growfactors.csv"
TGFFILE = STORAGE_FOLDER / "output" / "tmd_growfactors.csv"
Expand All @@ -37,12 +42,15 @@ def create_factors_file():

# adjust some factors in order to calibrate tax revenue after FIRST_YEAR
# ... adjust 2022 factors to hit 2023 tax revenue targets:
# ...... adjustments to hit 2023 PTAX target of 1591.3
gfdf.iat[2022 - FIRST_YEAR, AWAGE_INDEX] += 0.099
# ...... adjustments to hit 2023 ITAX target of 2505.3
gfdf.iat[2022 - FIRST_YEAR, ADIVS_INDEX] += -0.039
gfdf.iat[2022 - FIRST_YEAR, ACGNS_INDEX] += -0.039
gfdf.iat[2022 - FIRST_YEAR, ASOCSEC_INDEX] += -0.192
# ...... adjustments to hit 2023 CBO PTAX target of 1580.0
gfdf.iat[2022 - FIRST_YEAR, AWAGE_INDEX] += 0.16
# ...... adjustments to hit 2023 CBO ITAX target of 2512.3
gfdf.iat[2022 - FIRST_YEAR, ASOCSEC_INDEX] += -0.19
gfdf.iat[2022 - FIRST_YEAR, ASCHCI_INDEX] += -0.30
gfdf.iat[2022 - FIRST_YEAR, ASCHEI_INDEX] += -0.30
gfdf.iat[2022 - FIRST_YEAR, ADIVS_INDEX] += -0.04
gfdf.iat[2022 - FIRST_YEAR, ACGNS_INDEX] += -0.04
gfdf.iat[2022 - FIRST_YEAR, AUCOMP_INDEX] += -0.50

# add rows thru LAST_YEAR by copying values for last year in PUF file
if LAST_YEAR > last_puf_year:
Expand Down
22 changes: 11 additions & 11 deletions tmd/examination/results4.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Phase 4+ National Data Examination Results
==========================================

**RESULTS AS OF 2024-11-17**
**RESULTS AS OF 2024-11-30**

This project is developing a new dataset for use by income and payroll
tax microsimulation models. The project is progressing in several
Expand All @@ -19,7 +19,7 @@ For more on the source of the federal agency estimates and on how the
model-plus-dataset estimates are generated, see the [examination
methods](./methods.md) document. The model used to generate the
following Phase 6 estimates is [Tax-Calculator
4.3.3](https://github.com/PSLmodels/Tax-Calculator/blob/master/docs/about/releases.md)).
4.3.4](https://github.com/PSLmodels/Tax-Calculator/blob/master/docs/about/releases.md)).

<br>

Expand All @@ -28,7 +28,7 @@ following Phase 6 estimates is [Tax-Calculator
| CY23 Amount | CY26 Amount | Estimate Source |
| ---: | ---: | :--- |
| 1580.0 | 1829.9 | CBO |
| 1595.0 | 1852.5 | Tax-Calculator + phase 6 dataset |
| 1579.5 | 1832.8 | Tax-Calculator + phase 6 dataset |

<br>

Expand All @@ -37,7 +37,7 @@ following Phase 6 estimates is [Tax-Calculator
| CY23 Amount | CY26 Amount | Estimate Source |
| ---: | ---: | :--- |
| 2512.3 | 2849.4 | CBO |
| 2507.0 | 3160.8 | Tax-Calculator + phase 6 dataset |
| 2527.0 | 3188.6 | Tax-Calculator + phase 6 dataset |

<br>

Expand All @@ -47,7 +47,7 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| 122.1 | 57.6 | JCT (assumes less than 100% participation) |
| 108.6 | 55.7 | TSY (probably assumes less than 100% participation) |
| 130.2 | 44.7 | Tax-Calculator + phase 6 dataset (100% participation) |
| 129.0 | 43.9 | Tax-Calculator + phase 6 dataset (100% participation) |

<br>

Expand All @@ -57,7 +57,7 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| 71.9 | 78.0 | JCT (assumes less than 100% participation) |
| 63.6 | 71.2 | TSY (probably assumes less than 100% participation) |
| 69.6 | 78.1 | Tax-Calculator + phase 6 dataset (100% participation) |
| 68.3 | 77.1 | Tax-Calculator + phase 6 dataset (100% participation) |

<br>

Expand All @@ -67,7 +67,7 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| 45.9 | 56.4 | JCT |
| 31.4 | 38.4 | TSY |
| 35.9 | 47.7 | Tax-Calculator + phase 6 dataset |
| 35.8 | 47.5 | Tax-Calculator + phase 6 dataset |

<br>

Expand All @@ -77,7 +77,7 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| -56.5 | -53.8 | JCT |
| ---- | ---- | TSY |
| -54.0 | -53.8 | Tax-Calculator + phase 6 dataset |
| -52.5 | -52.1 | Tax-Calculator + phase 6 dataset |

<br>

Expand All @@ -87,7 +87,7 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| 259.3 | 239.8 | JCT |
| 153.9 | 182.4 | TSY |
| 220.9 | 224.8 | Tax-Calculator + phase 6 dataset |
| 219.7 | 222.2 | Tax-Calculator + phase 6 dataset |

<br>

Expand All @@ -97,7 +97,7 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| 56.2 | 0.0 | JCT |
| 50.4 | 0.0 | TSY |
| 58.0 | 0.0 | Tax-Calculator + phase 6 dataset |
| 52.1 | 0.0 | Tax-Calculator + phase 6 dataset |

<br>

Expand All @@ -107,4 +107,4 @@ following Phase 6 estimates is [Tax-Calculator
| ---: | ---: | :--- |
| 21.2 | 151.3 | JCT |
| 26.5 | 149.0 | TSY |
| 21.2 | 165.5 | Tax-Calculator + phase 6 dataset |
| 21.1 | 165.0 | Tax-Calculator + phase 6 dataset |

0 comments on commit 4fba122

Please sign in to comment.