Repository navigation
Conversation
Private renters who report a rent are redrawn with probability proportional to census private-rented households in the BRMA with their home's bedrooms, times the density of their rent on the BRMA's list of rents. A model fitted to the survey's own renters relates reported rents to list rents. Other households keep the census-weighted draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the rents table Bedrooms stay out of the dataset: saving num_bedrooms would also feed the wealth imputation, a separate change. The built-dataset tests read bedrooms from the raw household table. BRMA_DATA_SOURCES.md describes the rents table, the reported-rent model and its validation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in LHA Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Welsh Government FOI ATISN 25142 released the lists for April 2024 and April 2025; they reproduce the published 30th percentiles. Wales now takes medians and spreads from them, as England does. Northern Ireland keeps published 30th percentiles with the typical spread of the other nations' lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The weighted Pearson statistic divided by the effective sample size is not chi-square when a few heavily weighted households have uneven BRMA probabilities: it failed on a correct build. The log score of independent draws has an exact mean and variance; it passes on this branch's build and fails at z = -19 on a census-only (uk-data#516) build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
PolicyEngine/policyengine-uk#2022 (published LHA rates) is merged into policyengine-uk main at c004e5318 (PR head 088addbb3). What this means for this PR's impact section, which reads #2022 at 23a31d5:
|
This branch has not been deployed
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.
Stacked on #516 (base
brma-private-rented-weights); retarget tomainafter #516 merges.What changes
#516 draws each FRS household's Broad Rental Market Area (BRMA) within its region in proportion to census private-rented households. The draw ignores the household's rent, so a high-rent household is as likely as a low-rent one to land in its region's cheapest BRMA. That breaks the link between a renter's rent and its Local Housing Allowance (LHA) rate, which decides whether rent is above the cap and how much UC and HB pay towards it.
Private renters who report a rent (
ptentyp23 or 4,hhrent> 0) are now redrawn:P(BRMA | region, bedrooms, rent) ∝ census private-rented households(BRMA, bedroom band) × density of the rent on the BRMA's list of rents for homes of that size.
bedroom6. The LHA category describes entitlement: an under-35 single person renting a one-bedroom flat is category A, but pays a one-bedroom rent.fit_reported_rent_model). On FRS 2024-25:Fitting at build time takes a few seconds.
The rents table
storage/brma_private_rents.csv: 1,000 rows (200 BRMAs × categories A-E) giving the median weekly rent and the standard deviation of log rents, in 2024-25 prices.tools/brma_rents/downloads every source, checks it against a pinned sha256 and rebuilds the file. All sources are public (OGL); no survey data goes into the table.Every list and percentile is uprated to 2024-25 with the ONS Price Index of Private Rents for its region or nation. Each region has its own fitted shift, which absorbs a region-wide error in that uprating; what drives the draw is a BRMA's rents relative to the rest of its region.
Wales. The Welsh lists reproduce the published April 2024 and April 2025 30th percentiles: median difference 0, with 94% and 98% of cells within 1%.
Northern Ireland publishes no lists, so it uses the Scottish construction with a borrowed spread. To test that treatment, I applied it to the three nations whose lists exist. An FRS renter's BRMA probabilities move by 4.5 points of total variation in England, 7.4 in Wales and 6.6 in Scotland. Conditioning on rent at all moves them by 20.5, 21.3 and 32.8. So the percentile treatment keeps most of the information.
Invariants
These hold for every census table, rents table, model and set of households with data for their cells. Hypothesis property tests are in
tests/test_brma_rent_conditioning.py:ValueErroris raised for a non-positive rent, a home with no bedrooms, a missing region × band cell, a BRMA in the cell with no list of rents, or a region with no fitted shift. A household is never left without a BRMA.Three example tests run on a built FRS dataset:
Results on three builds:
TESTING=1build of 6184534Validation
The mean probability given to the true BRMA rises from 0.085 (census shares) to 0.129.
The top choice is right for 21.8% of entries, against 16.1%.
Stated probabilities match observed frequencies:
Impact
Method. Each figure is the exact expected change over the BRMA draw, with no draw noise and dataset weights held fixed. The calculation:
Results are shown for policyengine-uk main and for #2022 head 23a31d5, which has the published LHA rates. Main's Scottish, Welsh and NI rates come from the copied lists (#515), so #2022 is the one to read.
#2022 head, UK: change from the census-only draw
#2022 head, 2026, by nation
Mean weekly LHA changes by the same amount in every year because #2022's rates are the same in 2024, 2025 and 2026: the April 2024 determination, then frozen.
policyengine-uk main, UK
What moves.
Against DWP. CIH UK Housing Review 2026 table 111b (sourced to DWP Stat-Xplore) gives the share of private-rented UC households with a housing element whose LHA does not cover their rent, each May. The model counterpart is UC recipients with a housing element whose rent exceeds their UC LHA rate. The definitions differ: FRS-reported rent against DWP's verified rent, and benefit units against claim households.
(#2022 head; model years 2024 and 2025.)
Across the 11 areas CIH publishes (9 English regions, Wales and Scotland):
So the model already overstates rent above LHA by about 14 points with the census-only draw. This PR gets the pattern across areas closer to DWP's but widens the level gap. The level gap predates this PR, and its cause is not established here. Candidates to check:
It is a separate investigation. On main, whose Scottish and Welsh rates are wrong, the correlation is 0.32-0.39 under either draw.
Draw noise. Rent conditioning lowers the noise of a single BRMA draw only a little. Single-draw standard deviations, exact, #2022 head, 2026:
A handful of heavily weighted households carry most of the variance. Lower-variance sampling is separate work and composes with this PR: its samplers take these probabilities in place of the census shares.
Not in this PR
num_bedroomsis not saved to the dataset, because the wealth imputation lists it as a predictor and, with the column absent, receives the default of zero for every household. That is a separate fix.Merge
uk-data fixes are approved on gates but land together in one data release on Max's go. This PR stays a draft until #516 merges.
It also needs a methodology call. The draw is more faithful: its probabilities are calibrated out of sample, census shares are kept, and the pattern across areas moves closer to DWP's. But it widens the model's existing overstatement of rent above LHA, by about 8 points UK-wide.
Commands run
TESTING=1 python policyengine_uk_data/datasets/create_datasets.py), thenpytestontest_brma_rent_conditioning.py,test_brma_assignment.py,test_frs_survey_year.pyandtest_legacy_benefit_proxies.pyagainst it: 47 passed. (Stacked PRs get only the deploy check in CI, so the dataset build and tests were run locally.)python tools/brma_rents/build.py <cache> --checkverifies all 6 sources by sha256 and reproduces the committed table.ruff format --checkandruff checkon changed files: clean.Aggregates only: no survey records appear in this PR or its tables.
🤖 Generated with Claude Code