Skip to content

Fix residual detection in aggregate_microdata#34

Merged
nikhilwoodruff merged 1 commit intomainfrom
fix/aggregate-residual-guard
Apr 10, 2026
Merged

Fix residual detection in aggregate_microdata#34
nikhilwoodruff merged 1 commit intomainfrom
fix/aggregate-residual-guard

Conversation

@nikhilwoodruff
Copy link
Copy Markdown
Contributor

The residual check in aggregate_microdata was cancelling out legitimate benunit-level benefit changes. When a post-hook modifies reform_universal_credit on benunits but doesn't touch reform_net_income on households, the old logic computed a negative residual that subtracted the benefit increase back out.

Now only applies the residual adjustment when household net_income actually changed, trusting the program-level column sums otherwise. Also removes unused variables.

The residual check was cancelling out legitimate benunit-level benefit changes. When a post-hook modifies reform_universal_credit on benunits but not reform_net_income on households, the old logic computed a negative residual that subtracted the benefit increase.

Now only applies the residual when household net_income actually changed, trusting the program-level columns otherwise.
@nikhilwoodruff nikhilwoodruff merged commit 8c9f919 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