Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
changed:
- Tax-benefit targets updated from new DWP forecasts.
271 changes: 136 additions & 135 deletions policyengine_uk_data/storage/demographics.csv

Large diffs are not rendered by default.

88 changes: 44 additions & 44 deletions policyengine_uk_data/storage/tax_benefit.csv
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
name,unit,reference,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029
attendance_allowance_count,benefit-unit-m,dwp_benefit_tables_march_2024,1.6,1.6,1.4,1.4,1.4,1.5,1.6,1.7,1.7,1.7,1.8,
carers_allowance_count,benefit-unit-m,dwp_benefit_tables_march_2024,1.2,1.2,1.2,1.2,1.2,1.3,1.3,1.4,1.4,1.5,1.5,
dla_count,benefit-unit-m,dwp_benefit_tables_march_2024,1.8,1.6,1.2,1.2,1.2,1.2,1.2,1.2,1.3,1.3,1.3,
esa_count,benefit-unit-m,dwp_benefit_tables_march_2024,2.2,2.0,1.9,1.8,1.7,1.6,1.5,1.4,1.3,1.3,1.1,
housing_benefit_count,benefit-unit-m,dwp_benefit_tables_march_2024,4.0,3.4,3.0,2.7,2.5,2.4,2.1,1.9,1.8,1.7,1.6,
pension_credit_count,benefit-unit-m,dwp_benefit_tables_march_2024,1.7,1.6,1.5,1.4,1.4,1.3,1.3,1.3,1.2,1.2,1.1,
pip_count,benefit-unit-m,dwp_benefit_tables_march_2024,1.9,2.2,2.4,2.5,2.9,3.2,3.5,3.9,4.2,4.4,4.7,
universal_credit_jobseekers_count,benefit-unit-m,dwp_benefit_tables_march_2024,0.6,0.9,1.9,1.5,1.2,1.3,1.7,1.9,1.9,1.9,1.8,
universal_credit_non_jobseekers_count,benefit-unit-m,dwp_benefit_tables_march_2024,0.7,1.3,2.1,2.6,3.1,3.5,3.8,4.2,4.4,4.5,4.8,
winter_fuel_allowance_count,benefit-unit-m,dwp_benefit_tables_march_2024,11.6,11.4,11.1,11.3,11.4,11.6,10.8,11.0,11.0,10.9,10.9,
attendance_allowance,gbp-bn,dwp_benefit_tables_march_2024,5.7,5.9,5.3,5.3,5.7,6.7,7.7,8.0,8.2,8.4,8.8,
carers_allowance,gbp-bn,dwp_benefit_tables_march_2024,2.9,2.9,3.0,3.1,3.3,3.7,4.2,4.4,4.7,4.9,5.1,
dla,gbp-bn,dwp_benefit_tables_march_2024,8.1,7.2,5.8,5.7,6.0,6.8,7.3,7.5,7.8,8.1,8.2,
esa,gbp-bn,dwp_benefit_tables_march_2024,15.1,13.9,13.4,12.7,12.1,12.7,13.0,11.8,11.3,11.0,9.2,
esa_contrib,gbp-bn,dwp_benefit_tables_march_2024,4.6,4.5,4.6,4.5,4.5,4.9,5.2,5.2,5.2,5.3,5.3,
esa_income,gbp-bn,dwp_benefit_tables_march_2024,10.5,9.3,8.9,8.2,7.6,7.8,7.7,6.6,6.1,5.7,3.9,
housing_benefit,gbp-bn,dwp_benefit_tables_march_2024,20.7,18.4,17.3,16.1,15.6,15.5,14.4,12.4,12.5,12.1,11.2,
pip,gbp-bn,dwp_benefit_tables_march_2024,10.6,12.5,13.7,15.2,17.6,21.6,25.4,27.8,30.2,32.8,35.3,
statutory_maternity_pay,gbp-bn,dwp_benefit_tables_march_2024,2.4,2.5,2.5,2.6,2.7,2.8,3.2,3.3,3.3,3.4,3.5,
capital_gains_tax,gbp-bn,obr_march_2024_efo,,,,,16.9,14.8,15.2,16.2,18.9,21.3,23.5,
child_benefit,gbp-bn,obr_march_2024_efo,,,,,11.6,12.5,13.5,13.5,13.5,13.5,13.5,
council_tax,gbp-bn,obr_march_2024_efo,,,,,40.9,43.6,45.9,48.2,50.7,53.4,56.3,
council_tax_england,gbp-bn,obr_march_2024_efo,,,,,36.3,38.7,40.8,43.0,45.3,47.8,50.4,
council_tax_scotland,gbp-bn,obr_march_2024_efo,,,,,2.7,2.8,2.9,3.0,3.1,3.2,3.3,
council_tax_wales,gbp-bn,obr_march_2024_efo,,,,,1.9,2.0,2.1,2.2,2.3,2.4,2.5,
domestic_rates,gbp-bn,obr_march_2024_efo,,,,,0.4,0.4,0.4,0.4,0.4,0.4,0.4,
fuel_duties,gbp-bn,obr_march_2024_efo,,,,,25.1,24.6,24.7,27.3,27.6,28.0,28.2,
income_tax,gbp-bn,obr_march_2024_efo,,,,,250.5,279.2,302.7,315.8,331.4,348.7,363.3,
jobseekers_allowance,gbp-bn,obr_march_2024_efo,,,,,0.3,0.3,0.2,0.1,0.1,0.1,0.1,
ni_employee,gbp-bn,obr_march_2024_efo,,,,,74.0,70.7,55.5,57.2,59.4,61.4,63.2,
ni_employer,gbp-bn,obr_march_2024_efo,,,,,103.1,108.5,112.7,116.4,120.4,124.7,128.9,
pension_credit,gbp-bn,obr_march_2024_efo,,,,,4.9,5.4,5.8,5.9,5.7,5.4,5.3,
sdlt_residential,gbp-bn,obr_march_2024_efo,,,,,11.7,8.5,9.3,10.2,11.9,13.9,15.9,
stamp_duty_land_tax,gbp-bn,obr_march_2024_efo,,,,,15.4,11.5,12.8,13.8,15.8,18.1,20.4,
state_pension,gbp-bn,obr_march_2024_efo,,,,,109.8,124.6,138.1,146.0,150.5,153.2,158.0,
tax_credits,gbp-bn,obr_march_2024_efo,,,,,8.9,7.3,1.6,-0.1,-0.1,-0.1,-0.1,
tv_licence_fee,gbp-bn,obr_march_2024_efo,,,,,3.7,3.7,3.9,4.0,4.0,4.0,4.1,
universal_credit,gbp-bn,obr_march_2024_efo,,,,,42.6,51.8,67.0,74.3,77.6,80.8,87.2,
universal_credit_jobseekers,gbp-bn,obr_march_2024_efo,,,,,9.2,11.1,17.4,19.3,19.7,20.0,20.1,
universal_credit_non_jobseekers,gbp-bn,obr_march_2024_efo,,,,,33.4,40.7,49.5,55.0,57.9,60.8,67.1,
vat,gbp-bn,obr_march_2024_efo,,,,,159.7,169.6,173.9,180.3,188.0,195.9,204.1,
winter_fuel_allowance,gbp-bn,obr_march_2024_efo,,,,,2.0,2.0,1.9,1.9,1.9,1.9,2.0,
private_school_students,person-k,obr_march_2024_efo,557,557,557,557,557,557,557,557,557,557,557,
name,unit,reference,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029
attendance_allowance_count,benefit-unit-m,dwp_benefit_tables_march_2025,1.4,1.4,1.3,1.3,1.3,1.4,1.5,1.6,1.6,1.7,1.7,1.7
carers_allowance_count,benefit-unit-m,dwp_benefit_tables_march_2026,0.8,0.8,0.9,0.8,0.9,0.9,0.9,1.0,1.0,1.0,1.0,1.0
dla_count,benefit-unit-m,dwp_benefit_tables_march_2027,1.8,1.5,1.2,1.2,1.2,1.2,1.3,1.3,1.3,1.3,1.3,1.3
esa_count,benefit-unit-m,dwp_benefit_tables_march_2028,2.2,2.0,1.9,1.8,1.7,1.6,1.4,1.0,0.8,0.8,0.8,0.8
housing_benefit_count,benefit-unit-m,dwp_benefit_tables_march_2029,4.0,3.4,3.0,2.7,2.5,2.4,2.1,1.6,1.4,1.4,1.4,1.4
pension_credit_count,benefit-unit-m,dwp_benefit_tables_march_2030,1.7,1.6,1.5,1.4,1.4,1.4,1.3,1.4,1.3,1.2,1.2,1.2
pip_count,benefit-unit-m,dwp_benefit_tables_march_2031,1.9,2.2,2.3,2.5,2.8,3.2,3.5,3.8,4.1,4.3,4.5,4.6
universal_credit_jobseekers_count,benefit-unit-m,dwp_benefit_tables_march_2032,0.6,0.8,1.8,1.4,1.1,1.2,1.4,1.6,1.6,1.5,1.5,1.5
universal_credit_non_jobseekers_count,benefit-unit-m,dwp_benefit_tables_march_2033,0.7,1.3,2.2,2.7,3.1,3.6,4.1,4.7,5.1,5.2,5.3,5.4
winter_fuel_allowance_count,benefit-unit-m,dwp_benefit_tables_march_2034,11.6,11.4,11.1,11.3,11.4,11.6,1.3,1.3,1.2,1.2,1.2,1.2
attendance_allowance,gbp-bn,dwp_benefit_tables_march_2035,5.7,5.9,5.3,5.3,5.7,6.7,7.7,8.3,8.9,9.3,9.6,10.0
carers_allowance,gbp-bn,dwp_benefit_tables_march_2036,2.9,2.9,3.0,3.1,3.2,3.7,4.2,4.5,4.8,4.9,5.0,5.1
dla,gbp-bn,dwp_benefit_tables_march_2037,8.1,7.2,5.8,5.7,6.0,6.9,7.6,8.0,8.4,8.7,8.8,8.7
esa,gbp-bn,dwp_benefit_tables_march_2038,15.1,13.9,13.4,12.7,12.1,12.4,12.3,7.9,4.9,5.1,5.2,5.3
esa_contrib,gbp-bn,dwp_benefit_tables_march_2039,4.6,4.5,4.6,4.5,4.5,4.9,5.2,5.0,4.9,5.1,5.2,5.3
esa_income,gbp-bn,dwp_benefit_tables_march_2040,10.5,9.3,8.8,8.2,7.6,7.4,7.1,2.9,0.0,0.0,0.0,0.0
housing_benefit,gbp-bn,dwp_benefit_tables_march_2041,20.7,18.4,17.3,16.1,15.6,15.8,15.4,12.2,11.5,11.7,12.0,12.6
pip,gbp-bn,dwp_benefit_tables_march_2042,10.6,12.5,13.7,15.2,17.6,21.7,25.8,28.5,31.6,33.2,35.0,37.6
statutory_maternity_pay,gbp-bn,dwp_benefit_tables_march_2043,2.4,2.5,2.5,2.6,2.7,2.9,3.0,3.2,3.2,3.3,3.4,3.5
capital_gains_tax,gbp-bn,obr_march_2024_efo,,,,,16.9,14.5,13.3,19.7,19.4,20.2,23.1,25.5
child_benefit,gbp-bn,obr_march_2024_efo,,,,,11.6,12.5,13.5,13.5,13.5,13.5,13.5,
council_tax,gbp-bn,obr_march_2024_efo,,,,,40.9,43.3,46.4,48.9,51.4,54.2,57.0,60.0
council_tax_england,gbp-bn,obr_march_2024_efo,,,,,36.3,38.3,41.2,43.5,45.8,48.4,51.0,53.7
council_tax_scotland,gbp-bn,obr_march_2024_efo,,,,,2.7,2.9,3.0,3.1,3.2,3.3,3.4,3.5
council_tax_wales,gbp-bn,obr_march_2024_efo,,,,,1.9,2.1,2.2,2.3,2.4,2.5,2.6,2.7
domestic_rates,gbp-bn,obr_march_2024_efo,,,,,0.4,0.5,0.5,0.5,0.5,0.5,0.5,0.5
fuel_duties,gbp-bn,obr_march_2024_efo,,,,,25.1,24.8,24.4,24.4,27.0,27.3,27.3,27.0
income_tax,gbp-bn,obr_march_2024_efo,,,,,250.5,275.7,307.1,328.4,354.5,377.1,384.1,396.7
jobseekers_allowance,gbp-bn,obr_march_2024_efo,1.3,0.7,1.0,0.5,0.3,0.3,0.3,0.2,0.3,0.2,0.2,0.3
ni_employee,gbp-bn,obr_march_2024_efo,,,,,74,61.8,43.9,46.1,47.6,49.1,50.7,52.5
ni_employer,gbp-bn,obr_march_2024_efo,,,,,103.1,108.3,115.3,145.8,150.1,154.4,158.9,163.6
pension_credit,gbp-bn,obr_march_2024_efo,5.1,5.1,5.1,4.8,4.9,5.5,5.9,5.9,5.9,5.7,5.7,5.7
sdlt_residential,gbp-bn,obr_march_2024_efo,,,,,11.7,8.6,10.1,11.3,13.4,15.6,17.8,19.3
stamp_duty_land_tax,gbp-bn,obr_march_2024_efo,,,,,15.4,11.6,13.6,14.1,17.2,19.9,22.5,24.5
state_pension,gbp-bn,obr_march_2024_efo,,,,,109.8,124.6,138.1,146,150.5,153.2,158,
tax_credits,gbp-bn,obr_march_2024_efo,,,,,8.9,7.3,1.6,0,0,0,0,0
tv_licence_fee,gbp-bn,obr_march_2024_efo,,,,,3.7,3.7,3.9,4,4,4,4.1,
universal_credit,gbp-bn,obr_march_2024_efo,8.1,18.4,38.2,40.6,41.9,52.1,65.3,75.8,83.1,84.0,85.9,88.9
universal_credit_jobseekers,gbp-bn,obr_march_2024_efo,2.0,3.0,16.6,13.0,9.8,11.1,13.1,15.3,16.0,15.4,15.1,15.5
universal_credit_non_jobseekers,gbp-bn,obr_march_2024_efo,6.2,15.3,21.7,27.6,32.1,41.0,52.2,60.6,67.1,68.6,70.9,73.4
vat,gbp-bn,obr_march_2024_efo,,,,,159.7,168.9,170.3,178.8,186.6,193.9,201.7,209.8
winter_fuel_allowance,gbp-bn,obr_march_2024_efo,2.0,2.0,2.0,2.0,2.0,2.0,0.3,0.3,0.3,0.3,0.3,0.3
private_school_students,person-k,obr_march_2024_efo,557,557,557,557,557,557,557,557,557,557,557,
12 changes: 12 additions & 0 deletions policyengine_uk_data/tests/test_population.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def test_child_limit():
from policyengine_uk import Microsimulation
from policyengine_uk_data.datasets import EnhancedFRS_2022_23

