From 117841384eb8a902b058a01fb20cac5d6bef2ac7 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Fri, 26 Jun 2026 18:28:17 -0400 Subject: [PATCH 1/4] Rely on taxcalc 6.7.0 default credit claiming behavior --- setup.py | 2 +- tests/test_imputed_variables.py | 4 +--- tests/test_revenue_levels_cbo.py | 3 +-- tests/test_soi_sanity_2022.py | 3 +-- tmd/create_taxcalc_cached_files.py | 3 +-- tmd/datasets/cps.py | 2 -- tmd/imputation_assumptions.py | 18 ++++++------------ tmd/utils/soi_replication.py | 3 +-- tmd/utils/taxcalc_output.py | 3 +-- 9 files changed, 13 insertions(+), 28 deletions(-) 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", diff --git a/tests/test_imputed_variables.py b/tests/test_imputed_variables.py index 4aa2a2f5..015cccb8 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 @@ -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_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/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..1eb309d0 100644 --- a/tmd/imputation_assumptions.py +++ b/tmd/imputation_assumptions.py @@ -36,19 +36,13 @@ 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]}, -} +# Tax-Calculator 6.7.0 removed the eitc_claim_thd/actc_claim_thd dollar- +# threshold parameters and replaced them with eitc_claim_prob_scale/ +# actc_claim_prob_scale, a per-record probabilistic claiming model whose +# 6.7.0 defaults (1.04 and 1.10) already imply less-than-full claiming. +# TMD therefore no longer applies an explicit credit-claiming reform and +# relies on those Tax-Calculator defaults. 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 36f85663328fc84f084d755a3a480582d68e33a2 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Sat, 27 Jun 2026 07:57:07 -0400 Subject: [PATCH 2/4] Calibrate by adjusting CPS_WEIGHTS_SCALE --- tests/expected_tax_exp_2022_data | 8 +- tests/expected_taxcalc_results_2022.yaml | 23 + tests/fingerprints/tmd_file_fingerprint.json | 642 +++++++++---------- tests/test_imputed_variables.py | 24 +- tests/test_misc.py | 2 +- tests/test_taxcalc_results_2022.py | 81 +++ tests/test_weights.py | 18 +- tmd/create_taxcalc_input_variables.py | 2 +- tmd/imputation_assumptions.py | 2 +- 9 files changed, 453 insertions(+), 349 deletions(-) create mode 100644 tests/expected_taxcalc_results_2022.yaml create mode 100644 tests/test_taxcalc_results_2022.py diff --git a/tests/expected_tax_exp_2022_data b/tests/expected_tax_exp_2022_data index ce5d3845..4bbd4ea3 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.8 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/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/fingerprints/tmd_file_fingerprint.json b/tests/fingerprints/tmd_file_fingerprint.json index e7418e9b..f5c5b8b7 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": 85933967.25128001 }, "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": 382869759277.90845 }, "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": 327239072.67228997 }, "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": 17787438993441.83 }, "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": 333997938.16792 }, "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": 8628575175.15423 }, "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": 2889134638.78797 }, "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": 93186790867.8772 }, "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": 1105418.09093 }, "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": 18725.57879 }, "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": 9725069154625.982 }, "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": 7577688527496.811 }, "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": 2147380627129.1729 }, "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": 134808532472.4604 }, "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": 56407611711.52887 }, "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": 412895368872.42676 }, "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": 312653494755.0454 }, "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": 16700641581.001879 }, "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": 440181113290.73975 }, "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": 1535749309540.7173 }, "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": 915317326764.1711 }, "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": 1147061881346.516 }, "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": 7384766688.15036 }, "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": 5708701398.9065895 }, "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": 30560172580.36555 }, "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": 903735829302.0815 }, "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": 143731.29736 }, "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": 60081526.9886 }, "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": 5894854.26298 }, "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": 11567766.78292 }, "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": 76758801.62026 }, "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": 32763423.74605 }, "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": 61415172.4276 }, "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": 80250419.31199 }, "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": 256006203282.74966 }, "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": -106927341050.99054 }, "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": 1126418081086.142 }, "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": 16832.60916, "min": 0.10804, - "std": 1092.9933025486473, - "sum": 189765349.44595, - "weighted_sum": 424545077258.6477 + "std": 1095.1100221048341, + "sum": 189352007.55584, + "weighted_sum": 424717483867.219 }, "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": 66197980038.33452 }, "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-26", "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 015cccb8..4e7c0bc9 100644 --- a/tests/test_imputed_variables.py +++ b/tests/test_imputed_variables.py @@ -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.90, + "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.85, + "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.19, + "exp_affben_2022": 1047, }, } output_variables = [ diff --git a/tests/test_misc.py b/tests/test_misc.py index 651c3a3b..a8b5f803 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.0001 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_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py new file mode 100644 index 00000000..8d58ce2f --- /dev/null +++ b/tests/test_taxcalc_results_2022.py @@ -0,0 +1,81 @@ +""" +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 + +MAX_RELATIVE_TOLERANCE = { + "n_returns_mil": 0.08, + "amount_bil": 0.003, +} + + +@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: + expect = yaml.safe_load(f) + + pol = taxcalc.Policy() + pol.implement_reform(SOI_IITAX_SPEC) + 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] + 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={exp:.2f} " + f"rel_diff={rel_diff:+.4f} " + f"tol={MAX_RELATIVE_TOLERANCE[metric]:.4f}" + ) + + if errors: + raise ValueError( + "\nACT-vs-EXP TAXCALC 2022 DIFFERENCES:\n" + "\n".join(errors) + ) diff --git a/tests/test_weights.py b/tests/test_weights.py index ee10413b..a8dab4d0 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": 189352007.6, + "mean": 879.631, + "sdev": 1095.11, "min": 0.10804, - "p25": 21.8191, - "p50": 398.097, - "p75": 1437.785, - "max": 16580.3, - "sum_sq": 424545077258.6, + "p25": 21.6943, + "p50": 395.6666, + "p75": 1436.816, + "max": 16832.61, + "sum_sq": 424717483867.2, }, } # all float stats checked with np.allclose defaults diff --git a/tmd/create_taxcalc_input_variables.py b/tmd/create_taxcalc_input_variables.py index e2777844..f65e8916 100644 --- a/tmd/create_taxcalc_input_variables.py +++ b/tmd/create_taxcalc_input_variables.py @@ -30,7 +30,7 @@ def create_variable_file(write_file=True): print(f" ASSUMED SALT_GROW_RATE = {SALT_GROW_RATE:.3f}") print(f" ASSUMED ITMDED_GROW_RATE = {ITMDED_GROW_RATE:.3f}") print(f" ASSUMED W2_WAGES_RATIO = {W2_WAGES_RATIO[TAXYEAR]:.5f}") - print(f" ASSUMED CPS_WEIGHTS_SCALE = {CPS_WEIGHTS_SCALE[TAXYEAR]:.2f}") + print(f" ASSUMED CPS_WEIGHTS_SCALE = {CPS_WEIGHTS_SCALE[TAXYEAR]:.3f}") vdf = create_tmd_dataframe(TAXYEAR) vdf.FLPDYR = TAXYEAR vdf.agi_bin = 0 diff --git a/tmd/imputation_assumptions.py b/tmd/imputation_assumptions.py index 1eb309d0..c522306c 100644 --- a/tmd/imputation_assumptions.py +++ b/tmd/imputation_assumptions.py @@ -43,7 +43,7 @@ # 6.7.0 defaults (1.04 and 1.10) already imply less-than-full claiming. # TMD therefore no longer applies an explicit credit-claiming reform and # relies on those Tax-Calculator defaults. -CPS_WEIGHTS_SCALE = {2021: 1.0, 2022: 1.0} # for scaling CPS nonfiler weights +CPS_WEIGHTS_SCALE = {2021: 1, 2022: 1.017} # for scaling CPS nonfiler weights # parameters used in creation of national sampling weights: REWEIGHT_MULTIPLIER_MIN = 0.1 From ee91eee287f00c704f6e19db7fb017c0784aa840 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Sat, 27 Jun 2026 10:05:11 -0400 Subject: [PATCH 3/4] Calibrate by adjusting CPS_FILER_MIN_INCOME for 2022 --- README.md | 29 +- setup.py | 2 +- tests/fingerprints/tmd_file_fingerprint.json | 640 +++++++++---------- tests/test_imputed_variables.py | 18 +- tests/test_taxcalc_results_2022.py | 4 +- tests/test_weights.py | 18 +- tmd/imputation_assumptions.py | 10 +- 7 files changed, 358 insertions(+), 363 deletions(-) diff --git a/README.md b/README.md index 194ee02d..520192a4 100644 --- a/README.md +++ b/README.md @@ -8,23 +8,24 @@ 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.6.1 (instead of 6.5.3) is used to generate the TMD files. +The **current TMD version is 2.1.2**, which was released on May 29, +2026, and is the same as TMD version 2.1.1 except that Tax-Calculator +version 6.7.0 (instead of 6.6.1 or 6.6.2) is used to generate the TMD +files. This new Tax-Calculator version uses a more refined refundable +credit claiming logic, which causes minor changes in the TMD input +data files generated by this repo (even after some recalibration of +the TMD data generation logic). [Tax-Calculator pull request +3085](https://github.com/PSLmodels/Tax-Calculator/pull/3085) shows the +small differences in baseline policy results when using the new TMD +2.1.2 input data 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 -`tmd_weights.csv.gz` file and just the `s006` variable in the -`tmd.csv.gz` file); the non-weights input variables in the -`tmd.csv.gz` file and the contents of `tmd_growfactors.csv` file are -unchanged. When using version 2.1.1 to generate **sub-national -weights**, there will be (presumably small) differences from the -sub-national weights generated using version 2.0.0; however, the -sub-national weights fingerprints have not yet been updated. +When using version 2.1.2 to generate **sub-national weights**, there +will be (presumably small) differences from the sub-national weights +generated using earlier versions; however, the sub-national weights +fingerprints have not yet been updated. -The prior TMD 2.0.0 version included the following significant +The earlier TMD 2.0.0 version introduced the following significant improvements: - - generate national, state, and Congressional district, input files for **2022**: [#470](https://github.com/PSLmodels/tax-microdata-benchmarking/pull/470) diff --git a/setup.py b/setup.py index dd9b8e49..26be4b1f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="tmd", - version="2.1.1", + version="2.1.2", packages=find_packages(), python_requires=">=3.11,<3.14", install_requires=[ diff --git a/tests/fingerprints/tmd_file_fingerprint.json b/tests/fingerprints/tmd_file_fingerprint.json index f5c5b8b7..3a6c530e 100644 --- a/tests/fingerprints/tmd_file_fingerprint.json +++ b/tests/fingerprints/tmd_file_fingerprint.json @@ -1,7 +1,7 @@ { "columns": { "DSI": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -9,31 +9,31 @@ "weighted_sum": 0.0 }, "EIC": { - "count": 215263, + "count": 215432, "max": 3.0, "min": 0.0, - "std": 0.9990522449170486, - "sum": 142409.0, - "weighted_sum": 85933967.25128001 + "std": 0.9988431546416128, + "sum": 142419.0, + "weighted_sum": 85873737.79837 }, "FLPDYR": { - "count": 215263, + "count": 215432, "max": 2022.0, "min": 2022.0, "std": 0.0, - "sum": 435261786.0, - "weighted_sum": 382869759277.90845 + "sum": 435603504.0, + "weighted_sum": 382982617566.7326 }, "MARS": { - "count": 215263, + "count": 215432, "max": 5.0, "min": 1.0, - "std": 0.8282611327494847, - "sum": 402434.0, - "weighted_sum": 327239072.67228997 + "std": 0.8284065770695873, + "sum": 402638.0, + "weighted_sum": 327237088.53251004 }, "MIDR": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -41,7 +41,7 @@ "weighted_sum": 0.0 }, "PT_SSTB_income": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -49,15 +49,15 @@ "weighted_sum": 0.0 }, "PT_binc_w2_wages": { - "count": 215263, + "count": 215432, "max": 31313015.0, "min": 0.0, - "std": 738261.6842397425, + "std": 737979.3512565867, "sum": 25230744106.0, - "weighted_sum": 284545792851.1907 + "weighted_sum": 284545792883.1683 }, "PT_ubia_property": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -65,23 +65,23 @@ "weighted_sum": 0.0 }, "RECID": { - "count": 215263, - "max": 215306.0, + "count": 215432, + "max": 215478.0, "min": 1.0, - "std": 62142.23707159986, - "sum": 23169334842.0, - "weighted_sum": 17787438993441.83 + "std": 62191.19758625769, + "sum": 23205751185.0, + "weighted_sum": 17801457113110.875 }, "XTOT": { - "count": 215263, + "count": 215432, "max": 8.0, "min": 0.0, - "std": 1.3125370309507325, - "sum": 487234.0, - "weighted_sum": 333997938.16792 + "std": 1.312462607835132, + "sum": 487423.0, + "weighted_sum": 333986688.42789 }, "a_lineno": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -89,23 +89,23 @@ "weighted_sum": 0.0 }, "age_head": { - "count": 215263, + "count": 215432, "max": 85.0, "min": 0.0, - "std": 16.08999448715726, - "sum": 10422317.0, - "weighted_sum": 8628575175.15423 + "std": 16.099427046112577, + "sum": 10433791.0, + "weighted_sum": 8641948161.69323 }, "age_spouse": { - "count": 215263, + "count": 215432, "max": 85.0, "min": 0.0, - "std": 27.914569970219738, - "sum": 6305260.0, - "weighted_sum": 2889134638.78797 + "std": 27.916019560205985, + "sum": 6305672.0, + "weighted_sum": 2889433131.9135704 }, "agi_bin": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -113,31 +113,31 @@ "weighted_sum": 0.0 }, "auto_loan_interest": { - "count": 215263, + "count": 215432, "max": 29216.0, "min": 0.0, - "std": 1590.3307588349192, - "sum": 119012560.0, - "weighted_sum": 93186790867.8772 + "std": 1586.614863745622, + "sum": 118719708.0, + "weighted_sum": 92522218812.05344 }, "blind_head": { - "count": 215263, + "count": 215432, "max": 1.0, "min": 0.0, - "std": 0.03912362897895282, - "sum": 330.0, - "weighted_sum": 1105418.09093 + "std": 0.03957876921942024, + "sum": 338.0, + "weighted_sum": 1118623.88786 }, "blind_spouse": { - "count": 215263, + "count": 215432, "max": 1.0, "min": 0.0, - "std": 0.005279403771530755, + "std": 0.005277332655293923, "sum": 6.0, - "weighted_sum": 18725.57879 + "weighted_sum": 18412.565179999998 }, "cmbtp": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -145,495 +145,495 @@ "weighted_sum": 0.0 }, "data_source": { - "count": 215263, + "count": 215432, "max": 1.0, "min": 0.0, - "std": 0.1842116611264962, + "std": 0.1861101894686241, "sum": 207692.0, - "weighted_sum": 162125458.43592998 + "weighted_sum": 162125458.44924 }, "e00200": { - "count": 215263, + "count": 215432, "max": 158001246.0, "min": 0.0, - "std": 3840293.8912365986, - "sum": 135567779689.0, - "weighted_sum": 9725069154625.982 + "std": 3838827.7105363873, + "sum": 135567885986.0, + "weighted_sum": 9725258018179.902 }, "e00200p": { - "count": 215263, + "count": 215432, "max": 146649912.0, "min": 0.0, - "std": 3075921.6368921595, - "sum": 100916418227.0, - "weighted_sum": 7577688527496.811 + "std": 3074742.855746403, + "sum": 100916524524.0, + "weighted_sum": 7577882509415.301 }, "e00200s": { - "count": 215263, + "count": 215432, "max": 131089978.0, "min": 0.0, - "std": 1408340.0919694335, + "std": 1407794.7970084827, "sum": 34651361462.0, - "weighted_sum": 2147380627129.1729 + "weighted_sum": 2147375508764.5996 }, "e00300": { - "count": 215263, + "count": 215432, "max": 61918081.0, "min": 0.0, - "std": 711749.8061061059, - "sum": 14959487127.0, - "weighted_sum": 134808532472.4604 + "std": 711473.2202871683, + "sum": 14959528896.0, + "weighted_sum": 134958494140.81647 }, "e00400": { - "count": 215263, + "count": 215432, "max": 11301339.0, "min": 0.0, - "std": 177936.97109938125, - "sum": 4044707987.0, - "weighted_sum": 56407611711.52887 + "std": 177867.93328702226, + "sum": 4044727621.0, + "weighted_sum": 56478147255.37259 }, "e00600": { - "count": 215263, + "count": 215432, "max": 185467468.0, "min": 0.0, - "std": 1956831.4276827134, - "sum": 41042234815.0, - "weighted_sum": 412895368872.42676 + "std": 1956071.0197042765, + "sum": 41042241365.0, + "weighted_sum": 412896467107.35693 }, "e00650": { - "count": 215263, + "count": 215432, "max": 180321892.0, "min": 0.0, - "std": 1770550.981608778, - "sum": 32307238205.0, - "weighted_sum": 312653494755.0454 + "std": 1769861.3599204314, + "sum": 32307241138.0, + "weighted_sum": 312653986955.9606 }, "e00700": { - "count": 215263, + "count": 215432, "max": 7423763.0, "min": 0.0, - "std": 122203.70744853604, + "std": 122156.4097438943, "sum": 3050450092.0, - "weighted_sum": 45119021348.956635 + "weighted_sum": 45119021341.36163 }, "e00800": { - "count": 215263, + "count": 215432, "max": 460766.0, "min": 0.0, - "std": 3181.3424030399624, + "std": 3180.094785215266, "sum": 13169293.0, - "weighted_sum": 16700641581.001879 + "weighted_sum": 16700075897.528212 }, "e00900": { - "count": 215263, + "count": 215432, "max": 26763122.0, "min": -50236735.0, - "std": 594177.7388914728, + "std": 593945.1236010923, "sum": 5852882933.0, - "weighted_sum": 411465040309.20984 + "weighted_sum": 411465040377.0045 }, "e00900p": { - "count": 215263, + "count": 215432, "max": 26763122.0, "min": -43918428.0, - "std": 506909.676041499, + "std": 506711.1444592021, "sum": 4481330664.0, - "weighted_sum": 315388176010.78754 + "weighted_sum": 315388176128.5863 }, "e00900s": { - "count": 215263, + "count": 215432, "max": 18599368.0, "min": -33603257.0, - "std": 198859.21021614163, + "std": 198781.2753852086, "sum": 1371552269.0, - "weighted_sum": 96076864298.42224 + "weighted_sum": 96076864248.41814 }, "e01100": { - "count": 215263, + "count": 215432, "max": 3199159.0, "min": 0.0, - "std": 9342.928475804247, + "std": 9339.264557117987, "sum": 39668789.0, - "weighted_sum": 12797168594.90506 + "weighted_sum": 12797168593.34811 }, "e01200": { - "count": 215263, + "count": 215432, "max": 62352563.0, "min": -35655204.0, - "std": 581380.667206065, + "std": 581152.7648917192, "sum": 3520229342.0, - "weighted_sum": -44829382940.435776 + "weighted_sum": -44829383012.77958 }, "e01400": { - "count": 215263, + "count": 215432, "max": 7902154.0, "min": 0.0, - "std": 83340.38518768597, - "sum": 1945050082.0, - "weighted_sum": 440181113290.73975 + "std": 83308.0709631266, + "sum": 1945057159.0, + "weighted_sum": 440200588941.80707 }, "e01500": { - "count": 215263, + "count": 215432, "max": 27560876.0, "min": 0.0, - "std": 321380.42390871514, - "sum": 10311950944.0, - "weighted_sum": 1535749309540.7173 + "std": 321257.09991838963, + "sum": 10312016862.0, + "weighted_sum": 1535877010890.046 }, "e01700": { - "count": 215263, + "count": 215432, "max": 4930050.0, "min": 0.0, - "std": 56091.90206779826, - "sum": 2182787272.0, - "weighted_sum": 915317326764.1711 + "std": 56070.57952795099, + "sum": 2182853190.0, + "weighted_sum": 915445028120.0986 }, "e02000": { - "count": 215263, + "count": 215432, "max": 201882312.0, "min": -179684656.0, - "std": 5279583.404217985, - "sum": 133913066948.0, - "weighted_sum": 1147061881346.516 + "std": 5277540.887679188, + "sum": 133913088698.0, + "weighted_sum": 1147076508216.3013 }, "e02100": { - "count": 215263, + "count": 215432, "max": 18904982.0, "min": -2500.0, - "std": 137037.78194226447, + "std": 136984.04568827117, "sum": 640434462.0, - "weighted_sum": 7384766688.15036 + "weighted_sum": 7385115964.57203 }, "e02100p": { - "count": 215263, + "count": 215432, "max": 14541252.0, "min": -2500.0, - "std": 102290.48923280336, + "std": 102250.37750062582, "sum": 467305339.0, - "weighted_sum": 5708701398.9065895 + "weighted_sum": 5709050675.40151 }, "e02100s": { - "count": 215263, + "count": 215432, "max": 15334893.0, "min": 0.0, - "std": 61995.689313434865, + "std": 61971.371745786644, "sum": 173129123.0, - "weighted_sum": 1676065289.24377 + "weighted_sum": 1676065289.1705203 }, "e02300": { - "count": 215263, + "count": 215432, "max": 31090.0, "min": 0.0, - "std": 1023.9686516221718, - "sum": 26613547.0, - "weighted_sum": 30560172580.36555 + "std": 1023.6214963160595, + "sum": 26618307.0, + "weighted_sum": 30567059465.96073 }, "e02400": { - "count": 215263, + "count": 215432, "max": 194473.0, "min": 0.0, - "std": 16838.695581499003, - "sum": 1569132769.0, - "weighted_sum": 903735829302.0815 + "std": 16832.345430735797, + "sum": 1570512653.0, + "weighted_sum": 907514363945.7084 }, "e03150": { - "count": 215263, + "count": 215432, "max": 17617.0, "min": 0.0, - "std": 1828.6511158990063, + "std": 1827.9474544437364, "sum": 54493998.0, - "weighted_sum": 20428125726.646908 + "weighted_sum": 20428125723.50502 }, "e03210": { - "count": 215263, + "count": 215432, "max": 3387.0, "min": 0.0, - "std": 390.91662740495127, + "std": 390.7674542477835, "sum": 13910295.0, - "weighted_sum": 20142836984.79663 + "weighted_sum": 20142836991.31869 }, "e03220": { - "count": 215263, + "count": 215432, "max": 677.0, "min": 0.0, - "std": 48.117125885099846, + "std": 48.09857475787423, "sum": 1361161.0, - "weighted_sum": 1356073271.76232 + "weighted_sum": 1356073271.73802 }, "e03230": { - "count": 215263, + "count": 215432, "max": 5420.0, "min": 0.0, - "std": 307.29797943813094, + "std": 307.1779985143043, "sum": 4572915.0, - "weighted_sum": 5548495926.39693 + "weighted_sum": 5548495926.75733 }, "e03240": { - "count": 215263, + "count": 215432, "max": 10247991.0, "min": 0.0, - "std": 182498.07830734923, + "std": 182426.9176183379, "sum": 3064867345.0, - "weighted_sum": 18678170581.49975 + "weighted_sum": 18678170577.60179 }, "e03270": { - "count": 215263, + "count": 215432, "max": 118444.0, "min": 0.0, - "std": 7477.134466518801, + "std": 7474.484029260145, "sum": 500028611.0, - "weighted_sum": 42720018781.00539 + "weighted_sum": 42720018777.89611 }, "e03290": { - "count": 215263, + "count": 215432, "max": 13551.0, "min": 0.0, - "std": 1368.978364903597, + "std": 1368.4561174858818, "sum": 48966082.0, - "weighted_sum": 6495408671.79486 + "weighted_sum": 6495408671.040779 }, "e03300": { - "count": 215263, + "count": 215432, "max": 948637.0, "min": 0.0, - "std": 23860.086871990607, + "std": 23850.960895812936, "sum": 813401582.0, - "weighted_sum": 32703384508.282963 + "weighted_sum": 32703384513.448494 }, "e03400": { - "count": 215263, + "count": 215432, "max": 69386.0, "min": 0.0, - "std": 223.76240734081014, + "std": 223.674640545783, "sum": 688077.0, - "weighted_sum": 104022550.15768 + "weighted_sum": 104022550.71322 }, "e03500": { - "count": 215263, + "count": 215432, "max": 184984.0, "min": 0.0, - "std": 1842.6489129347235, + "std": 1841.9270332275137, "sum": 14858202.0, - "weighted_sum": 10409757705.857029 + "weighted_sum": 10409757744.176031 }, "e07240": { - "count": 215263, + "count": 215432, "max": 2710.0, "min": 0.0, - "std": 59.2726681626945, + "std": 59.249733024287465, "sum": 1493106.0, - "weighted_sum": 2091676730.96414 + "weighted_sum": 2091676733.4656498 }, "e07260": { - "count": 215263, + "count": 215432, "max": 1764465.0, "min": 0.0, - "std": 4938.218623898937, + "std": 4936.282429564261, "sum": 25664046.0, - "weighted_sum": 3151264753.10441 + "weighted_sum": 3151264753.14021 }, "e07300": { - "count": 215263, + "count": 215432, "max": 23024778.0, "min": 0.0, - "std": 332023.9075898654, + "std": 331894.1576969627, "sum": 4460805245.0, - "weighted_sum": 32587553042.594288 + "weighted_sum": 32587553042.021893 }, "e07400": { - "count": 215263, + "count": 215432, "max": 7856070.0, "min": 0.0, - "std": 71653.00611994107, + "std": 71624.9696893676, "sum": 791134935.0, - "weighted_sum": 5230783487.01236 + "weighted_sum": 5230783496.10604 }, "e07600": { - "count": 215263, + "count": 215432, "max": 1939285.0, "min": 0.0, - "std": 15163.90874627349, + "std": 15157.965767499392, "sum": 103747781.0, - "weighted_sum": 1246857035.87849 + "weighted_sum": 1246857035.2003798 }, "e09700": { - "count": 215263, + "count": 215432, "max": 6803.0, "min": 0.0, - "std": 16.659992956870532, + "std": 16.653457115563956, "sum": 12182.0, "weighted_sum": 10162979.77321 }, "e09800": { - "count": 215263, + "count": 215432, "max": 8578.0, "min": 0.0, - "std": 19.975127031102094, + "std": 19.967290863197288, "sum": 27311.0, - "weighted_sum": 19608900.87356 + "weighted_sum": 19608900.86962 }, "e09900": { - "count": 215263, + "count": 215432, "max": 267244.0, "min": 0.0, - "std": 1672.4643342011066, + "std": 1671.810621757451, "sum": 21850771.0, - "weighted_sum": 8009679603.22553 + "weighted_sum": 8009679600.45321 }, "e11200": { - "count": 215263, + "count": 215432, "max": 63152.0, "min": 0.0, - "std": 1602.7618855706544, + "std": 1602.1489625584525, "sum": 54810849.0, - "weighted_sum": 4749580536.74043 + "weighted_sum": 4749580536.57944 }, "e17500": { - "count": 215263, + "count": 215432, "max": 792248.0, "min": 0.0, - "std": 10995.852672300547, + "std": 10991.588467306674, "sum": 253887516.0, - "weighted_sum": 170531953065.0965 + "weighted_sum": 170531953054.35077 }, "e18400": { - "count": 215263, + "count": 215432, "max": 47954731.0, "min": 0.0, - "std": 1028970.3288677885, + "std": 1028579.6803968969, "sum": 39805235783.0, - "weighted_sum": 527919599081.719 + "weighted_sum": 527919599008.1664 }, "e18500": { - "count": 215263, + "count": 215432, "max": 1781924.0, "min": 0.0, - "std": 48520.6557110246, + "std": 48503.51849928277, "sum": 3299136260.0, - "weighted_sum": 285657352339.5913 + "weighted_sum": 285657352348.31274 }, "e19200": { - "count": 215263, + "count": 215432, "max": 20871618.0, "min": 0.0, - "std": 222206.77528640185, + "std": 222120.42566455784, "sum": 4654041060.0, - "weighted_sum": 377541565234.79803 + "weighted_sum": 377541565220.75366 }, "e19800": { - "count": 215263, + "count": 215432, "max": 65015608.0, "min": 0.0, - "std": 682737.4953102127, + "std": 682471.5305659372, "sum": 12321188081.0, - "weighted_sum": 199380033760.28302 + "weighted_sum": 199380033749.98804 }, "e20100": { - "count": 215263, + "count": 215432, "max": 133879803.0, "min": 0.0, - "std": 1112030.431455647, + "std": 1111595.6811267529, "sum": 14099697665.0, - "weighted_sum": 91120148422.50049 + "weighted_sum": 91120148399.85477 }, "e20400": { - "count": 215263, + "count": 215432, "max": 19975587.0, "min": 0.0, - "std": 321408.37093523215, + "std": 321284.15196525154, "sum": 8435836745.0, - "weighted_sum": 232785046616.83865 + "weighted_sum": 232785046918.38406 }, "e24515": { - "count": 215263, + "count": 215432, "max": 35072470.0, "min": 0.0, - "std": 387749.01036315947, + "std": 387597.33806525345, "sum": 4522551372.0, - "weighted_sum": 49147520478.16959 + "weighted_sum": 49147520497.93848 }, "e24518": { - "count": 215263, + "count": 215432, "max": 30708739.0, "min": 0.0, - "std": 271592.82799525035, + "std": 271486.36828068004, "sum": 1694322554.0, - "weighted_sum": 8396106579.95237 + "weighted_sum": 8396106578.22369 }, "e26270": { - "count": 215263, + "count": 215432, "max": 202019457.0, "min": -179393560.0, - "std": 5146270.868466898, + "std": 5144276.844449351, "sum": 123113181769.0, - "weighted_sum": 1032383256312.2002 + "weighted_sum": 1032383256547.6865 }, "e27200": { - "count": 215263, + "count": 215432, "max": 1924378.0, "min": -788181.0, - "std": 10929.264720933907, + "std": 10924.978380032713, "sum": 41631327.0, - "weighted_sum": 5697297471.0816 + "weighted_sum": 5697297469.7313595 }, "e32800": { - "count": 215263, + "count": 215432, "max": 8131.0, "min": 0.0, - "std": 992.0882211868671, + "std": 991.7117352053626, "sum": 38622412.0, - "weighted_sum": 24873019041.95161 + "weighted_sum": 24873019034.264133 }, "e58990": { - "count": 215263, + "count": 215432, "max": 23986967.0, "min": 0.0, - "std": 146042.2346788064, + "std": 145984.98815215658, "sum": 906483448.0, - "weighted_sum": 5986550407.47603 + "weighted_sum": 5986550406.385651 }, "e62900": { - "count": 215263, + "count": 215432, "max": 27117470.0, "min": 0.0, - "std": 293828.27580298897, + "std": 293713.44888597704, "sum": 3933115700.0, - "weighted_sum": 27963352412.3448 + "weighted_sum": 27963352411.092934 }, "e87521": { - "count": 215263, + "count": 215432, "max": 19921.0, "min": 0.0, - "std": 669.9682567774909, + "std": 669.7140141577631, "sum": 26086045.0, - "weighted_sum": 30558969878.93075 + "weighted_sum": 30558969870.65142 }, "e87530": { - "count": 215263, + "count": 215432, "max": 5420.0, "min": 0.0, - "std": 307.29797943813094, + "std": 307.1779985143043, "sum": 4572915.0, - "weighted_sum": 5548495926.39693 + "weighted_sum": 5548495926.75733 }, "elderly_dependents": { - "count": 215263, + "count": 215432, "max": 2.0, "min": 0.0, - "std": 0.014295560847518414, - "sum": 42.0, - "weighted_sum": 143731.29736 + "std": 0.014451393618394766, + "sum": 43.0, + "weighted_sum": 146907.10287 }, "f2441": { - "count": 215263, + "count": 215432, "max": 6.0, "min": 0.0, - "std": 0.867104615591422, - "sum": 106330.0, - "weighted_sum": 60081526.9886 + "std": 0.8668856400625624, + "sum": 106335.0, + "weighted_sum": 60029734.21513 }, "f6251": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -641,7 +641,7 @@ "weighted_sum": 0.0 }, "ffpos": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -649,7 +649,7 @@ "weighted_sum": 0.0 }, "fips": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -657,15 +657,15 @@ "weighted_sum": 0.0 }, "g20500": { - "count": 215263, + "count": 215432, "max": 1881011.0, "min": 0.0, - "std": 6944.862269028169, + "std": 6942.137953097033, "sum": 13962177.0, - "weighted_sum": 2535861913.11921 + "weighted_sum": 2535861912.78501 }, "h_seq": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -673,7 +673,7 @@ "weighted_sum": 0.0 }, "housing_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -681,7 +681,7 @@ "weighted_sum": 0.0 }, "k1bx14p": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -689,7 +689,7 @@ "weighted_sum": 0.0 }, "k1bx14s": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -697,7 +697,7 @@ "weighted_sum": 0.0 }, "mcaid_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -705,7 +705,7 @@ "weighted_sum": 0.0 }, "mcare_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -713,55 +713,55 @@ "weighted_sum": 0.0 }, "n1820": { - "count": 215263, + "count": 215432, "max": 3.0, "min": 0.0, - "std": 0.20466912830302125, + "std": 0.20459200002768965, "sum": 8751.0, - "weighted_sum": 5894854.26298 + "weighted_sum": 5887921.68535 }, "n21": { - "count": 215263, + "count": 215432, "max": 3.0, "min": 0.0, - "std": 0.2653387742258639, - "sum": 13306.0, - "weighted_sum": 11567766.78292 + "std": 0.26527866735187444, + "sum": 13311.0, + "weighted_sum": 11565468.30432 }, "n24": { - "count": 215263, + "count": 215432, "max": 7.0, "min": 0.0, - "std": 0.9598705242211005, - "sum": 129575.0, - "weighted_sum": 76758801.62026 + "std": 0.9596573668181093, + "sum": 129583.0, + "weighted_sum": 76698091.85684001 }, "nu06": { - "count": 215263, + "count": 215432, "max": 4.0, "min": 0.0, - "std": 0.7414104531374943, - "sum": 69939.0, - "weighted_sum": 32763423.74605 + "std": 0.7411776066600965, + "sum": 69941.0, + "weighted_sum": 32737498.36813 }, "nu13": { - "count": 215263, + "count": 215432, "max": 6.0, "min": 0.0, - "std": 0.8878763850576914, - "sum": 108008.0, - "weighted_sum": 61415172.4276 + "std": 0.8876496487993337, + "sum": 108013.0, + "weighted_sum": 61363379.653610006 }, "nu18": { - "count": 215263, + "count": 215432, "max": 7.0, "min": 0.0, - "std": 0.9792592759933887, - "sum": 135094.0, - "weighted_sum": 80250419.31199 + "std": 0.979046321956348, + "sum": 135103.0, + "weighted_sum": 80189637.51690999 }, "other_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -769,63 +769,63 @@ "weighted_sum": 0.0 }, "overtime_income": { - "count": 215263, - "max": 37043223.0, + "count": 215432, + "max": 42298152.0, "min": 0.0, - "std": 250777.68280246307, - "sum": 2452571139.0, - "weighted_sum": 256006203282.74966 + "std": 222082.1883073958, + "sum": 2345031171.0, + "weighted_sum": 258217400541.15808 }, "p08000": { - "count": 215263, + "count": 215432, "max": 73858.0, "min": 0.0, - "std": 622.4541195619302, + "std": 622.2106055132916, "sum": 7084352.0, - "weighted_sum": 1032781389.35306 + "weighted_sum": 1032781389.5305899 }, "p22250": { - "count": 215263, + "count": 215432, "max": 94633330.0, "min": -127307103.0, - "std": 1321804.1397294358, - "sum": -1646866639.0, - "weighted_sum": -106927341050.99054 + "std": 1321285.5973798847, + "sum": -1646865403.0, + "weighted_sum": -106922752640.02774 }, "p23250": { - "count": 215263, + "count": 215432, "max": 250575723.0, "min": -42756430.0, - "std": 7033683.352090717, - "sum": 230507613477.0, - "weighted_sum": 1126418081086.142 + "std": 7030987.864665172, + "sum": 230507622544.0, + "weighted_sum": 1126451742746.6628 }, "pencon_p": { - "count": 215263, + "count": 215432, "max": 27000.0, "min": 0.0, - "std": 6388.508436128142, + "std": 6386.634275408459, "sum": 690867044.0, - "weighted_sum": 263780602105.06427 + "weighted_sum": 263780602127.78503 }, "pencon_s": { - "count": 215263, + "count": 215432, "max": 27000.0, "min": 0.0, - "std": 4876.904491683914, + "std": 4875.236518847078, "sum": 376013951.0, - "weighted_sum": 76618038189.04086 + "weighted_sum": 76618038200.95807 }, "s006": { - "count": 215263, - "max": 16832.60916, + "count": 215432, + "max": 16580.29985, "min": 0.10804, - "std": 1095.1100221048341, - "sum": 189352007.55584, - "weighted_sum": 424717483867.219 + "std": 1089.9746207461715, + "sum": 189407822.7333, + "weighted_sum": 422470205255.08075 }, "snap_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -833,7 +833,7 @@ "weighted_sum": 0.0 }, "ssi_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -841,7 +841,7 @@ "weighted_sum": 0.0 }, "tanf_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -849,15 +849,15 @@ "weighted_sum": 0.0 }, "tip_income": { - "count": 215263, - "max": 44833750.0, + "count": 215432, + "max": 25638266.0, "min": 0.0, - "std": 150849.59670479523, - "sum": 482594436.0, - "weighted_sum": 66197980038.33452 + "std": 89239.98024978867, + "sum": 381676152.0, + "weighted_sum": 64327204067.11644 }, "vet_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -865,7 +865,7 @@ "weighted_sum": 0.0 }, "wic_ben": { - "count": 215263, + "count": 215432, "max": 0.0, "min": 0.0, "std": 0.0, @@ -874,9 +874,9 @@ } }, "metadata": { - "generated": "2026-06-26", + "generated": "2026-06-27", "n_columns": 109, - "n_records": 215263, + "n_records": 215432, "scope": "tmd_file", "taxcalc_version": "6.7.0", "taxyear": 2022 diff --git a/tests/test_imputed_variables.py b/tests/test_imputed_variables.py index 4e7c0bc9..a0890545 100644 --- a/tests/test_imputed_variables.py +++ b/tests/test_imputed_variables.py @@ -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": 24.20, - "exp_affpct_2022": 8.90, - "exp_affben_2022": 1391, + "exp_totben_2022": 24.47, + "exp_affpct_2022": 8.95, + "exp_affben_2022": 1398, }, "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.17, + "exp_totben_2022": 7.31, "exp_affpct_2022": 2.68, - "exp_affben_2022": 1371, + "exp_affben_2022": 1397, }, "ALI": { # new OBBBA auto loan interest deduction "reform_dict": {"AutoLoanInterestDed_c": {simyear: 0}}, @@ -87,8 +87,8 @@ 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": 8.01, - "exp_affpct_2022": 12.85, + "exp_totben_2022": 8.05, + "exp_affpct_2022": 12.87, "exp_affben_2022": 319, }, "ALL": { # above three deductions plus new OBBBA senior deduction @@ -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": 59.72, + "exp_totben_2022": 60.14, "exp_affpct_2022": 29.19, - "exp_affben_2022": 1047, + "exp_affben_2022": 1054, }, } output_variables = [ diff --git a/tests/test_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py index 8d58ce2f..9b4c63d3 100644 --- a/tests/test_taxcalc_results_2022.py +++ b/tests/test_taxcalc_results_2022.py @@ -13,8 +13,8 @@ from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC MAX_RELATIVE_TOLERANCE = { - "n_returns_mil": 0.08, - "amount_bil": 0.003, + "n_returns_mil": 0.081, + "amount_bil": 0.004, } diff --git a/tests/test_weights.py b/tests/test_weights.py index a8dab4d0..1d7de95a 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": 215263, - "total": 189352007.6, - "mean": 879.631, - "sdev": 1095.11, + "n": 215432, + "total": 189407822.7, + "mean": 879.200, + "sdev": 1089.97, "min": 0.10804, - "p25": 21.6943, - "p50": 395.6666, - "p75": 1436.816, - "max": 16832.61, - "sum_sq": 424717483867.2, + "p25": 21.7997, + "p50": 397.248, + "p75": 1437.74, + "max": 16580.30, + "sum_sq": 422470205255.1, }, } # all float stats checked with np.allclose defaults diff --git a/tmd/imputation_assumptions.py b/tmd/imputation_assumptions.py index c522306c..7761a358 100644 --- a/tmd/imputation_assumptions.py +++ b/tmd/imputation_assumptions.py @@ -34,16 +34,10 @@ # parameters used to identify CPS nonfilers: FILER_MIN_INCOME = { 2021: 8600, - 2022: 9300, + 2022: 9900, } CPS_FILER_MIN_INCOME = FILER_MIN_INCOME[TAXYEAR] -# Tax-Calculator 6.7.0 removed the eitc_claim_thd/actc_claim_thd dollar- -# threshold parameters and replaced them with eitc_claim_prob_scale/ -# actc_claim_prob_scale, a per-record probabilistic claiming model whose -# 6.7.0 defaults (1.04 and 1.10) already imply less-than-full claiming. -# TMD therefore no longer applies an explicit credit-claiming reform and -# relies on those Tax-Calculator defaults. -CPS_WEIGHTS_SCALE = {2021: 1, 2022: 1.017} # for scaling CPS nonfiler weights +CPS_WEIGHTS_SCALE = {2021: 1.0, 2022: 1.0} # for scaling CPS nonfiler weights # parameters used in creation of national sampling weights: REWEIGHT_MULTIPLIER_MIN = 0.1 From 7170d7b078284c60a0d0375bf062587c00ef9f43 Mon Sep 17 00:00:00 2001 From: martinholmer Date: Mon, 29 Jun 2026 19:07:39 -0400 Subject: [PATCH 4/4] Small increase in n_returns_mill TOLERANCE in test_taxcalc_results_2022.py --- tests/test_taxcalc_results_2022.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_taxcalc_results_2022.py b/tests/test_taxcalc_results_2022.py index 9b4c63d3..2f3810ad 100644 --- a/tests/test_taxcalc_results_2022.py +++ b/tests/test_taxcalc_results_2022.py @@ -13,7 +13,7 @@ from tmd.imputation_assumptions import TAXYEAR, SOI_IITAX_SPEC MAX_RELATIVE_TOLERANCE = { - "n_returns_mil": 0.081, + "n_returns_mil": 0.082, "amount_bil": 0.004, }