Prefix state ACA spending calibration label with state/#779
Merged
MaxGhenis merged 1 commit intoPolicyEngine:mainfrom Apr 17, 2026
Merged
Conversation
Line 820 labeled the per-state ACA spending target
`nation/irs/aca_spending/{state}` — starting with `nation/` even
though every row is specific to one state. `reweight()` classifies
targets via `columns.str.startswith("nation/")` and divides the
normalisation weight by the count of national versus state
targets, so this label was counted as a national target, diluting
the national-target pool with what are actually 50 state rows.
Sibling state labels use `state/` prefixes (e.g. line 849
`state/irs/aca_enrollment/{state}`, state AGI, state SNAP). Fix
the ACA spending label to match.
This was flagged during independent review of PR PolicyEngine#778 (state
Medicaid label prefix) as an analogous but higher-severity bug
(real calibration-weighting impact vs naming-consistency for PolicyEngine#778).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
_add_aca_and_medicaid_metric_columnsatutils/loss.py:820labels the per-state ACA spending targetnation/irs/aca_spending/{state}— starting withnation/even though every row is specific to one state.reweight()atdatasets/cps/enhanced_cps.py:115classifies targets viacolumns.str.startswith("nation/")and normalises nation vs state rows by their relative counts:So the ~50 per-state ACA-spending rows were being pooled with true national targets, diluting the national-normalisation weight for real national targets.
Fix
Matches the sibling state labels (
state/irs/aca_enrollment/{state}at line 849,state/{GEO_NAME}/{VARIABLE}/{band}for AGI,{GEO_ID}/snap-costfor SNAP).Context
Found during independent review of #778 (state Medicaid label prefix). While #778 was a naming-consistency fix that didn't actually change
reweight()behavior (label started withirs/, correctly classified as state), this one genuinely affects calibration weighting because the label starts withnation/.Test plan