Commit 3cf4de8
Fix state_pension_type classifying all pensioners as BASIC (#1618)
The formula used `sp.new_state_pension.active.values_list[0]` to find
the instant the New State Pension was switched on (2016-01-01 under
current law). policyengine-core auto-extrapolates values_list into the
far future in newest→oldest order, so `[0]` was returning a 2040s entry
instead of the activation instant. That made `years_since_instant`
negative, pushing `male_age` / `female_age` down to ~51, so every
pensioner was `over_age` → classified `BASIC` and nobody received the
New State Pension.
Walks the list oldest→newest and takes the first `True` value to get
the real activation instant. Adds baseline YAML tests covering both
BASIC and NEW classification on either side of the NSP activation.
Verified against the latest enhanced FRS dataset:
- BASIC pensioners: 12.06M → 7.36M weighted
- NEW pensioners: 0.00M → 4.71M weighted
- state_pension aggregate 2025: £116.2bn → £127.5bn
Remaining gap to OBR (~£140bn) is additional State Pension coverage,
outside this PR's scope.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent caadd1a commit 3cf4de8
3 files changed
Lines changed: 55 additions & 3 deletions
File tree
- changelog.d
- policyengine_uk
- tests/policy/baseline/gov/dwp
- variables/gov/dwp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
24 | 36 | | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
28 | | - | |
| 40 | + | |
29 | 41 | | |
30 | 42 | | |
31 | 43 | | |
| |||
0 commit comments