Test equivalisation factors and read scale from parameters (#307)#1663
Open
vahid-ahmadi wants to merge 1 commit intomainfrom
Open
Test equivalisation factors and read scale from parameters (#307)#1663vahid-ahmadi wants to merge 1 commit intomainfrom
vahid-ahmadi wants to merge 1 commit intomainfrom
Conversation
Adds YAML coverage for `household_equivalisation_bhc` and
`household_equivalisation_ahc` against the HBAI modified-OECD scale
(single adult, couple, couple with young/older children, lone parent).
Both formulas were hard-coding the scale weights even though matching
parameters already exist under `household.demographic.equiv.{bhc,ahc}`.
Wired the formulas to read those parameters — values are unchanged, so
the existing 1006 policy tests still pass.
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
Closes #307. Adds YAML coverage for the two equivalisation formulas against the worked examples in the HBAI quality and methodology report. Six test cases covering the modified-OECD scale: single adult, couple, couple with one young child (<14), couple with one older child (14+), couple with both, and lone parent with two young children.
While writing the tests I noticed
household_equivalisation_bhcandhousehold_equivalisation_ahcwere hard-coding the scale weights (0.67/0.33/0.2 and 0.58/0.42/0.2) even though matching parameter files already exist underhousehold/demographic/equiv/{bhc,ahc}/{first_adult,second_adult,child_over_14,child_under_14}.yaml. Wired the formulas to read those parameters — values match exactly so behaviour is unchanged, but the scale is now reform-tunable and the magic numbers are gone.Test plan
policyengine-core test policyengine_uk/tests/policy/baseline/household/demographic/equivalisation.yaml -c policyengine_uk— 6 cases pass.policyengine-core test policyengine_uk/tests/policy -c policyengine_ukreports 1006 passed.🤖 Generated with Claude Code