diff --git a/changelog.d/2139.fixed.md b/changelog.d/2139.fixed.md new file mode 100644 index 0000000000..1bd5d9bd9b --- /dev/null +++ b/changelog.d/2139.fixed.md @@ -0,0 +1 @@ +- Model the 25p a week State Pension age addition at 80 (SSCBA 1992 s.79) for basic State Pension recipients, never uprated, and take it out of the reported amount before the flat-rate and additional pension split. diff --git a/changelog.d/state-pension-reported-weeks.changed.md b/changelog.d/state-pension-reported-weeks.changed.md new file mode 100644 index 0000000000..615785998d --- /dev/null +++ b/changelog.d/state-pension-reported-weeks.changed.md @@ -0,0 +1 @@ +Document that state_pension_reported is the weekly State Pension times 52, the weeks the State Pension components read it back at, and test the route from a survey's weekly amount to Income Tax under the Pension Tax Allowance. diff --git a/docs/book/programs/gov/dwp/state-pension.md b/docs/book/programs/gov/dwp/state-pension.md index fe4cc3c706..43eecf4156 100644 --- a/docs/book/programs/gov/dwp/state-pension.md +++ b/docs/book/programs/gov/dwp/state-pension.md @@ -1,6 +1,6 @@ # State Pension -The State Pension is modelled in PolicyEngine UK as three composable +The State Pension is modelled in PolicyEngine UK as four composable person-level variables, summed into the `state_pension` aggregate that flows into household benefits. This page describes the current model and the residual aggregate gap against OBR outturn tracked under @@ -8,7 +8,7 @@ and the residual aggregate gap against OBR outturn tracked under ## Components -Three variables under `gov/dwp/`: +Four variables under `gov/dwp/`: - **`basic_state_pension`** — the pre-2016 flat-rate State Pension paid to people who reached State Pension age before 6 April 2016 @@ -28,10 +28,66 @@ Three variables under `gov/dwp/`: - Both are the reported weekly amount above the type's full rate in the data year, `max(reported - flat_max_for_type, 0)`, uprated by September CPI as described below and multiplied by `WEEKS_IN_YEAR`. - -All three split the amount a person reported in the data year (the -dataset's first year) by the person's `state_pension_type` in the year -simulated, for anyone over State Pension age: +- **`state_pension_age_addition`** — the age addition: 25p a week + (`gov.dwp.state_pension.age_addition.amount`) for a person over the age of + 80 (`age_addition.age`) who is entitled to a retirement pension under the + Social Security Contributions and Benefits Act 1992 + ([s.79](https://www.legislation.gov.uk/ukpga/1992/4/section/79) and + [Sch 4 Part III para 8](https://www.legislation.gov.uk/ukpga/1992/4/schedule/4)), + read as a `BASIC` type with a State Pension reported in the data year. It + is never uprated: each Up-rating Order excludes it (for example + [SI 2026/148 art 3(2)(a)](https://www.legislation.gov.uk/uksi/2026/148/article/3/made)). + A new State Pension gets none, because s.79(1) covers only a retirement + pension "under this Act", words the Pensions Act 2014 inserted + ([Sch 12 para 85](https://www.legislation.gov.uk/ukpga/2014/19/schedule/12/paragraph/85)). + A person is over an age once they have attained it (SSCBA 1992 s.173). + The model reads age on 6 October, the middle of the fiscal year, as it + does for State Pension age, so a person who turns 80 by then gets the + year's £13 in full and one who turns 80 later in the year gets none until + the next. + +The survey records the State Pension in payment. For Family Resources +Survey respondents, `state_pension_reported` is the benefits table's weekly +State Pension amount (benefit code 5) times 52, and policyengine-uk-data maps +no separate code for the age addition (`datasets/frs.py`), so the model +assumes the reported amount of a basic State Pension recipient over 80 +includes it. `state_pension_reported_excluding_age_addition` takes the data +year's addition off, at the legislated 25p from 80, and the other three +components split what is left. The addition is part of `state_pension`, so +it is taxed and means-tested as the pension is. It is an increase of the +pension (s.79(1)), so the model taxes it with the pension it increases: +[ITEPA 2003 s.577](https://www.legislation.gov.uk/ukpga/2003/1/section/577) +charges the retirement pensions under SSCBA 1992 ss.44, 48A to 48BB, 51 and +78 as pension income, without naming s.79, and s.677 does not exempt the age +addition (the pre-2003 charge in ICTA 1988 s.617(1) reached every benefit +under Parts II to IV of the 1992 Act not excepted, and the age addition was +not excepted). Pension Credit counts it as retirement pension income +([State Pension Credit Act 2002 s.16(1)(e)](https://www.legislation.gov.uk/ukpga/2002/16/section/16)), +as do Universal Credit (Universal Credit Regulations 2013 regs 66(1)(a) and 67) and +pension-age Housing Benefit (Housing Benefit (State Pension Credit) +Regulations 2006 reg 29(1)(c)). It never reduces Carer's Allowance: an age +addition is adjusted only by reference to another age addition +([Overlapping Benefits Regulations 1979 reg 4(3)](https://www.legislation.gov.uk/uksi/1979/597/regulation/4) +and Sch 1 row 4), so `overlapping_state_pension` leaves it out. It does +reduce Scotland's Carer Support Payment: that payment overlaps with a +Retirement Pension, defined as "a pension payable under Part II and Part III +of the 1992 Act, excluding any additional pension or graduated retirement +benefit" +([SSI 2023/302 reg 16(3)(a) and (6)](https://www.legislation.gov.uk/ssi/2023/302/regulation/16)), +and the age addition is in Part III. So +`carer_support_payment_overlapping_state_pension` keeps it in. + +Two edges. A basic State Pension recipient over 80 whose reported amount is +below the addition (under 25p a week) has a reported amount of nil once the +addition is taken off, and is paid the £13 a year, which is more than they +reported. And the contributed `gov.contrib.cec.state_pension_increase` +reform scales `state_pension` as a whole, age addition included, although no +Up-rating Order raises the age addition. + +The basic, new and additional State Pension split the amount a person +reported in the data year (the dataset's first year), less any age addition, +by the person's `state_pension_type` in the year simulated, for anyone over +State Pension age: - The part up to that type's full rate in the data year is basic or new State Pension. It is uprated by the type's full rate: the year's over the @@ -460,9 +516,14 @@ part of the widening. | Protected Payment only computed for BASIC-type recipients | Fixed | #1634 (ASP now extends to NEW) | | `additional_state_pension` split the reported amount by the data year's State Pension type, paying part of it twice for records moving from basic to new cohorts | Fixed | #1921 | | `additional_state_pension` uprated additional pensions and protected payments by the full rate (the triple lock), not September CPI | Fixed | #1941 | +| The 25p age addition at 80 was not modelled: in the reported amount it was uprated as additional pension, and no one who turned 80 later got it | Fixed | #2139 | ### What's still open +- The Category D retirement pension, for people over 80 with no other + retirement pension or one below its rate (SSCBA 1992 s.78(3)), is not + modelled: [#2339](https://github.com/PolicyEngine/policyengine-uk/issues/2339). + - The data year's shortfall in the enhanced FRS: [policyengine-uk-data#493](https://github.com/PolicyEngine/policyengine-uk-data/issues/493). - The pension-age population and new-cohort awards in projected years: diff --git a/policyengine_uk/parameters/gov/dwp/state_pension/age_addition/age.yaml b/policyengine_uk/parameters/gov/dwp/state_pension/age_addition/age.yaml new file mode 100644 index 0000000000..817db0ead0 --- /dev/null +++ b/policyengine_uk/parameters/gov/dwp/state_pension/age_addition/age.yaml @@ -0,0 +1,11 @@ +description: A person entitled to a retirement pension under the Social Security Contributions and Benefits Act 1992 gets the age addition from this age. +values: + 1992-07-01: 80 +metadata: + unit: year + label: State Pension age addition age + reference: + - title: Social Security Contributions and Benefits Act 1992 s.79(1) + href: https://www.legislation.gov.uk/ukpga/1992/4/section/79 + - title: Social Security Contributions and Benefits Act 1992 s.173 (a person is over an age once they have attained it) + href: https://www.legislation.gov.uk/ukpga/1992/4/section/173 diff --git a/policyengine_uk/parameters/gov/dwp/state_pension/age_addition/amount.yaml b/policyengine_uk/parameters/gov/dwp/state_pension/age_addition/amount.yaml new file mode 100644 index 0000000000..6ce0906ad2 --- /dev/null +++ b/policyengine_uk/parameters/gov/dwp/state_pension/age_addition/amount.yaml @@ -0,0 +1,12 @@ +description: The Department for Work and Pensions adds this weekly amount, the age addition, to the retirement pension of a person over the age of 80. Up-rating Orders leave it out of the annual uprating, so it has stayed at 25p. +values: + 1992-07-01: 0.25 +metadata: + period: week + unit: currency-GBP + label: State Pension age addition + reference: + - title: Social Security Contributions and Benefits Act 1992 s.79(3) and Sch 4 Part III para 8 + href: https://www.legislation.gov.uk/ukpga/1992/4/schedule/4 + - title: Social Security Benefits Up-rating Order 2026 art 3(2)(a) (the age addition is not increased) + href: https://www.legislation.gov.uk/uksi/2026/148/article/3/made diff --git a/policyengine_uk/parameters/gov/social_security_scotland/carer_support_payment/overlapping_benefits.yaml b/policyengine_uk/parameters/gov/social_security_scotland/carer_support_payment/overlapping_benefits.yaml index f778025988..e51ec8d637 100644 --- a/policyengine_uk/parameters/gov/social_security_scotland/carer_support_payment/overlapping_benefits.yaml +++ b/policyengine_uk/parameters/gov/social_security_scotland/carer_support_payment/overlapping_benefits.yaml @@ -11,7 +11,8 @@ metadata: values: # Reg. 16(3) lists State Pension (all of a Pensions Act 2014 Part 1 # pension) and Retirement Pension (excluding additional pension and - # graduated retirement benefit), incapacity benefit, severe disablement + # graduated retirement benefit, but with any age addition, reg. 16(6)), + # incapacity benefit, severe disablement # allowance, maternity allowance, contribution-based JSA and contributory # ESA. Reg. 16(3)(e) lists widowed parent's allowance excluding additional # pension; it is listed as the whole payment. Its other overlapping @@ -19,7 +20,7 @@ values: # benefits, war widow's pension, industrial death benefit, training # allowance) are not listed. 2023-11-19: - - overlapping_state_pension + - carer_support_payment_overlapping_state_pension - incapacity_benefit - sda - maternity_allowance diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/carers_allowance_overlapping_benefits.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/carers_allowance_overlapping_benefits.yaml index 6467d450c6..ad78a7d40b 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/carers_allowance_overlapping_benefits.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/carers_allowance_overlapping_benefits.yaml @@ -92,7 +92,9 @@ country: ENGLAND output: state_pension_type: BASIC - state_pension: 7_000 + # Aged 80 on an old State Pension, so the 25p age addition is paid too + # (SSCBA 1992 s.79); it does not overlap (SI 1979/597 reg 4(3)). + state_pension: 7_000 + 0.25 * 52 overlapping_state_pension: 2_000 carers_allowance: 86.45 * 52 - 2_000 @@ -119,8 +121,11 @@ care_hours: 35 country: ENGLAND output: + # The reported amount of a person aged 80 includes the 25p age addition + # (SSCBA 1992 s.79), paid on its own. basic_state_pension: 184.90 * 52 - additional_state_pension: 13_000 - 184.90 * 52 + additional_state_pension: 13_000 - 0.25 * 52 - 184.90 * 52 + state_pension_age_addition: 0.25 * 52 overlapping_state_pension: 184.90 * 52 carers_allowance: 0 @@ -133,8 +138,11 @@ care_hours: 35 country: ENGLAND output: - overlapping_state_pension: 3_000 - carers_allowance: 86.45 * 52 - 3_000 + # The 25p age addition in the reported amount does not overlap: an age + # addition is adjusted only by reference to another age addition (SI + # 1979/597 reg 4(3); Sch 1 row 4, "except any age addition"). + overlapping_state_pension: 3_000 - 0.25 * 52 + carers_allowance: 86.45 * 52 - (3_000 - 0.25 * 52) - name: Case 9, a reported new State Pension below the allowance. period: 2026 diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/state_pension_age_addition.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/state_pension_age_addition.yaml new file mode 100644 index 0000000000..40751d4452 --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/state_pension_age_addition.yaml @@ -0,0 +1,167 @@ +# The age addition: 25p a week for a person over the age of 80 who is entitled +# to a retirement pension under the Social Security Contributions and Benefits +# Act 1992 (s.79(1) and (3), Sch 4 Part III para 8), never uprated (each +# Up-rating Order excludes it, e.g. SI 2026/148 art 3(2)(a)). A person is over +# an age once they have attained it (s.173). A new State Pension, under Part 1 +# of the Pensions Act 2014, is not a pension under that Act (s.79(1) as amended +# by the Pensions Act 2014 Sch 12 para 85). Annual amount: 0.25 x 52 = 13. + +- name: Case 1, aged 80 on the basic State Pension gets the age addition. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 80 + state_pension_type: BASIC + state_pension_reported: 9_100 + output: + state_pension_age_addition: 13 + is_SP_age: true + +- name: Case 2, aged 79 gets no age addition. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 79 + state_pension_type: BASIC + state_pension_reported: 9_100 + output: + state_pension_age_addition: 0 + +- name: Case 3, aged 85 on the new State Pension gets no age addition. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 85 + state_pension_type: NEW + state_pension_reported: 12_000 + output: + state_pension_age_addition: 0 + +- name: Case 4, below State Pension age gets no age addition. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 60 + state_pension_reported: 9_100 + output: + state_pension_type: NONE + state_pension_age_addition: 0 + +- name: Case 5, the age addition stays 25p a week in 2026-27. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 80 + state_pension_type: BASIC + state_pension_reported: 9_100 + output: + state_pension_age_addition: 13 + +- name: Case 6, the age addition stays 25p a week in 2030-31. + period: 2030 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 80 + state_pension_type: BASIC + state_pension_reported: 9_100 + output: + state_pension_age_addition: 13 + +- name: Case 7, no State Pension means no age addition. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 85 + state_pension_type: BASIC + state_pension_reported: 0 + output: + state_pension_age_addition: 0 + state_pension: 0 + +- name: Case 8, the computed State Pension type of a man aged 80 is basic. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 80 + gender: MALE + state_pension_reported: 9_100 + output: + state_pension_type: BASIC + state_pension_age_addition: 13 + +- name: Case 9, a reported full basic rate plus 25p is the full rate and the addition. + # 2025-26 basic State Pension £176.45 a week (SI 2025/295 art 4(2)(b)). The + # reported £176.70 a week is the full rate and the age addition, so there is + # no additional State Pension. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 85 + state_pension_type: BASIC + state_pension_reported: 9_188.4 + output: + basic_state_pension: 9_175.4 + additional_state_pension: 0 + state_pension_age_addition: 13 + state_pension: 9_188.4 + state_pension_reported_excluding_age_addition: 9_175.4 + +- name: Case 10, the age addition does not reduce Carer's Allowance. + # Overlapping Benefits Regulations 1979 reg 4(3) and Sch 1 row 4: an age + # addition is adjusted only by reference to another age addition. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 85 + state_pension_type: BASIC + state_pension_reported: 9_188.4 + output: + overlapping_state_pension: 9_175.4 + +- name: Case 11, State Pension components supplied directly also bring the age addition. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 82 + state_pension_type: BASIC + basic_state_pension: 2_000 + output: + state_pension_age_addition: 13 + state_pension: 2_013 + +- name: Case 12, a reported amount of exactly the age addition is the age addition. + period: 2026 + absolute_error_margin: 0.01 + input: + people: + person1: + age: 85 + state_pension_type: BASIC + state_pension_reported: 13 + output: + basic_state_pension: 0 + additional_state_pension: 0 + state_pension_age_addition: 13 + state_pension: 13 diff --git a/policyengine_uk/tests/policy/baseline/gov/social_security_scotland/carer_support_payment_overlapping_benefits.yaml b/policyengine_uk/tests/policy/baseline/gov/social_security_scotland/carer_support_payment_overlapping_benefits.yaml index dae6cb22bc..5bd8bda971 100644 --- a/policyengine_uk/tests/policy/baseline/gov/social_security_scotland/carer_support_payment_overlapping_benefits.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/social_security_scotland/carer_support_payment_overlapping_benefits.yaml @@ -102,7 +102,7 @@ carer_support_payment: 86.45 * 52 - 3_000 scottish_carer_supplement: 11.70 * 52 -- name: Case 6, the additional pension in an old State Pension does not overlap. +- name: Case 6, the additional pension in an old State Pension does not overlap; at 80 its age addition does (SSI 2023/302 reg 16(6)). period: 2026 absolute_error_margin: 0.01 input: @@ -112,7 +112,24 @@ care_hours: 35 country: SCOTLAND output: + state_pension_age_addition: 0.25 * 52 + carer_support_payment_overlapping_state_pension: 2_000 + 0.25 * 52 + # Carer's Allowance still leaves the age addition out (SI 1979/597 reg 4(3)). overlapping_state_pension: 2_000 + carer_support_payment: 86.45 * 52 - 2_000 - 0.25 * 52 + +- name: Case 6a, below 80 there is no age addition, so only the basic State Pension overlaps. + period: 2026 + absolute_error_margin: 0.01 + input: + age: 79 + basic_state_pension: 2_000 + additional_state_pension: 5_000 + care_hours: 35 + country: SCOTLAND + output: + state_pension_age_addition: 0 + carer_support_payment_overlapping_state_pension: 2_000 carer_support_payment: 86.45 * 52 - 2_000 - name: Case 7, a new State Pension overlaps in full, protected payment included. @@ -125,7 +142,7 @@ care_hours: 35 country: SCOTLAND output: - overlapping_state_pension: 7_000 + carer_support_payment_overlapping_state_pension: 7_000 carer_support_payment: 0 scottish_carer_supplement: 0 diff --git a/policyengine_uk/tests/test_carer_overlapping_benefits_properties.py b/policyengine_uk/tests/test_carer_overlapping_benefits_properties.py index 8bb3314a77..1f2e5b8a69 100644 --- a/policyengine_uk/tests/test_carer_overlapping_benefits_properties.py +++ b/policyengine_uk/tests/test_carer_overlapping_benefits_properties.py @@ -8,7 +8,10 @@ benefit paid with an old State Pension are left out (regs 4(2)(f) and 12). The Carer Support Payment Regulations (SSI 2023/302) reg 16(2)-(3) reduce Carer Support Payment in the same way, to £0 where the overlapping benefit is at -least as much. +least as much, with one difference: reg 16(6) leaves only additional pension +and graduated retirement benefit out of an old State Pension, so the 25p age +addition at 80 overlaps Carer Support Payment, while it never overlaps Carer's +Allowance (SI 1979/597 reg 4(3)). Invariants, for carers in England, Wales and Scotland in 2026, who qualify by hours or by a reported award, with State Pension supplied directly, by @@ -215,6 +218,9 @@ def rates(sim): * WEEKS, "basic": float(parameters.gov.dwp.state_pension.basic_state_pension.amount) * WEEKS, + "age_addition": float(parameters.gov.dwp.state_pension.age_addition.amount) + * WEEKS, + "age_addition_age": float(parameters.gov.dwp.state_pension.age_addition.age), "min_hours": float(parameters.gov.dwp.carers_allowance.min_hours), "carer_addition": float( parameters.gov.dwp.pension_credit.guarantee_credit.carer.addition @@ -224,10 +230,11 @@ def rates(sim): def reference(people, sim, extra=None): - """Unadjusted and overlapping amounts rebuilt from the drawn inputs.""" + """Unadjusted amounts, and the overlapping amounts for Carer's Allowance + and for Carer Support Payment, rebuilt from the drawn inputs.""" extra = extra or [0.0] * len(people) r = rates(sim) - unadjusted_ca, unadjusted_csp, overlapping = [], [], [] + unadjusted_ca, unadjusted_csp, overlapping, overlapping_csp = [], [], [], [] for i, person in enumerate(people): qualifies = ( person["care_hours"] >= r["min_hours"] @@ -239,6 +246,10 @@ def reference(people, sim, extra=None): pension_type = pension_type_for(person) pension = person["pension"] + extra[i] mode = person["mode"] + # The 25p age addition (SSCBA 1992 s.79): an old State Pension from 80. + # It overlaps Carer Support Payment (SSI 2023/302 reg 16(6)) but not + # Carer's Allowance (SI 1979/597 reg 4(3)). + age_addition = 0.0 if mode == "direct": # The model's convention: with no components, all of it overlaps. state_pension = pension @@ -246,9 +257,18 @@ def reference(people, sim, extra=None): # The model's split of a reported amount: an old State Pension # above the full basic rate is additional pension, which does not # overlap. A new State Pension overlaps in full, protected payment - # included, and there is none before pensionable age. + # included, and there is none before pensionable age. From 80 an + # old State Pension is taken to include the 25p age addition, + # which overlaps Carer Support Payment only. + with_age_addition = ( + pension_type == "BASIC" + and person["age"] >= r["age_addition_age"] + and pension > 0 + ) + age_addition = r["age_addition"] * with_age_addition + basic_reported = max(pension - age_addition, 0) state_pension = { - "BASIC": min(pension, r["basic"]), + "BASIC": min(basic_reported, r["basic"]), "NEW": pension, "NONE": 0, }[pension_type] @@ -258,15 +278,25 @@ def reference(people, sim, extra=None): "NEW": pension + person["additional"], "NONE": 0, }[pension_type] + # Components given directly bring the addition whenever there is + # a basic or additional State Pension. + age_addition = r["age_addition"] * ( + pension_type == "BASIC" + and person["age"] >= r["age_addition_age"] + and (pension > 0 or person["additional"] > 0) + ) else: state_pension = 0 # sda is not drawn, so the other overlapping benefits are the four # reported contributory benefits. - overlapping.append(state_pension + sum(person["other"].values())) + other = sum(person["other"].values()) + overlapping.append(state_pension + other) + overlapping_csp.append(state_pension + age_addition + other) return ( np.array(unadjusted_ca), np.array(unadjusted_csp), np.array(overlapping), + np.array(overlapping_csp), ) @@ -308,13 +338,16 @@ def pinned(age, country, mode, pension, additional=0.0, gender="MALE"): ] ) @example(people=[pinned(80, "WALES", "reported", 3_000)]) +# A reported old State Pension from 80 in Scotland: the 25p addition is part +# of the report and overlaps Carer Support Payment, so 2,987 + 13 overlaps. +@example(people=[pinned(80, "SCOTLAND", "reported", 3_000, gender="FEMALE")]) @example(people=[pinned(70, "ENGLAND", "direct", 4_495.4)]) def test_overlap_bounds_and_reference(people): sim = build(people) ca, csp = calc(sim, "carers_allowance"), calc(sim, "carer_support_payment") ca_pre = calc(sim, "carers_allowance_pre_overlap") csp_pre = calc(sim, "carer_support_payment_pre_overlap") - ref_ca_pre, ref_csp_pre, ref_overlap = reference(people, sim) + ref_ca_pre, ref_csp_pre, ref_overlap, ref_overlap_csp = reference(people, sim) # Components are assigned using age and gender, independently of the # model's calculated type. Check the default-birthday reference as well. @@ -338,12 +371,12 @@ def test_overlap_bounds_and_reference(people): np.testing.assert_allclose(ca_pre, ref_ca_pre, atol=TOLERANCE) np.testing.assert_allclose(csp_pre, ref_csp_pre, atol=TOLERANCE) np.testing.assert_allclose(ca_overlap, ref_overlap, atol=TOLERANCE) - np.testing.assert_allclose(csp_overlap, ref_overlap, atol=TOLERANCE) + np.testing.assert_allclose(csp_overlap, ref_overlap_csp, atol=TOLERANCE) np.testing.assert_allclose( ca, np.maximum(ref_ca_pre - ref_overlap, 0), atol=TOLERANCE ) np.testing.assert_allclose( - csp, np.maximum(ref_csp_pre - ref_overlap, 0), atol=TOLERANCE + csp, np.maximum(ref_csp_pre - ref_overlap_csp, 0), atol=TOLERANCE ) # 5. Scottish Carer Supplement only, and in full, with a payable CSP. diff --git a/policyengine_uk/tests/test_state_pension_components.py b/policyengine_uk/tests/test_state_pension_components.py index 7586378f28..e2fdda3c63 100644 --- a/policyengine_uk/tests/test_state_pension_components.py +++ b/policyengine_uk/tests/test_state_pension_components.py @@ -8,7 +8,10 @@ by the period's type, so together they split the reported amount with no overlap and no gap: the part up to the type's full rate is uprated by the full rate, and the part above it (additional pension, protected payments) by -September CPI, as the Up-rating Orders raise it (see add_on_uprating). +September CPI, as the Up-rating Orders raise it (see add_on_uprating). The +age addition, 25p a week from 80 on a basic State Pension, is paid on its own +and never uprated, so the components split the reported amount without it +(see net_weekly). The YAML runner builds simulations without a dataset, where the data year is the period by construction, so these cases build simulations from data. @@ -19,7 +22,7 @@ import numpy as np import pandas as pd import pytest -from hypothesis import HealthCheck, given, settings +from hypothesis import HealthCheck, example, given, settings from hypothesis import strategies as st from policyengine_uk import Microsimulation @@ -165,6 +168,32 @@ def approx(expected: float): return pytest.approx(expected, rel=INDEX_ROUNDING, abs=0.01) +# The age addition: 25p a week for a person over the age of 80 entitled to a +# retirement pension under the Social Security Contributions and Benefits Act +# 1992, which a new State Pension is not (s.79(1) and (3), Sch 4 Part III +# para 8), never uprated (e.g. SI 2026/148 art 3(2)(a)). The reported amount +# is taken to include it. +AGE_ADDITION_WEEKLY = 0.25 +AGE_ADDITION_AGE = 80 +AGE_ADDITION = AGE_ADDITION_WEEKLY * WEEKS_IN_YEAR + + +def receives_age_addition(pension_type, age, weekly): + """Basic State Pension type, aged 80 or over and some State Pension.""" + return ( + (np.asarray(pension_type) == "BASIC") + & (np.asarray(age) >= AGE_ADDITION_AGE) + & (np.asarray(weekly) > 0) + ) + + +def net_weekly(person: dict, data_year_type: str) -> float: + """The weekly amount the components split: the reported amount less the + age addition it includes in the data year.""" + receives = receives_age_addition(data_year_type, person["age"], person["weekly"]) + return max(person["weekly"] - AGE_ADDITION_WEEKLY * bool(receives), 0) + + def calculate(sim, variable: str, year: int) -> np.ndarray: return np.asarray(sim.calculate(variable, year)) @@ -222,13 +251,16 @@ def test_protected_payment_above_new_state_pension_follows_period_type(): ], ) def test_unchanged_type_splits_at_its_own_flat_rate(person, pension_type): + """The 90-year-old's reported amount includes the 25p age addition, which + is paid on its own; the 70-year-old, on the new State Pension, gets none.""" sim = projected_simulation([person]) + weekly = net_weekly(person, pension_type) + addition = AGE_ADDITION if pension_type == "BASIC" else 0 for year in YEARS: assert calculate(sim, "state_pension_type", year)[0] == pension_type total = sum(calculate(sim, v, year)[0] for v in COMPONENTS) - assert total == approx( - uprated_reported(sim, year, pension_type, person["weekly"]) - ) + assert total == approx(uprated_reported(sim, year, pension_type, weekly)) + assert calculate(sim, "state_pension_age_addition", year)[0] == addition def test_nothing_is_paid_once_the_record_falls_below_state_pension_age(): @@ -275,19 +307,20 @@ def test_new_in_data_year_and_basic_in_period_is_paid_in_full(): def test_additional_pension_rises_with_september_cpi_not_the_basic_rate(): """A man aged 90 in 2024-25 reached State Pension age in 1999, on the basic State Pension, as does a man aged 90 in any later year. He reports £200 a - week, £30.50 above the 2024-25 full basic rate. The Up-rating Orders raised - the basic State Pension by 4.1% and 4.8% and additional pensions by 1.7% - and 3.8% (SI 2025/295 and SI 2026/148, arts 4(2) and 4(3)(a)), so in - 2026-27 he gets £184.90 a week of basic State Pension and £30.50 x 1.017 x - 1.038 of additional State Pension.""" + week: the 25p age addition and £30.25 above the 2024-25 full basic rate. + The Up-rating Orders raised the basic State Pension by 4.1% and 4.8% and + additional pensions by 1.7% and 3.8% (SI 2025/295 and SI 2026/148, arts + 4(2) and 4(3)(a)), and left the age addition at 25p (art 3(2)(a)), so in + 2026-27 he gets £184.90 a week of basic State Pension, £30.25 x 1.017 x + 1.038 of additional State Pension and 25p.""" person = {"age": 90, "male": True, "months": 3, "weekly": 200} sim = projected_simulation([person]) for year in (DATA_YEAR, 2025, 2026): assert calculate(sim, "state_pension_type", year)[0] == "BASIC" - additional_2025 = (200 - 169.50) * WEEKS_IN_YEAR * 1.017 - additional_2026 = (200 - 169.50) * WEEKS_IN_YEAR * 1.017 * 1.038 + additional_2025 = (199.75 - 169.50) * WEEKS_IN_YEAR * 1.017 + additional_2026 = (199.75 - 169.50) * WEEKS_IN_YEAR * 1.017 * 1.038 assert calculate(sim, "additional_state_pension", DATA_YEAR)[0] == approx( - (200 - 169.50) * WEEKS_IN_YEAR + (199.75 - 169.50) * WEEKS_IN_YEAR ) assert calculate(sim, "additional_state_pension", 2025)[0] == approx( additional_2025 @@ -298,8 +331,9 @@ def test_additional_pension_rises_with_september_cpi_not_the_basic_rate(): assert calculate(sim, "basic_state_pension", 2026)[0] == approx( 184.90 * WEEKS_IN_YEAR ) + assert calculate(sim, "state_pension_age_addition", 2026)[0] == AGE_ADDITION assert calculate(sim, "state_pension", 2026)[0] == approx( - 184.90 * WEEKS_IN_YEAR + additional_2026 + 184.90 * WEEKS_IN_YEAR + additional_2026 + AGE_ADDITION ) @@ -447,10 +481,11 @@ def test_a_september_cpi_scenario_moves_the_add_on(): "age": st.integers(min_value=55, max_value=100), "male": st.booleans(), "months": st.floats(min_value=0, max_value=12, exclude_max=True), - # Include each data-year flat rate, where the split changes. + # Include each data-year flat rate, where the split changes, the + # age addition alone, and the basic rate with the age addition. "weekly": st.one_of( st.floats(min_value=0, max_value=600), - st.sampled_from([0, 169.5, 221.2]), + st.sampled_from([0, 0.25, 169.5, 169.75, 221.2]), ), } ), @@ -463,13 +498,39 @@ def by_type(pension_type: np.ndarray, basic, new) -> np.ndarray: return np.select([pension_type == "BASIC", pension_type == "NEW"], [basic, new], 0) +def stored_weekly(people: list) -> np.ndarray: + """Each record's reported weekly amount as the simulation holds it. + state_pension_reported is a float variable, which the model stores in + float32, so an amount too small for float32 (Hypothesis draws amounts down + to 5e-324 a week) is held as nil: the record reports no State Pension.""" + annual = np.array([p["weekly"] * WEEKS_IN_YEAR for p in people], np.float32) + return annual.astype(float) / WEEKS_IN_YEAR + + +def data_year_net_weekly(sim, people: list) -> np.ndarray: + """Each record's reported weekly amount less the age addition it includes + in the data year.""" + weekly = stored_weekly(people) + included = receives_age_addition( + calculate(sim, "state_pension_type", DATA_YEAR).astype(str), + calculate(sim, "age", DATA_YEAR), + weekly, + ) + return np.maximum(weekly - AGE_ADDITION_WEEKLY * included, 0) + + def assert_components_add_up(sim, people: list, years) -> None: """For each person and year: below State Pension age, no component and type NONE. Over it, only the period type's flat-rate component, which is the - reported amount up to the type's full rate, uprated by the full rate; and, - deflating each component by its own uprating, the three components add up - to exactly the reported amount, with no overlap and no gap.""" - weekly = np.array([p["weekly"] for p in people]) + reported amount net of the age addition up to the type's full rate, + uprated by the full rate; and, deflating each component by its own + uprating, the three components add up to exactly that net amount, with no + overlap and no gap. The age addition is 25p a week exactly when the record + is on the basic State Pension, aged 80 or over and has a State Pension, in + every year; in the data year the four parts add up to the reported amount + whenever it is at least 25p a week.""" + reported_weekly = stored_weekly(people) + weekly = data_year_net_weekly(sim, people) for year in years: pension_type = calculate(sim, "state_pension_type", year).astype(str) over_spa = calculate(sim, "is_SP_age", year).astype(bool) @@ -499,10 +560,36 @@ def assert_components_add_up(sim, people: list, years) -> None: assert np.all(additional >= 0) assert np.all(basic <= rates["BASIC"] * WEEKS_IN_YEAR * (1 + 1e-6)) assert np.all(new <= rates["NEW"] * WEEKS_IN_YEAR * (1 + 1e-6)) + addition = calculate(sim, "state_pension_age_addition", year) + receives = receives_age_addition( + pension_type, calculate(sim, "age", year), reported_weekly + ) + assert np.array_equal(addition, receives * AGE_ADDITION), year + if year == DATA_YEAR: + total = basic + new + additional + addition + full_record = over_spa & (reported_weekly >= AGE_ADDITION_WEEKLY) + assert np.allclose( + total[full_record], + reported_weekly[full_record] * WEEKS_IN_YEAR, + **FLOAT32, + ) + + +# Reported amounts too small for float32, held as nil (CI run 38170838155 +# found the first), and a tiny amount float32 still holds, at 80 on the basic +# State Pension. +TINY_REPORTS = [ + [{"age": 80, "male": False, "months": 0.0, "weekly": 8.266518416092618e-246}], + [{"age": 80, "male": False, "months": 0.0, "weekly": 2.2250738585e-313}], + [{"age": 85, "male": True, "months": 3.0, "weekly": 1e-30}], +] @PROPERTY_SETTINGS @given(people=PEOPLE) +@example(people=TINY_REPORTS[0]) +@example(people=TINY_REPORTS[1]) +@example(people=TINY_REPORTS[2]) def test_components_add_up_to_uprated_reported_amount(people): """Data projected with ages held fixed, every year from 2024-25 to 2030-31.""" sim = projected_simulation(people) @@ -574,9 +661,10 @@ def test_add_on_follows_september_cpi_and_nothing_else_changes(people, data): - the add-on is never negative, and never falls as the reported amount rises; - from one year to the next, with the type unchanged, it grows by that year's September CPI rise; - - differential against main: the flat-rate parts are unchanged, the add-on - is unchanged in the data year, and otherwise differs only by uprating with - September CPI instead of the full rate.""" + - differential against main, applied to the reported amount net of the age + addition: the flat-rate parts are unchanged, the add-on is unchanged in + the data year, and otherwise differs only by uprating with September CPI + instead of the full rate.""" extra = data.draw( st.lists( st.floats(min_value=0, max_value=300), @@ -586,7 +674,7 @@ def test_add_on_follows_september_cpi_and_nothing_else_changes(people, data): ) records = paired(people, extra) sim = projected_simulation(records) - weekly = np.array([p["weekly"] for p in records]) + weekly = data_year_net_weekly(sim, records) n = len(people) previous = None for year in YEARS: @@ -737,14 +825,17 @@ def test_situation_new_state_pension_follows_a_dated_rate_reform(reformed): def test_situation_basic_state_pension_follows_a_dated_rate_reform(): + """Aged 90, reporting the full basic rate and the 25p age addition.""" year = 2026 - weekly = LEGISLATED[(year, "BASIC")] + weekly = LEGISLATED[(year, "BASIC")] + AGE_ADDITION_WEEKLY sit = situation(90, "BASIC", weekly, year) reform = {BSP: {f"{year}-01-01.{year}-12-31": 170.0}} result = situation_components(sit, reform, year) assert result["basic_state_pension"] == pytest.approx(170 * WEEKS_IN_YEAR, abs=0.01) assert result["additional_state_pension"] == 0 - assert result["state_pension"] == pytest.approx(170 * WEEKS_IN_YEAR, abs=0.01) + assert result["state_pension"] == pytest.approx( + 170 * WEEKS_IN_YEAR + AGE_ADDITION, abs=0.01 + ) def test_situation_protected_payment_stays_additional_under_a_rate_reform(): @@ -791,11 +882,12 @@ def test_undated_rate_reform_moves_only_the_flat_rate_part( year = 2027 assert calculate(sim, "state_pension_type", year)[0] == pension_type expected = expected_under_rate( - person["weekly"], + net_weekly(person, pension_type), LEGISLATED[(DATA_YEAR, pension_type)], reformed, add_on_uprating(sim, year), ) + addition = AGE_ADDITION if pension_type == "BASIC" else 0 flat_variable = ( "new_state_pension" if pension_type == "NEW" else "basic_state_pension" ) @@ -806,7 +898,7 @@ def test_undated_rate_reform_moves_only_the_flat_rate_part( expected["additional"] ) assert calculate(sim, "state_pension", year)[0] == approx( - expected["flat"] + expected["additional"] + expected["flat"] + expected["additional"] + addition ) @@ -839,3 +931,60 @@ def test_dated_reform_after_the_data_year_is_unchanged_by_the_baseline_split(): assert calculate(sim, "state_pension", 2027)[0] == approx( expected["flat"] + expected["additional"] ) + + +# The age addition (PolicyEngine/policyengine-uk#2139). + + +def test_full_basic_rate_plus_age_addition_is_never_additional_pension(): + """A man aged 85 in 2024-25 reports £169.75 a week: the full basic State + Pension (£169.50, Social Security Benefits Up-rating Order 2024 art 4(2)) + and the 25p age addition. In every year he gets the full basic rate and + 25p, never uprated, and no additional State Pension. Before #2139 the 25p + was additional pension, uprated with it.""" + person = {"age": 85, "male": True, "months": 3, "weekly": 169.75} + sim = projected_simulation([person]) + for year in YEARS: + assert calculate(sim, "state_pension_type", year)[0] == "BASIC" + basic = flat_rates(sim, year)["BASIC"] * WEEKS_IN_YEAR + assert calculate(sim, "basic_state_pension", year)[0] == approx(basic) + assert calculate(sim, "additional_state_pension", year)[0] == 0 + assert calculate(sim, "state_pension_age_addition", year)[0] == AGE_ADDITION + assert calculate(sim, "state_pension", year)[0] == approx(basic + AGE_ADDITION) + + +def test_age_addition_reforms_leave_the_reported_split_alone(): + """An undated reform paying £10 a week from 75 pays it to both records + while they are on the basic State Pension, but the reported amounts were + observed under the legislated 25p from 80: the 85-year-old's is still + split net of 25p, and the 77-year-old's in full, so the other components + do not change. Held at 77, the second record is on the new State Pension + by 2030-31, and a new State Pension gets no age addition, reformed or not: + the addition belongs to a retirement pension under the 1992 Act + (s.79(1)).""" + people = [ + {"age": 85, "male": True, "months": 3, "weekly": 169.75}, + {"age": 77, "male": True, "months": 3, "weekly": 169.5}, + ] + baseline = projected_simulation(people) + reformed = Microsimulation( + dataset=year_dataset(people, DATA_YEAR), + reform={ + "gov.dwp.state_pension.age_addition.amount": 10.0, + "gov.dwp.state_pension.age_addition.age": 75, + }, + ) + types = { + DATA_YEAR: ["BASIC", "BASIC"], + 2027: ["BASIC", "BASIC"], + 2030: ["BASIC", "NEW"], + } + for year, year_types in types.items(): + assert list(calculate(reformed, "state_pension_type", year)) == year_types + assert list(calculate(reformed, "state_pension_age_addition", year)) == [ + 10 * WEEKS_IN_YEAR if t == "BASIC" else 0 for t in year_types + ], year + for variable in COMPONENTS: + assert calculate(reformed, variable, year) == pytest.approx( + calculate(baseline, variable, year), abs=1e-6 + ), (variable, year) diff --git a/policyengine_uk/tests/test_state_pension_reported_weeks.py b/policyengine_uk/tests/test_state_pension_reported_weeks.py new file mode 100644 index 0000000000..ff770b5e2f --- /dev/null +++ b/policyengine_uk/tests/test_state_pension_reported_weeks.py @@ -0,0 +1,215 @@ +"""The State Pension a survey reports, read back at 52 weeks a year. + +basic_state_pension, new_state_pension and additional_state_pension take +state_pension_reported less any age addition +(state_pension_reported_excluding_age_addition), divide it by +policyengine-core's 52 weeks a year and split the weekly amount at the data +year's full rate for the type the person has in the simulated year. A dataset +must therefore annualise the State Pension at 52 weeks. At 365.25 / 7, which +policyengine-uk-data used until policyengine-uk-data#644, every full-rate +pensioner read 0.34% above the full rate and carried an add-on they do not +get, which put people whose only income is the full new State Pension on the +Pension Tax Allowance's taper, paying tax. + +These cases build simulations from 2024-25 data projected forward, as survey +data is (ages held fixed, at ages whose type stays the same in every year), and +check the route from a reported weekly amount to Income Tax: + +- a pensioner reporting the data year's full rate has no add-on in any + year. The new State Pension reporter is 70 and reports the full new rate. + The basic State Pension reporter is 85. With ages held fixed, the model + gives a woman aged 78 or over the basic type in every year to 2030-31. At + 85 a basic State Pension recipient is over 80, so DWP pays her the 25p a + week age addition with the full basic rate. She reports both, and the model + pays the full rate as basic State Pension and the 25p, never uprated, as the + age addition; +- Steph, whose only income is the full new State Pension, pays no Income Tax + in 2027-28 to 2029-30, as HM Treasury's explainer says, and the same as when + her State Pension is given directly; +- near the full new rate, no one reporting at most the full rate pays Income + Tax, and above it the tax never exceeds 8/15 of the add-on (20% on it plus a + third of it off the allowance). + +policyengine-core holds amounts as float32, so £11,502.40 reads back about a +thousandth of a penny above £221.20 a week (0.0012p, or 0.063p a year); +comparisons allow a penny. +""" + +import numpy as np +import pandas as pd +import pytest +from hypothesis import HealthCheck, given, settings +from hypothesis import strategies as st + +from policyengine_uk import Microsimulation, Simulation +from policyengine_uk.data import UKSingleYearDataset +from policyengine_uk.system import system + +DATA_YEAR = 2024 +PTA_YEARS = [2027, 2028, 2029] +WEEKS_IN_YEAR = 52 +# Ages held through the projection: reached State Pension age in 2020 (new +# State Pension) and in 2005 (basic State Pension). +AGE = {"NEW": 70, "BASIC": 85} +PENNY = 0.01 + + +def survey_simulation(weekly, pension_types) -> Microsimulation: + """2024-25 data with one pensioner per household, reporting `weekly` a + week of State Pension annualised at 52 weeks, and nothing else.""" + ids = np.arange(len(weekly)) + person = pd.DataFrame( + { + "person_id": ids, + "person_benunit_id": ids, + "person_household_id": ids, + "age": [AGE[t] for t in pension_types], + "gender": "FEMALE", + "state_pension_reported": np.asarray(weekly) * WEEKS_IN_YEAR, + } + ) + household = pd.DataFrame( + { + "household_id": ids, + "household_weight": np.ones(len(ids)), + "region": "LONDON", + "tenure_type": "OWNED_OUTRIGHT", + "rent": 0.0, + "council_tax": 0.0, + } + ) + return Microsimulation( + dataset=UKSingleYearDataset( + person=person, + benunit=pd.DataFrame({"benunit_id": ids}), + household=household, + fiscal_year=DATA_YEAR, + ) + ) + + +def calculate(sim, variable, year) -> np.ndarray: + # A Microsimulation returns a weighted series, a Simulation an array. + values = sim.calculate(variable, year) + return np.asarray(getattr(values, "values", values)) + + +def full_rates(year) -> dict: + p = system.parameters.gov.dwp.state_pension + return { + "NEW": p.new_state_pension.amount(year), + "BASIC": p.basic_state_pension.amount(year), + } + + +# The weekly age addition in the data year. DWP pays it to a basic State +# Pension recipient aged 80 or over and never uprates it. +AGE_ADDITION = system.parameters.gov.dwp.state_pension.age_addition.amount(DATA_YEAR) + + +@pytest.fixture(scope="module") +def full_rate_reporters(): + """A new State Pension reporter at the full new rate, and a basic State + Pension reporter, aged 85, at the full basic rate plus the age addition.""" + types = ["NEW", "BASIC"] + rates = full_rates(DATA_YEAR) + weekly = [rates["NEW"], rates["BASIC"] + AGE_ADDITION] + return survey_simulation(weekly, types), types + + +@pytest.mark.parametrize("year", range(DATA_YEAR, 2031)) +def test_full_rate_reporters_have_no_add_on_in_any_year(full_rate_reporters, year): + sim, types = full_rate_reporters + rates = full_rates(year) + + assert calculate(sim, "state_pension_type", year).astype(str).tolist() == types + assert np.all(calculate(sim, "additional_state_pension", year) < PENNY) + assert calculate(sim, "new_state_pension", year)[0] == pytest.approx( + WEEKS_IN_YEAR * rates["NEW"], abs=PENNY + ) + assert calculate(sim, "basic_state_pension", year)[1] == pytest.approx( + WEEKS_IN_YEAR * rates["BASIC"], abs=PENNY + ) + # The data year's 25p in every year, so not uprated, and none on the new + # State Pension. + assert calculate(sim, "state_pension_age_addition", year).tolist() == ( + pytest.approx([0, WEEKS_IN_YEAR * AGE_ADDITION], abs=PENNY) + ) + + +@pytest.mark.parametrize("year", PTA_YEARS) +def test_steph_pays_no_income_tax_from_survey_data_or_given_directly( + full_rate_reporters, year +): + """Steph's only income is the full new State Pension: £13,036.40 in + 2027-28, 52 weeks at £250.70. The Pension Tax Allowance removes all her + tax, whether her State Pension comes from a survey's weekly amount or is + given directly.""" + sim, _ = full_rate_reporters + threshold = WEEKS_IN_YEAR * full_rates(year)["NEW"] + personal_allowance = system.parameters( + f"{year}-04-30" + ).gov.hmrc.income_tax.allowances.personal_allowance.amount + tax_before_allowance = 0.2 * (threshold - personal_allowance) + + direct = Simulation( + situation={ + "people": { + "steph": { + "age": {year: AGE["NEW"]}, + "state_pension": {year: threshold}, + } + }, + "benunits": {"benunit": {"members": ["steph"]}}, + "households": { + "household": {"members": ["steph"], "region": {year: "LONDON"}} + }, + } + ) + + from_survey = { + v: calculate(sim, v, year)[0] + for v in ("state_pension", "income_tax", "pension_tax_allowance") + } + given_directly = {v: calculate(direct, v, year)[0] for v in from_survey} + + assert from_survey["state_pension"] == pytest.approx(threshold, abs=PENNY) + assert from_survey["income_tax"] == pytest.approx(0, abs=PENNY) + # Not vacuous: without the allowance she would pay basic-rate tax. + assert tax_before_allowance > 90 + assert from_survey["pension_tax_allowance"] == pytest.approx( + tax_before_allowance, abs=PENNY + ) + for v in from_survey: + assert from_survey[v] == pytest.approx(given_directly[v], abs=PENNY), v + + +@settings( + max_examples=10, + deadline=None, + derandomize=True, + suppress_health_check=[HealthCheck.too_slow], +) +@given( + offsets=st.lists( + st.one_of( + st.floats(min_value=-5, max_value=5, allow_nan=False), + st.sampled_from([0.0, -0.01, 0.01]), + ), + min_size=1, + max_size=40, + ) +) +def test_near_the_full_rate_only_the_add_on_is_taxed(offsets): + """New State Pension reporters within £5 a week of the full rate, with no + other income, in each year of the allowance.""" + offsets = np.asarray(offsets) + rates = full_rates(DATA_YEAR) + sim = survey_simulation(rates["NEW"] + offsets, ["NEW"] * len(offsets)) + at_or_below = offsets <= 0 + for year in PTA_YEARS: + add_on = calculate(sim, "additional_state_pension", year) + tax = calculate(sim, "income_tax", year) + assert np.all(add_on[at_or_below] < PENNY), year + assert np.all(tax[at_or_below] < PENNY), year + assert np.all(tax <= 8 / 15 * add_on + PENNY), year diff --git a/policyengine_uk/variables/gov/dwp/additional_state_pension.py b/policyengine_uk/variables/gov/dwp/additional_state_pension.py index 7ef5d894d6..a864fdb4ab 100644 --- a/policyengine_uk/variables/gov/dwp/additional_state_pension.py +++ b/policyengine_uk/variables/gov/dwp/additional_state_pension.py @@ -24,7 +24,12 @@ def formula(person, period, parameters): data_year = period.start.year else: data_year = period.start.year - reported = person("state_pension_reported", data_year) / WEEKS_IN_YEAR + # The age addition is paid by state_pension_age_addition, so split + # the reported amount without it. + reported = ( + person("state_pension_reported_excluding_age_addition", data_year) + / WEEKS_IN_YEAR + ) # Split by the period's type, as basic_state_pension and # new_state_pension do, so the three components add up to the # reported amount. Survey ages are held fixed across years, so a diff --git a/policyengine_uk/variables/gov/dwp/basic_state_pension.py b/policyengine_uk/variables/gov/dwp/basic_state_pension.py index 48ac56fb13..933eddc0fc 100644 --- a/policyengine_uk/variables/gov/dwp/basic_state_pension.py +++ b/policyengine_uk/variables/gov/dwp/basic_state_pension.py @@ -21,7 +21,12 @@ def formula(person, period, parameters): else: data_year = period.start.year - reported = person("state_pension_reported", data_year) / WEEKS_IN_YEAR + # The age addition is paid by state_pension_age_addition, so split + # the reported amount without it. + reported = ( + person("state_pension_reported_excluding_age_addition", data_year) + / WEEKS_IN_YEAR + ) pension_type = person("state_pension_type", period) # state_pension_reported was observed under the legislated rates, so # split it at the baseline's data-year rate, not the reformed one. diff --git a/policyengine_uk/variables/gov/dwp/new_state_pension.py b/policyengine_uk/variables/gov/dwp/new_state_pension.py index 69c9a3bfce..9791dcbf10 100644 --- a/policyengine_uk/variables/gov/dwp/new_state_pension.py +++ b/policyengine_uk/variables/gov/dwp/new_state_pension.py @@ -23,7 +23,12 @@ def formula(person, period, parameters): pension_type = person("state_pension_type", period) eligible = pension_type == pension_type.possible_values.NEW - reported_weekly = person("state_pension_reported", data_year) / WEEKS_IN_YEAR + # The age addition is paid by state_pension_age_addition, so split + # the reported amount without it. + reported_weekly = ( + person("state_pension_reported_excluding_age_addition", data_year) + / WEEKS_IN_YEAR + ) # state_pension_reported was observed under the legislated rates, so # split it at the baseline's data-year rate, not the reformed one. # Otherwise a reform that also sets the data year's rate (an undated diff --git a/policyengine_uk/variables/gov/dwp/overlapping_state_pension.py b/policyengine_uk/variables/gov/dwp/overlapping_state_pension.py index f48729090d..a133a3b35b 100644 --- a/policyengine_uk/variables/gov/dwp/overlapping_state_pension.py +++ b/policyengine_uk/variables/gov/dwp/overlapping_state_pension.py @@ -1,17 +1,53 @@ from policyengine_uk.model_api import * +def state_pension_overlapping_part(person, period, age_addition_overlaps: bool): + """The State Pension that overlaps with a carer benefit. + + A new State Pension overlaps in full, including any protected payment + above the full rate. An old State Pension overlaps without its additional + pension, and with or without its age addition as the carer benefit's own + rules say. state_pension can scale its components (a contributed reform + does), so the parts that do not overlap are taken as a share of them. + """ + state_pension = person("state_pension", period) + additional = person("additional_state_pension", period) + age_addition = person("state_pension_age_addition", period) + components = add( + person, + period, + [ + "basic_state_pension", + "new_state_pension", + "additional_state_pension", + "state_pension_age_addition", + ], + ) + pension_type = person("state_pension_type", period) + old_system = pension_type == pension_type.possible_values.BASIC + not_overlapping = old_system * additional + if not age_addition_overlaps: + not_overlapping = not_overlapping + age_addition + not_overlapping_share = np.divide( + not_overlapping, + components, + out=np.zeros_like(components, dtype=float), + where=components > 0, + ) + return state_pension * (1 - not_overlapping_share) + + class overlapping_state_pension(Variable): value_type = float entity = Person - label = "State Pension that overlaps with carer benefits" + label = "State Pension that overlaps with Carer's Allowance" documentation = ( - "The State Pension by which Carer's Allowance and Carer Support Payment " - "are reduced. A new State Pension under Part 1 of the Pensions Act 2014 " - "overlaps in full, including any protected payment above the full rate. " - "An old State Pension overlaps without its additional pension. When " - "only a reported total is available, the model estimates its basic " - "component up to the full basic rate and treats the excess as " + "The State Pension by which Carer's Allowance is reduced. A new State " + "Pension under Part 1 of the Pensions Act 2014 overlaps in full, " + "including any protected payment above the full rate. An old State " + "Pension overlaps without its additional pension or its age addition. " + "When only a reported total is available, the model estimates its " + "basic component up to the full basic rate and treats the excess as " "additional pension. This split cannot identify basic-pension " "increments above that rate or additional pension within a partial " "pension below it. A State Pension supplied directly, with no " @@ -22,25 +58,13 @@ class overlapping_state_pension(Variable): reference = ( "https://www.legislation.gov.uk/uksi/1979/597/regulation/4", "https://www.legislation.gov.uk/uksi/1979/597/regulation/12", - "https://www.legislation.gov.uk/ssi/2023/302/regulation/16", + "https://www.legislation.gov.uk/uksi/1979/597/schedule/1", ) def formula(person, period, parameters): - state_pension = person("state_pension", period) - additional = person("additional_state_pension", period) - components = add( - person, - period, - ["basic_state_pension", "new_state_pension", "additional_state_pension"], - ) - pension_type = person("state_pension_type", period) - old_system = pension_type == pension_type.possible_values.BASIC - # state_pension can scale its components (a contributed reform does), - # so take the additional pension as a share of them. - additional_share = np.divide( - additional, - components, - out=np.zeros_like(components, dtype=float), - where=components > 0, + # An age addition is adjusted only by reference to another age + # addition (SI 1979/597 reg 4(3); Sch 1 row 4, "except any age + # addition"), so it never reduces Carer's Allowance. + return state_pension_overlapping_part( + person, period, age_addition_overlaps=False ) - return state_pension * (1 - old_system * additional_share) diff --git a/policyengine_uk/variables/gov/dwp/state_pension_age_addition.py b/policyengine_uk/variables/gov/dwp/state_pension_age_addition.py new file mode 100644 index 0000000000..c824f4053e --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/state_pension_age_addition.py @@ -0,0 +1,64 @@ +from policyengine_uk.model_api import * + + +def state_pension_data_year(person, period) -> int: + """The year state_pension_reported was observed: the dataset's first year, + or the period itself in a simulation without a dataset.""" + simulation = person.simulation + if simulation.dataset is not None: + try: + return min(simulation.dataset.years) + except Exception: + return period.start.year + return period.start.year + + +def over_age_on_basic_state_pension(person, period, age_addition_age): + """Over the age of 80 with a basic State Pension type. The age addition + goes to a person over 80 entitled to a retirement pension under the Social + Security Contributions and Benefits Act 1992 (s.79(1)); a person is over + an age once they have attained it (s.173). A new State Pension, under Part + 1 of the Pensions Act 2014, is not a pension "under this Act" (s.79(1) as + amended by the Pensions Act 2014 Sch 12 para 85).""" + pension_type = person("state_pension_type", period) + basic = pension_type == pension_type.possible_values.BASIC + return basic & (person("age", period) >= age_addition_age) + + +class state_pension_age_addition(Variable): + label = "State Pension age addition" + documentation = ( + "The age addition: 25p a week added to a retirement pension under the " + "Social Security Contributions and Benefits Act 1992 (the basic State " + "Pension) once its recipient is over 80, and never uprated. A new " + "State Pension gets none. Entitlement to the pension is read from a " + "State Pension reported in the data year or, in a simulation given " + "the components directly, basic or additional State Pension in the " + "year. The model is annual and, as for State Pension age, reads age " + "on 6 October, the middle of the fiscal year: a person who turns 80 " + "by then gets the whole year's addition, and one who turns 80 later " + "in the year gets none until the next." + ) + entity = Person + definition_period = YEAR + value_type = float + unit = GBP + reference = ( + "https://www.legislation.gov.uk/ukpga/1992/4/section/79", + "https://www.legislation.gov.uk/ukpga/1992/4/section/173", + "https://www.legislation.gov.uk/ukpga/1992/4/schedule/4", + "https://www.legislation.gov.uk/ukpga/2014/19/schedule/12/paragraph/85", + "https://www.legislation.gov.uk/uksi/2026/148/article/3/made", + ) + + def formula(person, period, parameters): + p = parameters(period).gov.dwp.state_pension.age_addition + data_year = state_pension_data_year(person, period) + reported = person("state_pension_reported", data_year) > 0 + components = ( + add(person, period, ["basic_state_pension", "additional_state_pension"]) > 0 + ) + receives = over_age_on_basic_state_pension(person, period, p.age) & ( + reported | components + ) + return receives * p.amount * WEEKS_IN_YEAR diff --git a/policyengine_uk/variables/gov/dwp/state_pension_reported.py b/policyengine_uk/variables/gov/dwp/state_pension_reported.py index 3fdf232e62..c9b9974073 100644 --- a/policyengine_uk/variables/gov/dwp/state_pension_reported.py +++ b/policyengine_uk/variables/gov/dwp/state_pension_reported.py @@ -5,6 +5,17 @@ class state_pension_reported(Variable): value_type = float entity = Person label = "Reported income from the State Pension" + documentation = ( + "The State Pension a survey reports, as an annual amount: the weekly " + "amount times 52. basic_state_pension, new_state_pension and " + "additional_state_pension take it less any age addition " + "(state_pension_reported_excluding_age_addition), divide it by 52 and " + "split the weekly amount at the data year's full rate for the type the " + "person has in the simulated year, so a dataset must annualise weekly " + "amounts at 52 weeks. At 365.25 / 7, a full-rate pensioner reads 0.34% " + "above the full rate and gets the excess as additional State Pension or a " + "protected payment." + ) definition_period = YEAR unit = GBP diff --git a/policyengine_uk/variables/gov/dwp/state_pension_reported_excluding_age_addition.py b/policyengine_uk/variables/gov/dwp/state_pension_reported_excluding_age_addition.py new file mode 100644 index 0000000000..8fd548c218 --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/state_pension_reported_excluding_age_addition.py @@ -0,0 +1,41 @@ +from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.state_pension_age_addition import ( + over_age_on_basic_state_pension, +) + + +class state_pension_reported_excluding_age_addition(Variable): + label = "reported State Pension excluding the age addition" + documentation = ( + "state_pension_reported less the age addition it is taken to include. " + "The survey records the State Pension a person receives, which for a " + "basic State Pension recipient over 80 includes the 25p a week age " + "addition. basic_state_pension, new_state_pension and " + "additional_state_pension split this amount, and " + "state_pension_age_addition pays the addition, so it is neither " + "counted twice nor uprated as additional pension." + ) + entity = Person + definition_period = YEAR + value_type = float + unit = GBP + reference = "https://www.legislation.gov.uk/ukpga/1992/4/section/79" + + def formula(person, period, parameters): + reported = person("state_pension_reported", period) + # state_pension_reported was observed under the legislated rules, so + # take off the legislated age addition, not a reformed one, as the + # components split it at the legislated full rate + # (PolicyEngine/policyengine-uk#2122). + baseline = getattr(person.simulation, "baseline", None) + legislated = ( + baseline.tax_benefit_system.parameters + if baseline is not None + else parameters + ) + p = legislated(period).gov.dwp.state_pension.age_addition + receives = over_age_on_basic_state_pension(person, period, p.age) & ( + reported > 0 + ) + included = receives * p.amount * WEEKS_IN_YEAR + return max_(reported - included, 0) diff --git a/policyengine_uk/variables/gov/social_security_scotland/carer_support_payment_overlapping_state_pension.py b/policyengine_uk/variables/gov/social_security_scotland/carer_support_payment_overlapping_state_pension.py new file mode 100644 index 0000000000..cc90c205a5 --- /dev/null +++ b/policyengine_uk/variables/gov/social_security_scotland/carer_support_payment_overlapping_state_pension.py @@ -0,0 +1,33 @@ +from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.overlapping_state_pension import ( + state_pension_overlapping_part, +) + + +class carer_support_payment_overlapping_state_pension(Variable): + value_type = float + entity = Person + label = "State Pension that overlaps with Carer Support Payment" + documentation = ( + "The State Pension by which Carer Support Payment is reduced. A new " + "State Pension overlaps in full, including any protected payment above " + "the full rate. An old State Pension (a Retirement Pension) overlaps " + "without its additional pension but with its age addition: the " + "regulations exclude only additional pension and graduated retirement " + "benefit. The model's reported-total split and input convention are " + "those of overlapping_state_pension." + ) + definition_period = YEAR + unit = GBP + reference = "https://www.legislation.gov.uk/ssi/2023/302/regulation/16" + + def formula(person, period, parameters): + # SSI 2023/302 reg 16(3)(a) lists "State Pension or Retirement + # Pension", and reg 16(6) defines Retirement Pension as "a pension + # payable under Part II and Part III of the 1992 Act, excluding any + # additional pension or graduated retirement benefit". The age + # addition is in Part III (SSCBA 1992 s.79) and is not excluded, so, + # unlike for Carer's Allowance (SI 1979/597 reg 4(3)), it overlaps. + return state_pension_overlapping_part( + person, period, age_addition_overlaps=True + ) diff --git a/policyengine_uk/variables/input/state_pension.py b/policyengine_uk/variables/input/state_pension.py index e853011939..347194740a 100644 --- a/policyengine_uk/variables/input/state_pension.py +++ b/policyengine_uk/variables/input/state_pension.py @@ -23,6 +23,7 @@ def formula(person, period, parameters): "basic_state_pension", "additional_state_pension", "new_state_pension", + "state_pension_age_addition", ], ) * uprating