Repository navigation
Extrapolate post-2022 weights using a CBO returns (not a CBO population) projection - #546
Merged
Merged
Conversation
martinholmer
marked this pull request as draft
September 8, 2026 23:25
martinholmer
marked this pull request as ready for review
September 9, 2026 20:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Walkthrough of PR 546
Commits
1c02462..8b895f3, six commits in all, relative toorigin/master(
a442830). The headline change is how post-TAXYEAR sampling weights areextrapolated; the rest of the PR is pipeline ordering, path constants, and
documentation cleanup.
1. Grow weights with CBO's tax-return projection (
1c02462)Previously the TAXYEAR (2022) weights were scaled forward by CBO's total
population growth, which implicitly holds returns-per-capita fixed. CBO
projects the number of returns growing about twice as fast as population
(+11.9% vs +5.9% over 2022-2036) because the filing share keeps rising, so
population growth pushed aggregate AGI and income tax revenue progressively
below CBO's projections.
Changes:
tmd/storage/input/cbo26_returns.yaml— CBO's projectednumber of individual income tax returns (161.3M in 2022 rising to 180.5M in
2036), taken from the same workbook/sheet/row that supplies
n_returns_milin
tests/expected_cbo_levels_2022_data.yaml.tmd/utils/weight_growth.pywithcumulative_growth(first_year, last_year): year-over-year return growth through the last projected returnyear (2036, the end of the CBO budget window), then population growth
thereafter (which holds returns-per-capita fixed at its final projected
value) out to the last weight year.
tmd/imputation_assumptions.pyaddsRET_FILE/RETURNS_FILE, keyed byTAXYEAR.
RETURNS_FILE = None(as for TAXYEAR 2021) falls back topopulation growth in every year, so the old behavior is still reachable.
tmd/create_taxcalc_sampling_weights.pyandtmd/areas/create_area_weights.pyboth now callcumulative_growth, sonational and sub-national weights are extrapolated identically.
tests/test_weight_growth.py(96 lines) checks the growthdictionary covers all weight years, anchors at 1.0 in TAXYEAR, and tracks
the return projection through its last year.
2022 weights are unchanged (fingerprints hold); every post-2022 weight is
larger. Expected-value files move accordingly:
tests/expected_tax_exp_2022_datarises ~1% across the board (e.g. 2023iitax2332.3 -> 2357.2,paytax1431.0 -> 1446.3), and the fourexp_totben_2022values intests/test_imputed_variables.pyrise ~1-2%.2.
tests/expect_tmd_revenues: branch vs masterThis is the clearest evidence of the improvement. TMD's
ACTUALaggregateincome tax revenue moves up toward CBO's
EXPECT, while the calibrated 2022anchor is untouched.
Sum over 2022-2035 of squared PCTDIFF for
iitaxfalls from 174.05 to19.00. The
EXPECT(CBO) column is unchanged. On master the shortfallgrows monotonically to -5.06% by 2035; on the branch every year from 2027
on is within about 1.6%, and 2031-2035 within 0.2%. The one remaining
outlier, 2023 (+3.22%, up from +2.13%), is a known level discrepancy in the
2023 comparison rather than a drift.
3. Build the growth-factors files first (
963f56a)Makefilenow expresses real dependencies for thetmd_filespipeline:growfactors.csv->tmd_growfactors.csv->tmd.csv.gz->tmd_weights.csv.gz. Previously the input-variables and weights stages ranbefore the growth-factors stage, even though later stages need
growfactors.csvas the Policy-parameter indexing file andtmd_growfactors.csvas the Records-variable extrapolation file.Consistent with that, every place that built a
taxcalc.Policy()with thelibrary's built-in growth factors now passes the project's own
growfactors.csv:tmd/create_taxcalc_cached_files.py,tmd/datasets/cps.py,tmd/utils/soi_replication.py, andtmd/utils/taxcalc_output.py.4. Centralize output paths (
5dd5776)tmd/storage/__init__.pygainsPOLICY_GROWFACTORS_PATH,TMD_VARIABLES_PATH,TMD_WEIGHTS_PATH, andTMD_GROWFACTORS_PATH. Thefour path-only pytest fixtures in
tests/conftest.py(
tmd_variables_path,tmd_weights_path,tmd_growfactors_path,policy_growfactors_path) are deleted, and the six tests that used themimport the constants directly instead. Net effect: fewer fixtures, shorter
test signatures, one place where output paths are defined.
5. Narrow the CBO revenue-level tolerances (
9a3ad99)tests/test_revenue_levels_cbo.pytightensRELTOLforn_returns_mil,agi_bil, andiitax_bilfrom 2%/5%/6% in 2026/2031/2036 to a flat 1%in every checked year — a tolerance that only passes because of the change in
section 1.
6. Area-weight plumbing and docs (
348b7f3,8b895f3)tmd/areas/batch_weights.pyandtmd/areas/sweep_params.pydrop thenow-unneeded
_WORKER_POP/_POPpreloaded population dictionary and thePOPFILE_PATHimport, callingcumulative_growthinstead.batch_weights.py's staleness check addstmd/utils/weight_growth.pyandthe returns YAML file (when one is configured) to its dependency list, so
area weights rebuild when the projection changes.
README.mddeclares TMD version 2.2.0 (released 2026-09-09): identicalto 2.1.4 except for the returns-based weight projection; 2022 weights and
fingerprints unchanged, all post-2022 weights larger. The older 2.0.0
release-notes block is removed. 118th CD fingerprints remain un-updated.
Scope summary
16 files differ from
origin/masterat the branch tip (+132/-146), plus thefiles introduced and then unchanged since
1c02462(
cbo26_returns.yaml,weight_growth.py,test_weight_growth.py,expect_tmd_revenues,expected_tax_exp_2022_data). No changes to theimputation or reweighting algorithms themselves — only to how the solved
TAXYEAR weights are carried forward, and to build ordering and test plumbing.