# Initialize simulation
sim = Microsimulation(dataset=EnhancedFRS_2022_23)

population = sim.calculate("people", 2025).sum() / 1e6
POPULATION_TARGET = 69.5 # Expected UK population in millions, per ONS 2022-based estimate here: https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationprojections/bulletins/nationalpopulationprojections/2022based
assert (
abs(population / POPULATION_TARGET - 1) < 0.02
), f"Expected UK population of {POPULATION_TARGET:.1f} million, got {population:.1f} million."
6 changes: 1 addition & 5 deletions policyengine_uk_data/utils/incomes_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
statistics = pd.concat(dfs)
statistics = statistics[statistics.value.notnull()]

OBR_BASELINE = { # Policy baseline that targets are based on.
"gov.dwp.winter_fuel_payment.eligibility.require_benefits": False,
}


def create_target_matrix(
dataset: str,
time_period: str,
reform=OBR_BASELINE,
reform=None,
) -> np.ndarray:
"""
Create a target matrix A, s.t. for household weights w, the target vector b and a perfectly calibrated PolicyEngine UK:
Expand Down
42 changes: 36 additions & 6 deletions policyengine_uk_data/utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@
statistics = pd.concat(dfs)
statistics = statistics[statistics.value.notnull()]

OBR_BASELINE = { # Policy baseline that targets are based on.
"gov.dwp.winter_fuel_payment.eligibility.require_benefits": False,
}


def create_target_matrix(
dataset: str,
time_period: str,
reform=OBR_BASELINE,
reform=None,
) -> np.ndarray:
"""
Create a target matrix A, s.t. for household weights w, the target vector b and a perfectly calibrated PolicyEngine UK:
Expand Down Expand Up @@ -117,7 +113,7 @@ def pe_count(*variables):
df["obr/pension_credit"] = pe("pension_credit")
df["obr/stamp_duty_land_tax"] = pe("expected_sdlt")
df["obr/state_pension"] = pe("state_pension")
df["obr/tax_credits"] = pe("tax_credits")
# df["obr/tax_credits"] = pe("tax_credits")
df["obr/tv_licence_fee"] = pe("tv_licence")

