Impute capital gains amounts from the published joint distribution - #560
Open
MaxGhenis wants to merge 1 commit into
Open
Impute capital gains amounts from the published joint distribution#560MaxGhenis wants to merge 1 commit into
MaxGhenis wants to merge 1 commit into
Conversation
The stage redraws existing gainers' amounts from HMRC table 3 so the population can hold the gains above £2m that carry most of the tax. It owns amounts only: incidence comes from the candidate, household weights pass through untouched, and whether the published band facts also become calibration targets stays a separate adjudication. Taxable income is an arithmetic proxy — the persisted components of the model's total_income concept less a tapered Personal Allowance, with the allowance amounts read from the policyengine-uk parameter tree at a stated instant through the uk extra's deferred import, following the US runtime's pattern. Within each income band the allocation is rank-preserving: the top of the existing ranking absorbs the published taxpayer mass, highest gain band first, scaled to the available mass where the population holds less than HMRC's taxpayers. Amounts then come from within-band distributions matched to each cell's published mean — truncated exponential on bounded bands, Pareto on the open top band — with a suppressed cell falling back to its band-total mean. Gainers beyond the taxpayer mass keep their existing amounts capped at the annual exempt amount rather than being invented into the liability distribution or deleted. Draws are seeded on the build period, so a build is reproducible and two periods draw differently. A summary helper reports achieved band totals against the published surface; it is reporting rather than a gate, since holding levels to the surface is the calibration question. Part two of #552, on top of the source surface in #558. Co-Authored-By: Claude Opus 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.
Part two of #552, stacked on #558 (the source surface). Review #558 first; this PR's own diff is the last commit.
What the stage does
Redraws existing gainers'
capital_gainsfrom HMRC table 3 — the published joint distribution of size of gain by taxable income — so the population can hold the gains above £2m that carry most of the tax. The measured gap this closes: the two top bands hold 54.6% of UK CGT and effectively none of the modelled tax, because the incumbent percentile source stops near £1m.The stage owns amounts only. Incidence comes from the candidate, household weights pass through untouched (no mass change to record), and whether the published band facts also become calibration targets remains the fence adjudication recorded on the issue — nothing here assumes an answer.
Design
total_incomeconcept (ITA 2007 s.23) and subtracts a tapered allowance, with the allowance amounts read from the policyengine-uk parameter tree at a stated instant — theukextra's deferred-import pattern, per its own comment that the base package never imports policyengine-uk at import time.state_pension_reportedstands in forsocial_security_income; reliefs are not deducted. Both divergences are documented where they can move a person one band.summarize_uk_cgt_imputationcompares achieved band totals with the published surface. It is reporting, not a gate: where the population holds less gainer mass than HMRC's taxpayers the achieved totals sit below published by construction, and holding levels to the surface is the calibration question.What it deliberately does not do
No
family_coverageentry, nocgt_source_stages.json, no band-levelUK_CGT_TARGET_SPECS. Promoting the stage torequired_at_buildand declaring targets follow the fence adjudication on #552, on the individuals-only basis (the two existing facts include trusts).Tests
17 new tests: proxy arithmetic including the taper, mean-matching for both draw families (with the removable singularity at the uniform midpoint covered), determinism, rank preservation, the sub-AEA remainder, suppressed-cell fallback, artifact verification before read, and the parameter-tree read (runs when the
ukextra is installed;importorskipotherwise — it is absent from the secrets-free PR gate by design). Full populace-build suite green locally with the extra installed.🤖 Generated with Claude Code