Commit 1f57e98
* Add state and AGI cross-tab EITC calibration targets (#802)
Extend build_loss_matrix() with two new target families sourced from
IRS SOI:
* Per-state EITC returns and amounts from Historical Table 2
(eitc_state.csv), ~102 new loss-matrix columns covering 50 states + DC.
* Per-(qualifying-children x AGI bucket) EITC returns and amounts from
Publication 1304 Table 2.5 (eitc_by_agi_and_children.csv), ~224 new
columns over the SOI small-bin AGI structure.
Both targets use the existing eitc_spending_uprating /
population_uprating factors so they move with the Treasury EITC and
population trajectories. A _skip_unverified_target helper keeps the
optimizer from consuming "[TO BE CALCULATED]" placeholders.
Also adds refresh_eitc_state_and_agi_targets.py, a parameterized
data-pull script that future-year refreshes can run with
--year <tax_year>, plus tests/unit/calibration/
test_eitc_extended_targets.py covering CSV shape, the IRS
state-sum-to-national crosscheck, loss-matrix column naming, and
placeholder skipping.
State sum crosscheck for TY2022: 23,679,560 returns / $59,178,091,000
vs IRS US row 23,692,190 returns / $59,204,588,000 — ~0.05% off,
within disclosure rounding. Gap vs Treasury outlay target
($77.3B) reflects the refundable-only Treasury definition; IRS SOI
is the correct comparator for the full eitc variable.
Related to #802.
* fixup! Add state and AGI cross-tab EITC calibration targets (#802)
* Drop contradictory Treasury+legacy EITC targets; add regression tests
Codex review of #803 found two internal contradictions in the EITC
target set: (1) the loss function targeted Treasury's $67B outlay
parameter alongside the new SOI-derived $59B state-row sum and $60B
AGI×children-row sum, forcing the optimizer onto an unsatisfiable
pareto front; (2) the legacy eitc.csv carried TY2020 per-child-count
values that duplicated (and conflicted with) the new cross-tab.
Fix by anchoring EITC calibration on IRS SOI TY2022 tables alone:
keep state and (child × AGI bucket) targets, drop the Treasury
aggregate column and the stale per-child-count rows. Treasury's
parameter is still used to derive the dollar uprating trajectory.
New tests cover the cases Codex flagged as unverified: mixed-
placeholder rows (valid returns + [TO BE CALCULATED] amount) must
keep the valid metric and drop the invalid one without breaking
matrix/target alignment; the "3 or more children" bucket uses >=
so a 4-child household registers once, in c3 only; non-unity
uprating factors propagate to target values. Two regression tests
pin the removals: nation/treasury/eitc must never appear as a
loss-matrix column, and count_children_ slugs stay out of the
source.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Apply ruff format to cps.py
Pre-existing format drift from #801 that ruff 0.9.0+ flags; unblocks
the lint check on this branch. No behavior change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b1904f0 commit 1f57e98
9 files changed
Lines changed: 1140 additions & 53 deletions
File tree
- changelog.d
- policyengine_us_data
- datasets/cps
- storage/calibration_targets
- utils
- tests/unit/calibration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
502 | 499 | | |
503 | 500 | | |
504 | 501 | | |
| |||
This file was deleted.
Lines changed: 114 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments