Skip to content

Commit a6c8a97

Browse files
authored
Merge pull request #520 from PSLmodels/use-soi-param
Use `soi_iitax` parameter introduced in Tax-Calculator 6.6.1
2 parents 0b3fe7f + 8b7b690 commit a6c8a97

10 files changed

Lines changed: 25 additions & 14 deletions

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@ For Tax-Calculator results generated when using these TMD input files,
88
see [this
99
folder](https://github.com/PSLmodels/Tax-Calculator/tree/master/taxcalc/cli/input_data_tests).
1010

11-
The **current TMD version is 2.1.0**, which was released on May 22,
11+
The **current TMD version is 2.1.1**, which was released on May 28,
1212
2026, and is the same as TMD version 2.0.0 except that Tax-Calculator
13-
version 6.6.0 (instead of 6.5.3) is used to generate the TMD files.
13+
version 6.6.1 (instead of 6.5.3) is used to generate the TMD files.
1414

15-
The current TMD 2.1.0 version differs from the 2.0.0 version only
15+
The current TMD 2.1.1 version differs from the 2.0.0 version only
1616
slightly in the national weights (all the `WT*` columns in the
1717
`tmd_weights.csv.gz` file and just the `s006` variable in the
1818
`tmd.csv.gz` file); the non-weights input variables in the
1919
`tmd.csv.gz` file and the contents of `tmd_growfactors.csv` file are
20-
unchanged. When using version 2.1.0 to generate **sub-national
20+
unchanged. When using version 2.1.1 to generate **sub-national
2121
weights**, there will be (presumably small) differences from the
2222
sub-national weights generated using version 2.0.0; however, the
23-
sub-national weights fingerprints have not been updated in this pull
24-
request.
23+
sub-national weights fingerprints have not yet been updated.
2524

2625
The prior TMD 2.0.0 version included the following significant
2726
improvements:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
setup(
44
name="tmd",
5-
version="2.1.0",
5+
version="2.1.1",
66
packages=find_packages(),
77
python_requires=">=3.11,<3.14",
88
install_requires=[
9-
"taxcalc==6.6.0",
9+
"taxcalc==6.6.1",
1010
"numpy",
1111
"pandas>=3.0.2",
1212
"clarabel",

tests/test_imputed_variables.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88
import pytest
99
import taxcalc
10-
from tmd.imputation_assumptions import TAXYEAR, CREDIT_CLAIMING
10+
from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING
1111
from tests.conftest import create_tmd_records
1212

1313

@@ -124,6 +124,7 @@ def actual_results(rdf, bdf):
124124
)
125125
# create baseline_sim Calculator object for simyear and get its output
126126
pol = taxcalc.Policy()
127+
pol.implement_reform(SOI_IITAX_SPEC)
127128
pol.implement_reform(CREDIT_CLAIMING)
128129
baseline_sim = taxcalc.Calculator(policy=pol, records=recs)
129130
baseline_sim.advance_to_year(simyear)
@@ -141,6 +142,7 @@ def actual_results(rdf, bdf):
141142
for ded, info in deductions.items():
142143
# create reform Calculator object for simyear
143144
reform_policy = taxcalc.Policy()
145+
reform_policy.implement_reform(SOI_IITAX_SPEC)
144146
reform_policy.implement_reform(CREDIT_CLAIMING)
145147
reform_policy.implement_reform(info["reform_dict"])
146148
reform_sim = taxcalc.Calculator(policy=reform_policy, records=recs)

tests/test_revenue_levels_cbo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import pytest
1919
import taxcalc
2020

21-
from tmd.imputation_assumptions import TAXYEAR, CREDIT_CLAIMING
21+
from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING
2222

2323
# Per-year relative tolerance for all three aggregates.
2424
RELTOL = {
@@ -45,6 +45,7 @@ def test_revenue_levels_cbo(
4545
exp = yaml.safe_load(f)
4646

4747
pol = taxcalc.Policy()
48+
pol.implement_reform(SOI_IITAX_SPEC)
4849
pol.implement_reform(CREDIT_CLAIMING)
4950
rec = taxcalc.Records(
5051
data=tmd_variables,

tests/test_soi_sanity_2022.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import taxcalc
5050

5151
from tmd.storage import STORAGE_FOLDER
52-
from tmd.imputation_assumptions import TAXYEAR, CREDIT_CLAIMING
52+
from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING
5353

5454
SOI_YEAR = 2022
5555
RELATIVE_TOLERANCE = 0.01
@@ -90,6 +90,7 @@ def test_soi_sanity_2022(
9090
# using the post-calc_all arrays keeps one consistent source for
9191
# all five aggregates.
9292
pol = taxcalc.Policy()
93+
pol.implement_reform(SOI_IITAX_SPEC)
9394
pol.implement_reform(CREDIT_CLAIMING)
9495
recs = taxcalc.Records(
9596
data=tmd_variables,

tmd/create_taxcalc_cached_files.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pandas as pd
77
import taxcalc
88
from tmd.storage import STORAGE_FOLDER, CACHED_TAXCALC_VARIABLES
9-
from tmd.imputation_assumptions import TAXYEAR, CREDIT_CLAIMING
9+
from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING
1010

1111
INFILE_PATH = STORAGE_FOLDER / "output" / "tmd.csv.gz"
1212
WTFILE_PATH = STORAGE_FOLDER / "output" / "tmd_weights.csv.gz"
@@ -22,6 +22,7 @@ def create_cached_files():
2222
# Construct Records directly (bypassing tmd_constructor which
2323
# hardcodes start_year=2021 in the taxcalc library).
2424
pol = taxcalc.Policy()
25+
pol.implement_reform(SOI_IITAX_SPEC)
2526
pol.implement_reform(CREDIT_CLAIMING)
2627
rec = taxcalc.Records(
2728
data=pd.read_csv(INFILE_PATH),

tmd/datasets/cps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import taxcalc
1111
from tmd.storage import STORAGE_FOLDER
1212
from tmd.imputation_assumptions import (
13+
SOI_IITAX_SPEC,
1314
CREDIT_CLAIMING,
1415
CPS_FILER_MIN_INCOME,
1516
CPS_TAXABLE_INTEREST_FRACTION,
@@ -357,6 +358,7 @@ def _is_tax_filer(tcdf: pd.DataFrame, taxyear: int) -> pd.Series:
357358
weights_scale=1.0,
358359
)
359360
pol = taxcalc.Policy()
361+
pol.implement_reform(SOI_IITAX_SPEC)
360362
pol.implement_reform(CREDIT_CLAIMING)
361363
calc = taxcalc.Calculator(records=rec, policy=pol)
362364
calc.advance_to_year(taxyear)

tmd/imputation_assumptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,6 @@
7676
2022: "cbo26_population.yaml",
7777
}
7878
POPULATION_FILE = POP_FILE[TAXYEAR]
79+
80+
# Tax-Calculator reform dictionary to produce SOI statistics
81+
SOI_IITAX_SPEC = {"soi_iitax": {2013: True}}

tmd/utils/soi_replication.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import pandas as pd
22
import taxcalc
3-
from tmd.imputation_assumptions import CREDIT_CLAIMING
3+
from tmd.imputation_assumptions import SOI_IITAX_SPEC, CREDIT_CLAIMING
44

55

66
def taxcalc_to_soi(puf: pd.DataFrame, year: int) -> pd.DataFrame:
77
pol = taxcalc.Policy()
8+
pol.implement_reform(SOI_IITAX_SPEC)
89
pol.implement_reform(CREDIT_CLAIMING)
910
rec = taxcalc.Records(
1011
data=puf,

tmd/utils/taxcalc_output.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88
import pandas as pd
99
import taxcalc
10-
from tmd.imputation_assumptions import CREDIT_CLAIMING
10+
from tmd.imputation_assumptions import SOI_IITAX_SPEC, CREDIT_CLAIMING
1111

1212

1313
def add_taxcalc_outputs(
@@ -47,6 +47,7 @@ def add_taxcalc_outputs(
4747
weights_scale=1.0,
4848
)
4949
pol = taxcalc.Policy()
50+
pol.implement_reform(SOI_IITAX_SPEC)
5051
pol.implement_reform(CREDIT_CLAIMING)
5152
if reform:
5253
pol.implement_reform(reform)

0 commit comments

Comments
 (0)