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:
added:
- Scotland-specific calibration targets for children under 16 (NRS mid-year estimates) and households with 3+ children (Census 2022) to improve accuracy of Scottish policy analysis.
2 changes: 2 additions & 0 deletions policyengine_uk_data/storage/demographics.csv
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ scotland_age_50_59,person-k,ons_age_sex_region,,,,,797,793,790,788,786,784,782,,
scotland_age_60_69,person-k,ons_age_sex_region,,,,,691,702,714,727,741,755,767,,,
scotland_age_70_79,person-k,ons_age_sex_region,,,,,506,520,534,546,557,565,575,,,
scotland_age_80_89,person-k,ons_age_sex_region,,,,,274,282,290,297,302,307,312,,,
scotland_children_under_16,person-k,nrs_mid_year_population_estimates,,,,,904,900,896,892,888,884,880,,,
scotland_households_3plus_children,household-k,scotland_census_2022,,,,,82,82,82,82,82,82,82,,,
south_east_age_0_9,person-k,ons_age_sex_region,,,,,1047,1044,1042,1039,1034,1028,1024,,,
south_east_age_10_19,person-k,ons_age_sex_region,,,,,1122,1119,1117,1114,1108,1102,1097,,,
south_east_age_20_29,person-k,ons_age_sex_region,,,,,1046,1062,1079,1093,1106,1114,1118,,,
Expand Down
23 changes: 23 additions & 0 deletions policyengine_uk_data/utils/loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,29 @@ def pe_count(*variables):

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

# Scotland-specific calibration targets
Comment thread
vahid-ahmadi marked this conversation as resolved.
# Children under 16 in Scotland
# Source: NRS mid-year population estimates
# https://www.nrscotland.gov.uk/statistics-and-data/statistics/statistics-by-theme/population/population-estimates/mid-year-population-estimates
scotland_children_under_16 = (region == "SCOTLAND") & (age < 16)
df["ons/scotland_children_under_16"] = household_from_person(
scotland_children_under_16
)

# Households with 3+ children in Scotland
# Source: Scotland Census 2022 - Household composition
# https://www.scotlandscensus.gov.uk/census-results/at-a-glance/household-composition/
# Count children per household, filter to Scotland households with 3+
is_child = sim.calculate("is_child").values
children_per_household = household_from_person(is_child)
household_region = sim.calculate("region", map_to="household").values
scotland_3plus_children = (household_region == "SCOTLAND") & (
children_per_household >= 3
)
df["ons/scotland_households_3plus_children"] = (
scotland_3plus_children.astype(float)
)

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