Narrow national gender x age targets to five-year bands (unblocks publishing)#442
Merged
Merged
Conversation
The national gender x age targets used 15-year bands (0-14, 15-29, ...). A band that wide pins only its own total: the calibration could satisfy 15-29 while distributing those people any way it liked within the band, and it settled on a distribution that starved 18-24 to ~3.4M against ONS's ~5.4M. The finer regional bands (10-19, 20-29) do not help, because they constrain regional weights rather than the national ones - the national target set had no age constraint below 15 years wide. Evidence: national gender x age was the only age constraint on national weights, and both a scrambled-weights build (2.98M raw) and a healthy one (5.32M raw) converged to ~3.4-3.5M, the signature of an unconstrained dimension rather than a corrupting stage. The ONS projection is published by single year of age, so this is a change of aggregation only. Also skips the superseded 15-year female_/male_ rows in demographics.csv, which would otherwise be emitted alongside the new bands and double-count the population (verified: 138.6M before the skip, 69.0M after, against ONS ~69.5M). Co-Authored-By: Claude Fable 5 <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.
Fixes #441.
Problem
Publishing has been blocked since 19 June: every
push.yamlrun fails attest_population_fidelity.py::test_young_adult_population_not_collapsed, so the workflow never reachesmake upload. No UK dataset has published for a month.The national gender x age targets used 15-year bands:
18-24 sits entirely inside 15-29. A band that wide pins only its own total — calibration can satisfy 12.86M while distributing those people any way it likes inside the band, and it settles on ~3.4M in 18-24 (26% of the band) where ONS implies ~5.4M (42%). Total population passes at 69.1M because the missing 2M are absorbed into other bands; the error is compositional.
The finer 10-year bands do not help: all 108
..._age_X_Ytargets areREGION-level and constrain regional weights, not national ones. The national set had no age constraint narrower than 15 years.Why this is the cause rather than a corrupting stage
Two builds with very different inputs converge on the same wrong answer:
A stage that corrupted the data would produce output tracking its input. Converging to ~3.4M from both 2.98M and 5.32M is what an unconstrained dimension looks like.
Change
Narrows
_GENDER_BANDSto five-year bands. The ONS projection is published by single year of age and_aggregate_agesalready sums arbitrary ranges, so this is a change of aggregation only — no new source data, no new download.Also adds
female_/male_to_SKIP_PREFIXESfordemographics.csv. That file hardcodes the superseded 15-year rows; without the skip they are emitted alongside the new five-year bands under a non-colliding naming scheme, double-counting the population. Verified: 138.6M before the skip, 69.0M after, against ONS ~69.5M.Verification
After the change, 36 national targets across 18 contiguous five-year bands:
20-24 is now pinned in its own band, and 18-24 straddles only two narrow bands instead of sitting inside one wide one.
Five tests pin the properties that matter: bands at most five years wide, contiguous and non-overlapping, 18-24 covered by more than one band, one target per band per sex (catching reintroduction of the CSV rows), and the national total in a sane range (catching double-counting).
What this does not claim
I have not run a full post-change build to confirm 18-24 lands near 5.4M — that needs CI. The prediction is explicit and falsifiable: if the guard still fails after this, the wide bands were not the binding constraint and the diagnosis in #441 is wrong.
Related
ni_class_2/ni_class_4OBR targets are also silently dropped on label-match failure, the same pattern Fix silently-dropped OBR receipts targets (sheet 3.9 is APD, not current receipts) #439 fixed for cash receipts. Not addressed here.