Scoped UK runs give the region UK-wide business rates and region-relative ranks
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 8
- フォーク
- 10
- 平均マージ
- 19時間 40分
- マージ済み PR(30日)
- 37
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine.py のほかの issue
-
Raise the simulation cache memory warning to 16 GiB対応中かも @anth-volk が 16 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
PolicyEngine/policyengine.py#549 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PolicyEngine/policyengine.py#473 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
PolicyEngine/policyengine.py#436 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Certify populace-uk as the UK certified default再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PolicyEngine/policyengine.py#408 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
PolicyEngine/policyengine.py#636 ·
メンテナーはふだん 1 日以内に返信
PolicyEngine/policyengine.py の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
cellrishi-code/claude-skills-atlas#165 ·
メンテナーはふだん 1 日以内に返信
-
bug confirmed issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
open-webui/open-webui#32635 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Filters: ?field:ne=null matches NULL rows instead of non-NULL ones対応中かも @rshdhere が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Netflix/metaflow-service#504 ·
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
gke-labs/kube-agents#3394 ·
メンテナーはふだん 1 日以内に返信
-
A2A audit timestamps end in +00:00Z (invalid ISO 8601)対応中かも @O1sumitkumar が今日担当しました。 オープンbug good first issue help wanted python
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信