Skip to content

Fix aggregate_microdata to reflect structural hook changes in budget impact#33

Merged
nikhilwoodruff merged 2 commits intomainfrom
fix/aggregate-microdata-from-programs
Apr 10, 2026
Merged

Fix aggregate_microdata to reflect structural hook changes in budget impact#33
nikhilwoodruff merged 2 commits intomainfrom
fix/aggregate-microdata-from-programs

Conversation

@nikhilwoodruff
Copy link
Copy Markdown
Contributor

When sim.run() delegates to aggregate_microdata for structural reforms, the budget impact was always £0 because post-hooks modify individual benefit/tax columns (e.g. reform_universal_credit) but not the pre-computed reform_total_benefits on households.

Now recomputes totals by summing individual program columns from persons (tax) and benunits (benefits). Also detects residual net income changes from hooks that modify reform_net_income directly without touching individual program columns.

Tested against 143 policies in 10ds-microsim — 75 now show non-zero budget impacts, up from ~30 before.

Test plan

  • Run structural reform (e.g. UC standard allowance increase) via sim.run() and verify non-zero net_cost
  • Run parametric reform and verify results unchanged
  • Verify winners_losers still correct for both types

nikhilwoodruff and others added 2 commits April 10, 2026 13:14
When structural post-hooks modify individual benefit/tax columns (e.g.
reform_universal_credit on benunits), the pre-computed household-level
reform_total_benefits wasn't updated, so the budgetary impact showed £0.

Now recomputes reform totals by summing individual program columns from
persons (tax) and benunits (benefits), then detects any residual change
in reform_net_income not explained by program-level changes (for hooks
that modify net income directly without touching individual columns).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nikhilwoodruff nikhilwoodruff merged commit ccbd514 into main Apr 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant