Skip to content

Commit bc8b3e3

Browse files
MaxGhenisclaude
andauthored
Prefix state ACA spending calibration label with state/ (#779)
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 #778 (state Medicaid label prefix) as an analogous but higher-severity bug (real calibration-weighting impact vs naming-consistency for #778). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b9761a6 commit bc8b3e3

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Re-prefix state ACA spending calibration label with state/ (was nation/) so reweight() correctly classifies it as a state target.

policyengine_us_data/utils/loss.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,10 @@ def build_loss_matrix(dataset: type, time_period):
818818
"aca_ptc", map_to="household", period=time_period
819819
).values
820820

821-
# Add a loss-matrix entry and matching target
822-
label = f"nation/irs/aca_spending/{row['state'].lower()}"
821+
# Add a loss-matrix entry and matching target. Prefix `state/`
822+
# so `reweight()` correctly classifies this as a state-level
823+
# (non-national) target via `startswith("nation/")`.
824+
label = f"state/irs/aca_spending/{row['state'].lower()}"
823825
loss_matrix[label] = aca_value * in_state
824826
annual_target = row["spending"]
825827
if any(loss_matrix[label].isna()):

0 commit comments

Comments
 (0)