uc = sim.calculate("universal_credit")
Expand Down Expand Up @@ -153,6 +149,38 @@ def pe_count(*variables):
"NORTHERN_IRELAND": "northern_ireland",
}
age = sim.calculate("age")

# Ensure local populations are consistent with national population
local_population_total = 0
for pe_region_name, region_name in region_to_target_name_map.items():
for lower_age in range(0, 90, 10):
upper_age = lower_age + 10
name = f"ons/{region_name}_age_{lower_age}_{upper_age - 1}"
local_population_total += (
demographics[demographics.name == name][
str(time_period)
].values[0]
* 1e3
)

population_scaling_factor = (
demographics[demographics.name == "ons/uk_population"][
str(time_period)
].values[0]
* 1e6
/ local_population_total
) * 0.9

for pe_region_name, region_name in region_to_target_name_map.items():
for lower_age in range(0, 90, 10):
upper_age = lower_age + 10
name = f"ons/{region_name}_age_{lower_age}_{upper_age - 1}"
statistics.loc[
(statistics.name == name)
& (statistics.time_period == int(time_period)),
"value",
] *= population_scaling_factor

for pe_region_name, region_name in region_to_target_name_map.items():
for lower_age in range(0, 90, 10):
upper_age = lower_age + 10
Expand All @@ -164,6 +192,8 @@ def pe_count(*variables):
)
df[name] = household_from_person(person_in_criteria)

df["ons/uk_population"] = household_from_person(age >= 0)

targets = (
statistics[statistics.time_period == int(time_period)]
.set_index("name")
Expand Down
Loading