Scoped UK runs give the region UK-wide business rates and region-relative ranks
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 15/100
Hướng nghiên cứu
The problem sits in how policyengine-uk formulas (shareholding, business_rates, household_income_decile, in_relative_poverty_bhc) normalise over the dataset, so scoped runs in policyengine.py 6.2.3 see region totals. Start from the row-filter and region handling added in #565, and compare a scoped run against the national run for the same households. Done means a maintainer has chosen between the two options in the issue, and the chosen approach is implemented and checked against the national-run figures in the table.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
A UK simulation scoped by row filter (nation, constituency or local-authority regions, or any RowFilterStrategy/RegionGroupStrategy) runs policyengine-uk on the filtered households only. Several policyengine-uk formulas normalise over the households in the dataset. On a filtered dataset they normalise over the region instead of the UK, so the region's households receive UK-wide totals and region-relative ranks.
Measured on 2026-10-08/09 with policyengine-uk 2.102.3 on the certified enhanced_frs_2024_25_year_2026.h5 (baseline policy, 2026). The nation rows were re-run on main at 07bae75 (6.2.3, #565's region filters) and match the first measurement exactly. Each figure compares a scoped run with the same households in the national run:
| scope | households | business rates, scoped | same households, national run | household net income, scoped | same households, national run |
|---|---|---|---|---|---|
| country/england | 37,961 | £31.73bn | £27.28bn | £1,487.19bn | £1,492.28bn |
| country/scotland | 5,405 | £31.73bn | £2.37bn | £103.98bn | £139.15bn |
| country/wales | 3,821 | £31.73bn | £1.83bn | £49.28bn | £85.06bn |
| country/northern_ireland | 5,659 | £31.73bn | £0.25bn | £6.07bn | £43.75bn |
| constituency W07000105 | 143 | £31.73bn | £0.05bn | −£34.45bn | £3.48bn |
£31.73bn is the UK business-rates total. The national run splits it £27.28bn / £2.37bn / £1.83bn / £0.25bn across the four nations; every scoped run puts all of it on the region.
Which variables (Scotland, 5,405 households)
| variable | records that differ | scoped total | national run, same records |
|---|---|---|---|
shareholding |
484 | 1.00 | 0.07 |
business_rates |
4,375 | £31.73bn | £2.37bn |
corporate_sdlt |
4,375 | £3.13bn | £0.23bn |
expected_sdlt |
4,375 | £3.13bn | £0.23bn |
corporate_land_value |
4,375 | £2,058.6bn | £153.4bn |
household_income_decile |
1,340 | ||
household_wealth_decile |
2,072 | ||
pre_budget_change_ons_household_income_decile |
3,955 | ||
in_relative_poverty_bhc / _ahc |
45 / 89 | 736k / 751k weighted | 651k / 709k |
attends_private_school (persons) |
23 |
State Pension, LHA rates, weights and the absolute poverty thresholds match. The reform-only incidence variables (corporate_incident_tax_revenue_change, consumer_incident_tax_revenue_change, employer_ni_response_*) are zero in the baseline, so this run does not test them.
Mechanism (policyengine-uk 2.102.3, read this session)
shareholding= householdcorporate_sector_wealth/ Σ(corporate_sector_wealth×household_weight) over the dataset.business_rates=shareholding× UK business-rates revenue (all four nations).corporate_sdlt=shareholding× UK corporate stamp-duty revenue.corporate_land_valuedivides by the same dataset total. On a filtered dataset the shares sum to 1 over the region.household_income_decileranksequiv_hbai_household_net_incomewithin the dataset, so scoped runs report within-region deciles.in_relative_poverty_bhccompares income with 60% of the dataset's person-weighted median, so scoped runs use the region's median, not the UK's.
Who is affected
- policyengine.py 6.2.3: since #565, nation-scoped runs no longer raise; they return the totals above. Constituency and local-authority regions built with
include_constituencies/include_local_authoritiesproduce them too. - The simulation API: app-v2 → policyengine-api → simulation gateway → executor resolves UK nation regions through this registry. The executor still pins 6.2.1, where nation runs raise. PolicyEngine/policyengine-sim-api#733 (draft) moves it to 6.2.3, and PolicyEngine/policyengine-api#3877 restores the Scotland population test on it. Once those deploy, API nation results carry these totals unless this is fixed first.
Options
- Run nationally, then filter outputs, for UK row-filter strategies. Scoped results equal the national run restricted to the region by construction, including under reforms. A UK national run takes seconds. Regional deciles become UK deciles, unlike US state runs, which keep filtering before the run.
- Pass national values into the scoped run (for example
shareholdingfrom the unscoped baseline). This keeps within-region deciles. It cannot cover reform-dependent quantities such as the relative poverty median under a reform, or the reform-only incidence variables.
Option 1 changes what regional decile outputs mean, so it needs a decision.
- Ngôn ngữ chính
- Python
- Star
- 8
- Fork
- 10
- Merge trung bình
- 18 giờ 24 phút
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine.py
-
Raise the simulation cache memory warning to 16 GiBCó thể đã có người làm @anth-volk đã nhận 11 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PolicyEngine/policyengine.py#549 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine.py#473 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PolicyEngine/policyengine.py#436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Certify populace-uk as the UK certified defaultCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine.py#408 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Check the UK nation filters against policyengine-uk's country formulaCó thể đã có người làm @MaxGhenis đã nhận 3 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
PolicyEngine/policyengine.py#569 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PolicyEngine/policyengine.py
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
KalicoCrew/kalico#1012 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
esphome/esphome.io#7657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
VNG-Realisatie/gemma-zaken#2658 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
comp/gateway comp/plugins duplicate P3 type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NousResearch/hermes-agent#137019 ·
Maintainer thường phản hồi trong vòng 1 ngày