From 3eb17b3ce016323fd0fdca313ab669aa3da02963 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Fri, 12 Jun 2026 16:48:04 -0400 Subject: [PATCH 1/5] Add test of 2022 EITC/ACTC credit results --- tests/expected_taxcalc_results_2022.yaml | 23 ++++++ tests/test_taxcalc_results_2022.py | 95 ++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 tests/expected_taxcalc_results_2022.yaml create mode 100644 tests/test_taxcalc_results_2022.py diff --git a/tests/expected_taxcalc_results_2022.yaml b/tests/expected_taxcalc_results_2022.yaml new file mode 100644 index 00000000..61f7c7c5 --- /dev/null +++ b/tests/expected_taxcalc_results_2022.yaml @@ -0,0 +1,23 @@ +# Expected 2022 EITC and ACTC aggregates from IRS Statistics of Income +# Publication 1304 (2022), Table A. +# +# DATA SOURCE +# Internal Revenue Service, "Statistics of Income — 2022 Individual +# Income Tax Returns," Publication 1304, Table A — "Selected Income +# and Tax Items, by Size and Accumulated Size of Adjusted Gross Income" +# +# DEFINITIONS +# n_returns_mil : Number of returns with a positive credit amount (millions). +# amount_bil : Total credit amount (billions of dollars). +# +# NOTES +# EITC = Earned Income Credit (refundable); taxcalc variable "eitc". +# ACTC = Additional Child Tax Credit (refundable); taxcalc variable "c11070". + +eitc: + n_returns_mil: 24.09 + amount_bil: 60.07 + +actc: + n_returns_mil: 18.08 + amount_bil: 34.84 diff --git a/tests/test_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py new file mode 100644 index 00000000..eafa6f75 --- /dev/null +++ b/tests/test_taxcalc_results_2022.py @@ -0,0 +1,95 @@ +""" +Test that 2022 Tax-Calculator results for EITC and ACTC match +IRS Statistics of Income (SOI) Publication 1304 aggregates. + +Comparisons (all tax units, year 2022): + - Earned Income Credit (EITC): count (millions) and amount (billions) + - Additional Child Tax Credit (ACTC): count (millions) and amount (billions) +""" + +import yaml +import pytest +import taxcalc + +from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING + +OLD_CREDIT_CLAIMING = False +CLAIM_PROB_SCALE = { + "eitc": 1.04, + "actc": 1.57, +} +NEW_CREDIT_CLAIMING = { + "eitc_claim_prob_scale": {"2022": CLAIM_PROB_SCALE["eitc"]}, + "actc_claim_prob_scale": {"2022": CLAIM_PROB_SCALE["actc"]}, +} +MAX_RELATIVE_TOLERANCE = { + "n_returns_mil": 0.07, + "amount_bil": 0.002, +} + + +@pytest.mark.skipif( + TAXYEAR != 2022, + reason="expected values are calibrated to TAXYEAR=2022", +) +def test_taxcalc_results_2022( + tests_folder, tmd_variables, tmd_weights_path, tmd_growfactors_path +): + epath = tests_folder / "expected_taxcalc_results_2022.yaml" + with open(epath, "r", encoding="utf-8") as f: + exp = yaml.safe_load(f) + + pol = taxcalc.Policy() + pol.implement_reform(SOI_IITAX_SPEC) + if OLD_CREDIT_CLAIMING: + pol.implement_reform(CREDIT_CLAIMING) + else: + pol.implement_reform(NEW_CREDIT_CLAIMING) + recs = taxcalc.Records( + data=tmd_variables, + start_year=TAXYEAR, + weights=str(tmd_weights_path), + gfactors=taxcalc.GrowFactors( + growfactors_filename=str(tmd_growfactors_path) + ), + adjust_ratios=None, + exact_calculations=True, + weights_scale=1.0, + ) + sim = taxcalc.Calculator(policy=pol, records=recs) + sim.advance_to_year(TAXYEAR) + sim.calc_all() + + wt = sim.array("s006") + eitc = sim.array("eitc") + actc = sim.array("c11070") + + actual = { + "eitc": { + "n_returns_mil": float((wt * (eitc > 0)).sum() * 1e-6), + "amount_bil": float((wt * eitc).sum() * 1e-9), + }, + "actc": { + "n_returns_mil": float((wt * (actc > 0)).sum() * 1e-6), + "amount_bil": float((wt * actc).sum() * 1e-9), + }, + } + + errors = [] + for credit in ("eitc", "actc"): + for metric in ("n_returns_mil", "amount_bil"): + act = actual[credit][metric] + ex = exp[credit][metric] + rel_diff = act / ex - 1.0 + if abs(rel_diff) >= MAX_RELATIVE_TOLERANCE[metric]: + errors.append( + f"{credit}.{metric}: " + f"act={act:.2f} exp={ex:.2f} " + f"rel_diff={rel_diff:+.4f} " + f"tol={MAX_RELATIVE_TOLERANCE[metric]:.2f}" + ) + + if errors: + raise ValueError( + "\nACT-vs-EXP TAXCALC 2022 DIFFERENCES:\n" + "\n".join(errors) + ) From c1f007b0084d542057469f9728b9d80af344aee6 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Sat, 13 Jun 2026 17:27:49 -0400 Subject: [PATCH 2/5] Cosmetic changes to new test code --- tests/test_taxcalc_results_2022.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py index eafa6f75..7634c95e 100644 --- a/tests/test_taxcalc_results_2022.py +++ b/tests/test_taxcalc_results_2022.py @@ -37,7 +37,7 @@ def test_taxcalc_results_2022( ): epath = tests_folder / "expected_taxcalc_results_2022.yaml" with open(epath, "r", encoding="utf-8") as f: - exp = yaml.safe_load(f) + expect = yaml.safe_load(f) pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) @@ -79,14 +79,14 @@ def test_taxcalc_results_2022( for credit in ("eitc", "actc"): for metric in ("n_returns_mil", "amount_bil"): act = actual[credit][metric] - ex = exp[credit][metric] - rel_diff = act / ex - 1.0 + exp = expect[credit][metric] + rel_diff = act / exp - 1.0 if abs(rel_diff) >= MAX_RELATIVE_TOLERANCE[metric]: errors.append( f"{credit}.{metric}: " - f"act={act:.2f} exp={ex:.2f} " + f"act={act:.2f} exp={exp:.2f} " f"rel_diff={rel_diff:+.4f} " - f"tol={MAX_RELATIVE_TOLERANCE[metric]:.2f}" + f"tol={MAX_RELATIVE_TOLERANCE[metric]:.4f}" ) if errors: From 2eb3a6f09fbacaac9a5e1c57adb1f29ba4442df3 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Thu, 25 Jun 2026 11:21:52 -0400 Subject: [PATCH 3/5] Update README.md and setup.py wrt taxcalc 6.7.0 --- README.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 194ee02d..d8c937c3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ folder](https://github.com/PSLmodels/Tax-Calculator/tree/master/taxcalc/cli/inpu The **current TMD version is 2.1.1**, which was released on May 28, 2026, and is the same as TMD version 2.0.0 except that Tax-Calculator -version 6.6.1 (instead of 6.5.3) is used to generate the TMD files. +version 6.7.0 (instead of 6.5.3) is used to generate the TMD files. The current TMD 2.1.1 version differs from the 2.0.0 version only slightly in the national weights (all the `WT*` columns in the diff --git a/setup.py b/setup.py index 65c02655..dd9b8e49 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ packages=find_packages(), python_requires=">=3.11,<3.14", install_requires=[ - "taxcalc>=6.6.1", + "taxcalc>=6.7.0", "numpy", "pandas>=3.0.2", "clarabel", From 1f2ffc8bc0d3dad5ba5bcd837aece66bd98b52d9 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Thu, 25 Jun 2026 17:13:05 -0400 Subject: [PATCH 4/5] Update logic to use T-C 6.7.0 and update tests accordingly --- README.md | 15 +- tests/expected_tax_exp_2022_data | 8 +- tests/fingerprints/tmd_file_fingerprint.json | 642 +++++++++---------- tests/test_imputed_variables.py | 28 +- tests/test_misc.py | 2 +- tests/test_revenue_levels_cbo.py | 3 +- tests/test_soi_sanity_2022.py | 3 +- tests/test_taxcalc_results_2022.py | 46 +- tests/test_weights.py | 16 +- tmd/create_taxcalc_cached_files.py | 3 +- tmd/datasets/cps.py | 2 - tmd/imputation_assumptions.py | 19 +- tmd/utils/soi_replication.py | 3 +- tmd/utils/taxcalc_output.py | 3 +- 14 files changed, 400 insertions(+), 393 deletions(-) diff --git a/README.md b/README.md index d8c937c3..f39517de 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,18 @@ For Tax-Calculator results generated when using these TMD input files, see [this folder](https://github.com/PSLmodels/Tax-Calculator/tree/master/taxcalc/cli/input_data_tests). -The **current TMD version is 2.1.1**, which was released on May 28, -2026, and is the same as TMD version 2.0.0 except that Tax-Calculator -version 6.7.0 (instead of 6.5.3) is used to generate the TMD files. +The **current TMD version is 2.1.2**, which was released on June 29, +2026, and is the same as TMD version 2.1.1 except that Tax-Calculator +version 6.7.0 (instead of 6.6.2) is used to generate the TMD files. -The current TMD 2.1.1 version differs from the 2.0.0 version only +The current TMD 2.1.2 version differs from the prior 2.1.1 version +only slightly because of the use in Tax-Calculator 6.7.0 of EITC and +ACTC credit claiming logic that reduces slightly the number of tax +units added to PUF records from the CPS. See Tax-Calculator PR 3084 +for details on the tiny changes in income and payroll tax revenue +associated with the TMD 2.1.2 input data files. + +The older TMD 2.1.1 version differed from the 2.0.0 version only slightly in the national weights (all the `WT*` columns in the `tmd_weights.csv.gz` file and just the `s006` variable in the `tmd.csv.gz` file); the non-weights input variables in the diff --git a/tests/expected_tax_exp_2022_data b/tests/expected_tax_exp_2022_data index ce5d3845..c2440fb6 100644 --- a/tests/expected_tax_exp_2022_data +++ b/tests/expected_tax_exp_2022_data @@ -1,8 +1,8 @@ -YR,KIND,EST= 2023 paytax 1429.5 +YR,KIND,EST= 2023 paytax 1428.7 YR,KIND,EST= 2023 iitax 2332.1 -YR,KIND,EST= 2023 ctc 118.6 -YR,KIND,EST= 2023 eitc 72.0 -YR,KIND,EST= 2023 social_security_partial_taxability 46.8 +YR,KIND,EST= 2023 ctc 129.6 +YR,KIND,EST= 2023 eitc 66.4 +YR,KIND,EST= 2023 social_security_partial_taxability 47.3 YR,KIND,EST= 2023 niit -47.4 YR,KIND,EST= 2023 cgqd_tax_preference 179.8 YR,KIND,EST= 2023 qbid 55.0 diff --git a/tests/fingerprints/tmd_file_fingerprint.json b/tests/fingerprints/tmd_file_fingerprint.json index e7418e9b..89454f43 100644 --- a/tests/fingerprints/tmd_file_fingerprint.json +++ b/tests/fingerprints/tmd_file_fingerprint.json @@ -1,7 +1,7 @@ { "columns": { "DSI": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -9,31 +9,31 @@ "weighted_sum": 0.0 }, "EIC": { - "count": 215494, + "count": 215263, "max": 3.0, "min": 0.0, - "std": 0.998488924709226, - "sum": 142306.0, - "weighted_sum": 85531549.58765 + "std": 0.9990522449170486, + "sum": 142409.0, + "weighted_sum": 85842831.63041 }, "FLPDYR": { - "count": 215494, + "count": 215263, "max": 2022.0, "min": 2022.0, "std": 0.0, - "sum": 435728868.0, - "weighted_sum": 383705536579.71094 + "sum": 435261786.0, + "weighted_sum": 381949517980.641 }, "MARS": { - "count": 215494, + "count": 215263, "max": 5.0, "min": 1.0, - "std": 0.8278563562706401, - "sum": 402557.0, - "weighted_sum": 327117996.02616006 + "std": 0.8282611327494847, + "sum": 402434.0, + "weighted_sum": 326604620.75883996 }, "MIDR": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -41,7 +41,7 @@ "weighted_sum": 0.0 }, "PT_SSTB_income": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -49,15 +49,15 @@ "weighted_sum": 0.0 }, "PT_binc_w2_wages": { - "count": 215494, + "count": 215263, "max": 31313015.0, "min": 0.0, - "std": 737875.8545888758, + "std": 738261.6842397425, "sum": 25230744106.0, - "weighted_sum": 284545997715.11224 + "weighted_sum": 284545792851.1907 }, "PT_ubia_property": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -65,23 +65,23 @@ "weighted_sum": 0.0 }, "RECID": { - "count": 215494, - "max": 215537.0, + "count": 215263, + "max": 215306.0, "min": 1.0, - "std": 62208.9556096498, - "sum": 23219092055.0, - "weighted_sum": 17877880700117.836 + "std": 62142.23707159986, + "sum": 23169334842.0, + "weighted_sum": 17691229038089.715 }, "XTOT": { - "count": 215494, + "count": 215263, "max": 8.0, "min": 0.0, - "std": 1.3123191488632904, - "sum": 487365.0, - "weighted_sum": 333976651.56875 + "std": 1.3125370309507325, + "sum": 487234.0, + "weighted_sum": 333414264.92786 }, "a_lineno": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -89,23 +89,23 @@ "weighted_sum": 0.0 }, "age_head": { - "count": 215494, + "count": 215263, "max": 85.0, "min": 0.0, - "std": 16.087658679363, - "sum": 10432172.0, - "weighted_sum": 8643817897.237759 + "std": 16.08999448715726, + "sum": 10422317.0, + "weighted_sum": 8608158168.14693 }, "age_spouse": { - "count": 215494, + "count": 215263, "max": 85.0, "min": 0.0, - "std": 27.91597418922191, - "sum": 6305893.0, - "weighted_sum": 2891068727.6686 + "std": 27.914569970219738, + "sum": 6305260.0, + "weighted_sum": 2888605312.55906 }, "agi_bin": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -113,31 +113,31 @@ "weighted_sum": 0.0 }, "auto_loan_interest": { - "count": 215494, + "count": 215263, "max": 29216.0, "min": 0.0, - "std": 1588.179244169335, - "sum": 118970180.0, - "weighted_sum": 93389910579.22197 + "std": 1590.3307588349192, + "sum": 119012560.0, + "weighted_sum": 93066133936.896 }, "blind_head": { - "count": 215494, + "count": 215263, "max": 1.0, "min": 0.0, - "std": 0.03968980710581373, - "sum": 340.0, - "weighted_sum": 1128485.4318900001 + "std": 0.03912362897895282, + "sum": 330.0, + "weighted_sum": 1086940.10908 }, "blind_spouse": { - "count": 215494, + "count": 215263, "max": 1.0, "min": 0.0, - "std": 0.005699337491585952, - "sum": 7.0, - "weighted_sum": 22359.33323 + "std": 0.005279403771530755, + "sum": 6.0, + "weighted_sum": 18412.565179999998 }, "cmbtp": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -145,495 +145,495 @@ "weighted_sum": 0.0 }, "data_source": { - "count": 215494, + "count": 215263, "max": 1.0, "min": 0.0, - "std": 0.18680034526742112, + "std": 0.1842116611264962, "sum": 207692.0, - "weighted_sum": 162125804.1785 + "weighted_sum": 162125458.43592998 }, "e00200": { - "count": 215494, + "count": 215263, "max": 158001246.0, "min": 0.0, - "std": 3838289.3639592775, - "sum": 135569085547.0, - "weighted_sum": 9729692790533.416 + "std": 3840293.8912365986, + "sum": 135567779689.0, + "weighted_sum": 9724848774601.408 }, "e00200p": { - "count": 215494, + "count": 215263, "max": 146649912.0, "min": 0.0, - "std": 3074309.944469237, - "sum": 100917700743.0, - "weighted_sum": 7582292918196.261 + "std": 3075921.6368921595, + "sum": 100916418227.0, + "weighted_sum": 7577473265786.027 }, "e00200s": { - "count": 215494, + "count": 215263, "max": 131089978.0, "min": 0.0, - "std": 1407594.8945087728, - "sum": 34651384804.0, - "weighted_sum": 2147399872337.153 + "std": 1408340.0919694335, + "sum": 34651361462.0, + "weighted_sum": 2147375508815.3809 }, "e00300": { - "count": 215494, + "count": 215263, "max": 61918081.0, "min": 0.0, - "std": 711371.8545826309, - "sum": 14959491444.0, - "weighted_sum": 134805822500.00314 + "std": 711749.8061061059, + "sum": 14959487127.0, + "weighted_sum": 134788390977.56313 }, "e00400": { - "count": 215494, + "count": 215263, "max": 11301339.0, "min": 0.0, - "std": 177842.6371643936, - "sum": 4044710003.0, - "weighted_sum": 56406304151.29176 + "std": 177936.97109938125, + "sum": 4044707987.0, + "weighted_sum": 56398161435.59416 }, "e00600": { - "count": 215494, + "count": 215263, "max": 185467468.0, "min": 0.0, - "std": 1955792.2795310856, - "sum": 41042235014.0, - "weighted_sum": 412887295610.6207 + "std": 1956831.4276827134, + "sum": 41042234815.0, + "weighted_sum": 412886712046.8446 }, "e00650": { - "count": 215494, + "count": 215263, "max": 180321892.0, "min": 0.0, - "std": 1769608.566097811, - "sum": 32307238293.0, - "weighted_sum": 312649853345.97015 + "std": 1770550.981608778, + "sum": 32307238205.0, + "weighted_sum": 312649621183.61835 }, "e00700": { - "count": 215494, + "count": 215263, "max": 7423763.0, "min": 0.0, - "std": 122139.07168429166, + "std": 122203.70744853604, "sum": 3050450092.0, - "weighted_sum": 45119129442.574776 + "weighted_sum": 45119021348.956635 }, "e00800": { - "count": 215494, + "count": 215263, "max": 460766.0, "min": 0.0, - "std": 3179.6374471537642, + "std": 3181.3424030399624, "sum": 13169293.0, - "weighted_sum": 16700874386.651384 + "weighted_sum": 16700075905.518679 }, "e00900": { - "count": 215494, + "count": 215263, "max": 26763122.0, "min": -50236735.0, - "std": 593859.8539200913, + "std": 594177.7388914728, "sum": 5852882933.0, - "weighted_sum": 411465033628.61115 + "weighted_sum": 411465040309.20984 }, "e00900p": { - "count": 215494, + "count": 215263, "max": 26763122.0, "min": -43918428.0, - "std": 506638.36885149596, + "std": 506909.676041499, "sum": 4481330664.0, - "weighted_sum": 315389892675.4016 + "weighted_sum": 315388176010.78754 }, "e00900s": { - "count": 215494, + "count": 215263, "max": 18599368.0, "min": -33603257.0, - "std": 198752.70687436213, + "std": 198859.21021614163, "sum": 1371552269.0, - "weighted_sum": 96075140953.20947 + "weighted_sum": 96076864298.42224 }, "e01100": { - "count": 215494, + "count": 215263, "max": 3199159.0, "min": 0.0, - "std": 9337.921477961652, + "std": 9342.928475804247, "sum": 39668789.0, - "weighted_sum": 12797168638.40104 + "weighted_sum": 12797168594.90506 }, "e01200": { - "count": 215494, + "count": 215263, "max": 62352563.0, "min": -35655204.0, - "std": 581069.2229320295, + "std": 581380.667206065, "sum": 3520229342.0, - "weighted_sum": -44828811385.52922 + "weighted_sum": -44829382940.435776 }, "e01400": { - "count": 215494, + "count": 215263, "max": 7902154.0, "min": 0.0, - "std": 83296.2293973766, + "std": 83340.38518768597, "sum": 1945050082.0, - "weighted_sum": 440177356532.94904 + "weighted_sum": 440177356149.54266 }, "e01500": { - "count": 215494, + "count": 215263, "max": 27560876.0, "min": 0.0, - "std": 321211.9499791954, + "std": 321380.42390871514, "sum": 10311950944.0, - "weighted_sum": 1535732120017.0256 + "weighted_sum": 1535732120273.3408 }, "e01700": { - "count": 215494, + "count": 215263, "max": 4930050.0, "min": 0.0, - "std": 56062.81195281425, + "std": 56091.90206779826, "sum": 2182787272.0, - "weighted_sum": 915290496211.8649 + "weighted_sum": 915300137496.7947 }, "e02000": { - "count": 215494, + "count": 215263, "max": 201882312.0, "min": -179684656.0, - "std": 5276792.171763604, - "sum": 133913067850.0, - "weighted_sum": 1147033652281.531 + "std": 5279583.404217985, + "sum": 133913066948.0, + "weighted_sum": 1147041620343.9429 }, "e02100": { - "count": 215494, + "count": 215263, "max": 18904982.0, "min": -2500.0, - "std": 136964.3476399141, + "std": 137037.78194226447, "sum": 640434462.0, - "weighted_sum": 7384956507.26925 + "weighted_sum": 7385115964.77298 }, "e02100p": { - "count": 215494, + "count": 215263, "max": 14541252.0, "min": -2500.0, - "std": 102235.67378073317, + "std": 102290.48923280336, "sum": 467305339.0, - "weighted_sum": 5708935350.404577 + "weighted_sum": 5709050675.52921 }, "e02100s": { - "count": 215494, + "count": 215263, "max": 15334893.0, "min": 0.0, - "std": 61962.45767993599, + "std": 61995.689313434865, "sum": 173129123.0, - "weighted_sum": 1676021156.86467 + "weighted_sum": 1676065289.24377 }, "e02300": { - "count": 215494, + "count": 215263, "max": 31090.0, "min": 0.0, - "std": 1023.5009754348871, - "sum": 26629681.0, - "weighted_sum": 30619777466.657185 + "std": 1023.9686516221718, + "sum": 26613547.0, + "weighted_sum": 30552379632.13115 }, "e02400": { - "count": 215494, + "count": 215263, "max": 194473.0, "min": 0.0, - "std": 16831.347608656735, - "sum": 1569139076.0, - "weighted_sum": 903437296810.8677 + "std": 16838.695581499003, + "sum": 1569132769.0, + "weighted_sum": 903421676019.725 }, "e03150": { - "count": 215494, + "count": 215263, "max": 17617.0, "min": 0.0, - "std": 1827.6895099426192, + "std": 1828.6511158990063, "sum": 54493998.0, - "weighted_sum": 20428628316.86713 + "weighted_sum": 20428125726.646908 }, "e03210": { - "count": 215494, + "count": 215263, "max": 3387.0, "min": 0.0, - "std": 390.7127707576394, + "std": 390.91662740495127, "sum": 13910295.0, - "weighted_sum": 20143529035.477135 + "weighted_sum": 20142836984.79663 }, "e03220": { - "count": 215494, + "count": 215263, "max": 677.0, "min": 0.0, - "std": 48.09177439447757, + "std": 48.117125885099846, "sum": 1361161.0, - "weighted_sum": 1356093853.21345 + "weighted_sum": 1356073271.76232 }, "e03230": { - "count": 215494, + "count": 215263, "max": 5420.0, "min": 0.0, - "std": 307.1340170659197, + "std": 307.29797943813094, "sum": 4572915.0, - "weighted_sum": 5546603083.37946 + "weighted_sum": 5548495926.39693 }, "e03240": { - "count": 215494, + "count": 215263, "max": 10247991.0, "min": 0.0, - "std": 182400.83219234663, + "std": 182498.07830734923, "sum": 3064867345.0, - "weighted_sum": 18679121586.447872 + "weighted_sum": 18678170581.49975 }, "e03270": { - "count": 215494, + "count": 215263, "max": 118444.0, "min": 0.0, - "std": 7473.512375212274, + "std": 7477.134466518801, "sum": 500028611.0, - "weighted_sum": 42722294934.9787 + "weighted_sum": 42720018781.00539 }, "e03290": { - "count": 215494, + "count": 215263, "max": 13551.0, "min": 0.0, - "std": 1368.2646734011444, + "std": 1368.978364903597, "sum": 48966082.0, - "weighted_sum": 6495107439.895511 + "weighted_sum": 6495408671.79486 }, "e03300": { - "count": 215494, + "count": 215263, "max": 948637.0, "min": 0.0, - "std": 23847.615526769452, + "std": 23860.086871990607, "sum": 813401582.0, - "weighted_sum": 32703657761.964504 + "weighted_sum": 32703384508.282963 }, "e03400": { - "count": 215494, + "count": 215263, "max": 69386.0, "min": 0.0, - "std": 223.64246796075335, + "std": 223.76240734081014, "sum": 688077.0, - "weighted_sum": 104027001.98055004 + "weighted_sum": 104022550.15768 }, "e03500": { - "count": 215494, + "count": 215263, "max": 184984.0, "min": 0.0, - "std": 1841.662414259818, + "std": 1842.6489129347235, "sum": 14858202.0, - "weighted_sum": 10409595764.023422 + "weighted_sum": 10409757705.857029 }, "e07240": { - "count": 215494, + "count": 215263, "max": 2710.0, "min": 0.0, - "std": 59.24132562097543, + "std": 59.2726681626945, "sum": 1493106.0, - "weighted_sum": 2091563592.0978901 + "weighted_sum": 2091676730.96414 }, "e07260": { - "count": 215494, + "count": 215263, "max": 1764465.0, "min": 0.0, - "std": 4935.572680554544, + "std": 4938.218623898937, "sum": 25664046.0, - "weighted_sum": 3151231819.4448 + "weighted_sum": 3151264753.10441 }, "e07300": { - "count": 215494, + "count": 215263, "max": 23024778.0, "min": 0.0, - "std": 331846.5952684108, + "std": 332023.9075898654, "sum": 4460805245.0, - "weighted_sum": 32587502156.164803 + "weighted_sum": 32587553042.594288 }, "e07400": { - "count": 215494, + "count": 215263, "max": 7856070.0, "min": 0.0, - "std": 71614.69238332358, + "std": 71653.00611994107, "sum": 791134935.0, - "weighted_sum": 5230793411.126049 + "weighted_sum": 5230783487.01236 }, "e07600": { - "count": 215494, + "count": 215263, "max": 1939285.0, "min": 0.0, - "std": 15155.787254384139, + "std": 15163.90874627349, "sum": 103747781.0, - "weighted_sum": 1246854202.1260395 + "weighted_sum": 1246857035.87849 }, "e09700": { - "count": 215494, + "count": 215263, "max": 6803.0, "min": 0.0, - "std": 16.651061279216545, + "std": 16.659992956870532, "sum": 12182.0, - "weighted_sum": 10162844.90742 + "weighted_sum": 10162979.77321 }, "e09800": { - "count": 215494, + "count": 215263, "max": 8578.0, "min": 0.0, - "std": 19.96441836745499, + "std": 19.975127031102094, "sum": 27311.0, - "weighted_sum": 19609584.83888 + "weighted_sum": 19608900.87356 }, "e09900": { - "count": 215494, + "count": 215263, "max": 267244.0, "min": 0.0, - "std": 1671.5709903762297, + "std": 1672.4643342011066, "sum": 21850771.0, - "weighted_sum": 8010111200.159989 + "weighted_sum": 8009679603.22553 }, "e11200": { - "count": 215494, + "count": 215263, "max": 63152.0, "min": 0.0, - "std": 1601.9242793125295, + "std": 1602.7618855706544, "sum": 54810849.0, - "weighted_sum": 4749560769.048221 + "weighted_sum": 4749580536.74043 }, "e17500": { - "count": 215494, + "count": 215263, "max": 792248.0, "min": 0.0, - "std": 10990.025327581932, + "std": 10995.852672300547, "sum": 253887516.0, - "weighted_sum": 170528913909.55905 + "weighted_sum": 170531953065.0965 }, "e18400": { - "count": 215494, + "count": 215263, "max": 47954731.0, "min": 0.0, - "std": 1028436.4769234683, + "std": 1028970.3288677885, "sum": 39805235783.0, - "weighted_sum": 527918889593.0678 + "weighted_sum": 527919599081.719 }, "e18500": { - "count": 215494, + "count": 215263, "max": 1781924.0, "min": 0.0, - "std": 48497.23595172148, + "std": 48520.6557110246, "sum": 3299136260.0, - "weighted_sum": 285652168369.64087 + "weighted_sum": 285657352339.5913 }, "e19200": { - "count": 215494, + "count": 215263, "max": 20871618.0, "min": 0.0, - "std": 222088.77233248777, + "std": 222206.77528640185, "sum": 4654041060.0, - "weighted_sum": 377539697396.4865 + "weighted_sum": 377541565234.79803 }, "e19800": { - "count": 215494, + "count": 215263, "max": 65015608.0, "min": 0.0, - "std": 682374.0355993224, + "std": 682737.4953102127, "sum": 12321188081.0, - "weighted_sum": 199380092052.27438 + "weighted_sum": 199380033760.28302 }, "e20100": { - "count": 215494, + "count": 215263, "max": 133879803.0, "min": 0.0, - "std": 1111436.3147192635, + "std": 1112030.431455647, "sum": 14099697665.0, - "weighted_sum": 91118775709.33383 + "weighted_sum": 91120148422.50049 }, "e20400": { - "count": 215494, + "count": 215263, "max": 19975587.0, "min": 0.0, - "std": 321238.61659574416, + "std": 321408.37093523215, "sum": 8435836745.0, - "weighted_sum": 232786574131.2084 + "weighted_sum": 232785046616.83865 }, "e24515": { - "count": 215494, + "count": 215263, "max": 35072470.0, "min": 0.0, - "std": 387541.73958224, + "std": 387749.01036315947, "sum": 4522551372.0, - "weighted_sum": 49147051362.724846 + "weighted_sum": 49147520478.16959 }, "e24518": { - "count": 215494, + "count": 215263, "max": 30708739.0, "min": 0.0, - "std": 271447.34343111835, + "std": 271592.82799525035, "sum": 1694322554.0, - "weighted_sum": 8396049641.8932 + "weighted_sum": 8396106579.95237 }, "e26270": { - "count": 215494, + "count": 215263, "max": 202019457.0, "min": -179393560.0, - "std": 5143545.889829284, + "std": 5146270.868466898, "sum": 123113181769.0, - "weighted_sum": 1032383271061.1552 + "weighted_sum": 1032383256312.2002 }, "e27200": { - "count": 215494, + "count": 215263, "max": 1924378.0, "min": -788181.0, - "std": 10923.40714025841, + "std": 10929.264720933907, "sum": 41631327.0, - "weighted_sum": 5696208823.678238 + "weighted_sum": 5697297471.0816 }, "e32800": { - "count": 215494, + "count": 215263, "max": 8131.0, "min": 0.0, - "std": 991.5737233513782, + "std": 992.0882211868671, "sum": 38622412.0, - "weighted_sum": 24873073295.794853 + "weighted_sum": 24873019041.95161 }, "e58990": { - "count": 215494, + "count": 215263, "max": 23986967.0, "min": 0.0, - "std": 145964.00334035023, + "std": 146042.2346788064, "sum": 906483448.0, - "weighted_sum": 5986557718.189501 + "weighted_sum": 5986550407.47603 }, "e62900": { - "count": 215494, + "count": 215263, "max": 27117470.0, "min": 0.0, - "std": 293671.35677486146, + "std": 293828.27580298897, "sum": 3933115700.0, - "weighted_sum": 27963256148.689045 + "weighted_sum": 27963352412.3448 }, "e87521": { - "count": 215494, + "count": 215263, "max": 19921.0, "min": 0.0, - "std": 669.6208141520913, + "std": 669.9682567774909, "sum": 26086045.0, - "weighted_sum": 30558842511.86818 + "weighted_sum": 30558969878.93075 }, "e87530": { - "count": 215494, + "count": 215263, "max": 5420.0, "min": 0.0, - "std": 307.1340170659197, + "std": 307.29797943813094, "sum": 4572915.0, - "weighted_sum": 5546603083.37946 + "weighted_sum": 5548495926.39693 }, "elderly_dependents": { - "count": 215494, + "count": 215263, "max": 2.0, "min": 0.0, - "std": 0.014449314952718903, - "sum": 43.0, - "weighted_sum": 145640.1216 + "std": 0.014295560847518414, + "sum": 42.0, + "weighted_sum": 141328.70931 }, "f2441": { - "count": 215494, + "count": 215263, "max": 6.0, "min": 0.0, - "std": 0.8664338180894957, - "sum": 106241.0, - "weighted_sum": 59733822.511510015 + "std": 0.867104615591422, + "sum": 106330.0, + "weighted_sum": 60015911.89032 }, "f6251": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -641,7 +641,7 @@ "weighted_sum": 0.0 }, "ffpos": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -649,7 +649,7 @@ "weighted_sum": 0.0 }, "fips": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -657,15 +657,15 @@ "weighted_sum": 0.0 }, "g20500": { - "count": 215494, + "count": 215263, "max": 1881011.0, "min": 0.0, - "std": 6941.139303463316, + "std": 6944.862269028169, "sum": 13962177.0, - "weighted_sum": 2535688446.4736805 + "weighted_sum": 2535861913.11921 }, "h_seq": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -673,7 +673,7 @@ "weighted_sum": 0.0 }, "housing_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -681,7 +681,7 @@ "weighted_sum": 0.0 }, "k1bx14p": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -689,7 +689,7 @@ "weighted_sum": 0.0 }, "k1bx14s": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -697,7 +697,7 @@ "weighted_sum": 0.0 }, "mcaid_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -705,7 +705,7 @@ "weighted_sum": 0.0 }, "mcare_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -713,55 +713,55 @@ "weighted_sum": 0.0 }, "n1820": { - "count": 215494, + "count": 215263, "max": 3.0, "min": 0.0, - "std": 0.20452203627374832, - "sum": 8747.0, - "weighted_sum": 5864275.79037 + "std": 0.20466912830302125, + "sum": 8751.0, + "weighted_sum": 5887921.68742 }, "n21": { - "count": 215494, + "count": 215263, "max": 3.0, "min": 0.0, - "std": 0.26523706672634395, - "sum": 13308.0, - "weighted_sum": 11545428.449310001 + "std": 0.2653387742258639, + "sum": 13306.0, + "weighted_sum": 11544691.87813 }, "n24": { - "count": 215494, + "count": 215263, "max": 7.0, "min": 0.0, - "std": 0.959182307062835, - "sum": 129473.0, - "weighted_sum": 76365306.90682001 + "std": 0.9598705242211005, + "sum": 129575.0, + "weighted_sum": 76673136.66415 }, "nu06": { - "count": 215494, + "count": 215263, "max": 4.0, "min": 0.0, - "std": 0.7409575899032155, - "sum": 69899.0, - "weighted_sum": 32601178.87357 + "std": 0.7414104531374943, + "sum": 69939.0, + "weighted_sum": 32731747.157709997 }, "nu13": { - "count": 215494, + "count": 215263, "max": 6.0, "min": 0.0, - "std": 0.8872075788025847, - "sum": 107919.0, - "weighted_sum": 61067464.6771 + "std": 0.8878763850576914, + "sum": 108008.0, + "weighted_sum": 61349557.32932 }, "nu18": { - "count": 215494, + "count": 215263, "max": 7.0, "min": 0.0, - "std": 0.9785226575847404, - "sum": 134984.0, - "weighted_sum": 79834027.10920005 + "std": 0.9792592759933887, + "sum": 135094.0, + "weighted_sum": 80160972.10339001 }, "other_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -769,63 +769,63 @@ "weighted_sum": 0.0 }, "overtime_income": { - "count": 215494, - "max": 68080116.0, + "count": 215263, + "max": 37043223.0, "min": 0.0, - "std": 286623.9497078295, - "sum": 2451145686.0, - "weighted_sum": 253142686412.84302 + "std": 250777.68280246307, + "sum": 2452571139.0, + "weighted_sum": 256000911399.33527 }, "p08000": { - "count": 215494, + "count": 215263, "max": 73858.0, "min": 0.0, - "std": 622.1213406287744, + "std": 622.4541195619302, "sum": 7084352.0, - "weighted_sum": 1032796363.63721 + "weighted_sum": 1032781389.35306 }, "p22250": { - "count": 215494, + "count": 215263, "max": 94633330.0, "min": -127307103.0, - "std": 1321095.515814732, + "std": 1321804.1397294358, "sum": -1646866639.0, - "weighted_sum": -106928862011.1797 + "weighted_sum": -106927518053.39359 }, "p23250": { - "count": 215494, + "count": 215263, "max": 250575723.0, "min": -42756430.0, - "std": 7029999.772467691, + "std": 7033683.352090717, "sum": 230507613477.0, - "weighted_sum": 1126417211741.7278 + "weighted_sum": 1126416780605.8538 }, "pencon_p": { - "count": 215494, + "count": 215263, "max": 27000.0, "min": 0.0, - "std": 6385.947064268348, + "std": 6388.508436128142, "sum": 690867044.0, - "weighted_sum": 263781936682.88354 + "weighted_sum": 263780602105.06427 }, "pencon_s": { - "count": 215494, + "count": 215263, "max": 27000.0, "min": 0.0, - "std": 4874.62501641623, + "std": 4876.904491683914, "sum": 376013951.0, - "weighted_sum": 76617720814.66776 + "weighted_sum": 76618038189.04086 }, "s006": { - "count": 215494, - "max": 16580.29984, + "count": 215263, + "max": 16580.29985, "min": 0.10804, - "std": 1092.9933025486473, - "sum": 189765349.44595, - "weighted_sum": 424545077258.6477 + "std": 1087.7497848690116, + "sum": 188896893.1655, + "weighted_sum": 420459286479.369 }, "snap_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -833,7 +833,7 @@ "weighted_sum": 0.0 }, "ssi_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -841,7 +841,7 @@ "weighted_sum": 0.0 }, "tanf_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -849,15 +849,15 @@ "weighted_sum": 0.0 }, "tip_income": { - "count": 215494, - "max": 24144116.0, + "count": 215263, + "max": 44833750.0, "min": 0.0, - "std": 103060.21598597325, - "sum": 454325261.0, - "weighted_sum": 65982037358.30429 + "std": 150849.59670479523, + "sum": 482594436.0, + "weighted_sum": 66195938435.70477 }, "vet_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -865,7 +865,7 @@ "weighted_sum": 0.0 }, "wic_ben": { - "count": 215494, + "count": 215263, "max": 0.0, "min": 0.0, "std": 0.0, @@ -874,11 +874,11 @@ } }, "metadata": { - "generated": "2026-04-24", + "generated": "2026-06-25", "n_columns": 109, - "n_records": 215494, + "n_records": 215263, "scope": "tmd_file", - "taxcalc_version": "6.5.2", + "taxcalc_version": "6.7.0", "taxyear": 2022 } -} +} \ No newline at end of file diff --git a/tests/test_imputed_variables.py b/tests/test_imputed_variables.py index 4aa2a2f5..10266de6 100644 --- a/tests/test_imputed_variables.py +++ b/tests/test_imputed_variables.py @@ -7,7 +7,7 @@ import numpy as np import pytest import taxcalc -from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC from tests.conftest import create_tmd_records @@ -55,9 +55,9 @@ def actual_results(rdf, bdf): # https://taxpolicycenter.org/taxvox/ # budget-laws-tax-cuts-overtime-and- # tips-are-popular-few-will-benefit - "exp_totben_2022": 23.71, - "exp_affpct_2022": 8.56, - "exp_affben_2022": 1413, + "exp_totben_2022": 24.20, + "exp_affpct_2022": 8.92, + "exp_affben_2022": 1391, }, "TIP": { # new OBBBA tip income deduction "reform_dict": {"TipIncomeDed_c": {simyear: 0}}, @@ -72,9 +72,9 @@ def actual_results(rdf, bdf): # https://taxpolicycenter.org/taxvox/ # budget-laws-tax-cuts-overtime-and- # tips-are-popular-few-will-benefit - "exp_totben_2022": 7.11, - "exp_affpct_2022": 2.59, - "exp_affben_2022": 1401, + "exp_totben_2022": 7.17, + "exp_affpct_2022": 2.68, + "exp_affben_2022": 1371, }, "ALI": { # new OBBBA auto loan interest deduction "reform_dict": {"AutoLoanInterestDed_c": {simyear: 0}}, @@ -87,9 +87,9 @@ def actual_results(rdf, bdf): # because the Tax Policy Center did not provide any # statistics for this new deduction. However, see the # following reform analysis for FOUR reforms. - "exp_totben_2022": 7.87, - "exp_affpct_2022": 12.28, - "exp_affben_2022": 327, + "exp_totben_2022": 8.01, + "exp_affpct_2022": 12.88, + "exp_affben_2022": 319, }, "ALL": { # above three deductions plus new OBBBA senior deduction "reform_dict": { @@ -107,9 +107,9 @@ def actual_results(rdf, bdf): # https://taxpolicycenter.org/model-estimates/T25-0257 # Note that the $1081 TPC estimate is derived by dividing # the all-unit average of $320 by the 0.296 affpct. - "exp_totben_2022": 58.97, - "exp_affpct_2022": 28.24, - "exp_affben_2022": 1065, + "exp_totben_2022": 59.72, + "exp_affpct_2022": 29.26, + "exp_affben_2022": 1047, }, } output_variables = [ @@ -125,7 +125,6 @@ def actual_results(rdf, bdf): # create baseline_sim Calculator object for simyear and get its output pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) baseline_sim = taxcalc.Calculator(policy=pol, records=recs) baseline_sim.advance_to_year(simyear) baseline_sim.calc_all() @@ -143,7 +142,6 @@ def actual_results(rdf, bdf): # create reform Calculator object for simyear reform_policy = taxcalc.Policy() reform_policy.implement_reform(SOI_IITAX_SPEC) - reform_policy.implement_reform(CREDIT_CLAIMING) reform_policy.implement_reform(info["reform_dict"]) reform_sim = taxcalc.Calculator(policy=reform_policy, records=recs) reform_sim.advance_to_year(simyear) diff --git a/tests/test_misc.py b/tests/test_misc.py index 651c3a3b..afaeb92c 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -24,7 +24,7 @@ def test_population(tmd_variables): # to December 1, 2026 (NA-EST2025-POP)" table which is at this URL: # https://www.census.gov/data/tables/time-series/demo/popest/ # 2020s-national-total.html - r_tol = 0.001 + r_tol = 0.002 assert abs(pop / exp_pop[TAXYEAR] - 1) < r_tol, ( f"{TAXYEAR} population ({pop:.2f}) not within {(r_tol * 100):.1f}% " f"of expected {exp_pop[TAXYEAR]:.2f} million" diff --git a/tests/test_revenue_levels_cbo.py b/tests/test_revenue_levels_cbo.py index bca39bf5..a9886018 100644 --- a/tests/test_revenue_levels_cbo.py +++ b/tests/test_revenue_levels_cbo.py @@ -18,7 +18,7 @@ import pytest import taxcalc -from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC # Per-year relative tolerance for all three aggregates. RELTOL = { @@ -46,7 +46,6 @@ def test_revenue_levels_cbo( pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) rec = taxcalc.Records( data=tmd_variables, start_year=TAXYEAR, diff --git a/tests/test_soi_sanity_2022.py b/tests/test_soi_sanity_2022.py index 74c971c7..d076c7a2 100644 --- a/tests/test_soi_sanity_2022.py +++ b/tests/test_soi_sanity_2022.py @@ -49,7 +49,7 @@ import taxcalc from tmd.storage import STORAGE_FOLDER -from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC SOI_YEAR = 2022 RELATIVE_TOLERANCE = 0.01 @@ -91,7 +91,6 @@ def test_soi_sanity_2022( # all five aggregates. pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) recs = taxcalc.Records( data=tmd_variables, start_year=TAXYEAR, diff --git a/tests/test_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py index 7634c95e..1d3d810a 100644 --- a/tests/test_taxcalc_results_2022.py +++ b/tests/test_taxcalc_results_2022.py @@ -11,23 +11,41 @@ import pytest import taxcalc -from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import ( + TAXYEAR, + SOI_IITAX_SPEC, + CLAIM_PROB_SCALE_EXPECTED, +) -OLD_CREDIT_CLAIMING = False -CLAIM_PROB_SCALE = { - "eitc": 1.04, - "actc": 1.57, -} -NEW_CREDIT_CLAIMING = { - "eitc_claim_prob_scale": {"2022": CLAIM_PROB_SCALE["eitc"]}, - "actc_claim_prob_scale": {"2022": CLAIM_PROB_SCALE["actc"]}, -} MAX_RELATIVE_TOLERANCE = { - "n_returns_mil": 0.07, - "amount_bil": 0.002, + "n_returns_mil": 0.088, + "amount_bil": 0.003, } +def test_claim_prob_scale_defaults_unchanged(): + """Guard: Tax-Calculator defaults still equal the calibrated values. + + TMD's TAXYEAR EITC/ACTC calibration assumes the Tax-Calculator + eitc_claim_prob_scale/actc_claim_prob_scale defaults equal the values in + CLAIM_PROB_SCALE_EXPECTED, so TMD no longer sets them as a reform. This + test fails loudly if a future Tax-Calculator release changes those + upstream defaults and silently de-calibrates TMD. + """ + pol = taxcalc.Policy() + pol.set_year(TAXYEAR) + errors = [] + for name, expected in CLAIM_PROB_SCALE_EXPECTED.items(): + actual = float(getattr(pol, name)[0]) + if actual != expected: + errors.append(f"{name}: taxcalc={actual} expected={expected}") + if errors: + raise ValueError( + "Tax-Calculator claim_prob_scale defaults have changed; " + "TMD calibration may need updating:\n" + "\n".join(errors) + ) + + @pytest.mark.skipif( TAXYEAR != 2022, reason="expected values are calibrated to TAXYEAR=2022", @@ -41,10 +59,6 @@ def test_taxcalc_results_2022( pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - if OLD_CREDIT_CLAIMING: - pol.implement_reform(CREDIT_CLAIMING) - else: - pol.implement_reform(NEW_CREDIT_CLAIMING) recs = taxcalc.Records( data=tmd_variables, start_year=TAXYEAR, diff --git a/tests/test_weights.py b/tests/test_weights.py index ee10413b..cd842ea4 100644 --- a/tests/test_weights.py +++ b/tests/test_weights.py @@ -44,16 +44,16 @@ def test_weights(tmd_variables): "sum_sq": 478456942738.8, }, "tmd2022": { - "n": 215494, - "total": 189765349.4, - "mean": 880.606, - "sdev": 1092.99, + "n": 215263, + "total": 188896893.1655, + "mean": 877.517, + "sdev": 1087.750, "min": 0.10804, - "p25": 21.8191, - "p50": 398.097, - "p75": 1437.785, + "p25": 21.6943, + "p50": 395.402, + "p75": 1436.428, "max": 16580.3, - "sum_sq": 424545077258.6, + "sum_sq": 420459286479.4, }, } # all float stats checked with np.allclose defaults diff --git a/tmd/create_taxcalc_cached_files.py b/tmd/create_taxcalc_cached_files.py index 0cd4a313..41871964 100644 --- a/tmd/create_taxcalc_cached_files.py +++ b/tmd/create_taxcalc_cached_files.py @@ -6,7 +6,7 @@ import pandas as pd import taxcalc from tmd.storage import STORAGE_FOLDER, CACHED_TAXCALC_VARIABLES -from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC INFILE_PATH = STORAGE_FOLDER / "output" / "tmd.csv.gz" WTFILE_PATH = STORAGE_FOLDER / "output" / "tmd_weights.csv.gz" @@ -23,7 +23,6 @@ def create_cached_files(): # hardcodes start_year=2021 in the taxcalc library). pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) rec = taxcalc.Records( data=pd.read_csv(INFILE_PATH), start_year=TAXYEAR, diff --git a/tmd/datasets/cps.py b/tmd/datasets/cps.py index 700cf3fb..7304fe9d 100644 --- a/tmd/datasets/cps.py +++ b/tmd/datasets/cps.py @@ -11,7 +11,6 @@ from tmd.storage import STORAGE_FOLDER from tmd.imputation_assumptions import ( SOI_IITAX_SPEC, - CREDIT_CLAIMING, CPS_FILER_MIN_INCOME, CPS_TAXABLE_INTEREST_FRACTION, CPS_QUALIFIED_DIVIDEND_FRACTION, @@ -359,7 +358,6 @@ def _is_tax_filer(tcdf: pd.DataFrame, taxyear: int) -> pd.Series: ) pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) calc = taxcalc.Calculator(records=rec, policy=pol) calc.advance_to_year(taxyear) calc.calc_all() diff --git a/tmd/imputation_assumptions.py b/tmd/imputation_assumptions.py index 66916bf7..1a6687ab 100644 --- a/tmd/imputation_assumptions.py +++ b/tmd/imputation_assumptions.py @@ -25,6 +25,13 @@ # general sales, and individual income taxes, from 2015 to 2022, per the # Census Bureau Annual Survey of State and Local Government Finances. +# Tax-Calculator 6.7.0 introduced EITC/ACTC claiming behavior as the default. +# The following parameters are assumed to be the Tax-Calculator default values. +CLAIM_PROB_SCALE_EXPECTED = { + "eitc_claim_prob_scale": 1.04, + "actc_claim_prob_scale": 1.10, +} + # parameters used to impute CPS variables: CPS_TAXABLE_INTEREST_FRACTION = 0.680 # from SOI 2020 data CPS_QUALIFIED_DIVIDEND_FRACTION = 0.448 # from SOI 2018 data @@ -36,19 +43,7 @@ 2021: 8600, 2022: 9300, } -EITC_CLAIM_THD = { - 2021: 1800, # reduces 2023 EITC from $82.3b to $71.6b, a claim rate of 87% - 2022: 1600, # reduces 2023 EITC from $80.5b to $72.0b, a claim rate of 89% -} -ACTC_CLAIM_THD = { - 2021: 0, # always leave 2021 value at zero - 2022: 1500, -} CPS_FILER_MIN_INCOME = FILER_MIN_INCOME[TAXYEAR] -CREDIT_CLAIMING = { - "eitc_claim_thd": {f"{TAXYEAR}": EITC_CLAIM_THD[TAXYEAR]}, - "actc_claim_thd": {f"{TAXYEAR}": ACTC_CLAIM_THD[TAXYEAR]}, -} CPS_WEIGHTS_SCALE = {2021: 1.0, 2022: 1.0} # for scaling CPS nonfiler weights # parameters used in creation of national sampling weights: diff --git a/tmd/utils/soi_replication.py b/tmd/utils/soi_replication.py index 10b5d960..690e3607 100644 --- a/tmd/utils/soi_replication.py +++ b/tmd/utils/soi_replication.py @@ -1,12 +1,11 @@ import pandas as pd import taxcalc -from tmd.imputation_assumptions import SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import SOI_IITAX_SPEC def taxcalc_to_soi(puf: pd.DataFrame, year: int) -> pd.DataFrame: pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) rec = taxcalc.Records( data=puf, start_year=year, diff --git a/tmd/utils/taxcalc_output.py b/tmd/utils/taxcalc_output.py index 180dccff..57cb4625 100644 --- a/tmd/utils/taxcalc_output.py +++ b/tmd/utils/taxcalc_output.py @@ -7,7 +7,7 @@ import numpy as np import pandas as pd import taxcalc -from tmd.imputation_assumptions import SOI_IITAX_SPEC, CREDIT_CLAIMING +from tmd.imputation_assumptions import SOI_IITAX_SPEC def add_taxcalc_outputs( @@ -48,7 +48,6 @@ def add_taxcalc_outputs( ) pol = taxcalc.Policy() pol.implement_reform(SOI_IITAX_SPEC) - pol.implement_reform(CREDIT_CLAIMING) if reform: pol.implement_reform(reform) simulation = taxcalc.Calculator(records=rec, policy=pol) From 10f736043fd70fd3887210f7a5e15ae29d8fbebe Mon Sep 17 00:00:00 2001 From: martinholmer Date: Thu, 25 Jun 2026 17:28:10 -0400 Subject: [PATCH 5/5] Add URL to T-C PR 3084 in README.md file --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f39517de..a542c0a2 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,9 @@ version 6.7.0 (instead of 6.6.2) is used to generate the TMD files. The current TMD 2.1.2 version differs from the prior 2.1.1 version only slightly because of the use in Tax-Calculator 6.7.0 of EITC and ACTC credit claiming logic that reduces slightly the number of tax -units added to PUF records from the CPS. See Tax-Calculator PR 3084 -for details on the tiny changes in income and payroll tax revenue +units added to PUF records from the CPS. See [Tax-Calculator PR +3084]( https://github.com/PSLmodels/Tax-Calculator/pull/3084) for +details on the small changes in income and payroll tax revenue associated with the TMD 2.1.2 input data files. The older TMD 2.1.1 version differed from the 2.0.0 version only