From 1a2cc1336be54510a2d60511a6d61983fbe7961b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Juaristi?= <127882282+juaristi22@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:48:48 +0100 Subject: [PATCH 1/3] Keep UC advance repayments fixed under allowance reforms --- changelog.d/2410.fixed.md | 1 + docs/book/validation/uc-deductions.md | 55 +++- .../deductions/statutory_cap.yaml | 10 + .../universal_credit/uc_fixed_deductions.yaml | 247 ++++++++++++++++++ policyengine_uk/tests/test_uc_deductions.py | 35 +++ .../uc_benefit_cap_reduction_after_floor.py | 3 +- .../deductions/_deduction_amounts.py | 62 +++++ .../deductions/_reduction_allocation.py | 2 +- .../deductions/uc_advance_repayment_amount.py | 31 +++ .../uc_child_maintenance_deduction_amount.py | 17 ++ .../deductions/uc_deduction_demand.py | 45 ++++ .../deductions/uc_deduction_rate.py | 75 +----- .../deductions/uc_deductions.py | 11 +- .../uc_last_resort_deduction_amount.py | 28 ++ 14 files changed, 543 insertions(+), 79 deletions(-) create mode 100644 changelog.d/2410.fixed.md create mode 100644 policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml create mode 100644 policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml create mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py create mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py create mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py create mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py create mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py diff --git a/changelog.d/2410.fixed.md b/changelog.d/2410.fixed.md new file mode 100644 index 0000000000..15e57b229b --- /dev/null +++ b/changelog.d/2410.fixed.md @@ -0,0 +1 @@ +- Keep Universal Credit advance repayment cash demand fixed through allowance reforms, accept separate maintenance and last resort cash amounts, and distinguish administrative and statutory deduction limits. diff --git a/docs/book/validation/uc-deductions.md b/docs/book/validation/uc-deductions.md index 69d0e258fc..dfa98e39de 100644 --- a/docs/book/validation/uc-deductions.md +++ b/docs/book/validation/uc-deductions.md @@ -8,6 +8,57 @@ PolicyEngine UK models the money DWP takes off Universal Credit awards to repay The implementation separates **latent demand** from the **statutory cap**. `uc_latent_deduction_rate` assigns deduction demand from the distribution DWP observed in March to May 2025 — the last full months under the 25% cap — and `gov.dwp.universal_credit.deductions.cap` applies the operational cap (40% to October 2019, 30%, 25%, then 15% under the Fair Repayment Rate from 30 April 2025) at runtime. Assigning observed post-cap rates directly would bake the cap into the data and make cap-raising reforms inexpressible. +## Fixed cash and percentage deductions + +`uc_advance_repayment_amount` is annual cash demand before the deduction cap, +abolition switches and available-award limits. Set the actual instalments when +known; zero explicitly removes the advance estimate. An allowance reform does +not increase that demand. Recovery can still rise when a higher allowance +relaxes a binding percentage ceiling. + +For existing latent-rate and type-combination inputs, the fallback keeps the +existing marginal-mean split and converts the advance share using the **same +year's unreformed standard allowance** for the claimant category. The reference +uses the unannualised baseline parameter tree at 30 April, consistently with +fiscal-year sampling. This preserves the year's baseline estimate while +isolating an allowance reform. It does **not** identify a repayment's cash-origin +year or establish unchanged instalments across projected years or changes in +family status. Each year remains a cross-sectional imputation. Supply cash +amounts for the years concerned to describe a particular repayment schedule. + +The remaining third-party and government shares retain their estimated +percentage response. Those aggregate types mix legal heads: rent arrears are +10%–20% of the allowance, several other debts use 5%, continuing fuel/water +costs are cash, and overpayment rates are ceilings rather than instructions to +increase every agreed instalment. The coarse input cannot identify all those +arrangements. This change does not impute new deduction categories or change +dataset inputs. + +`uc_child_maintenance_deduction_amount` accepts known annual maintenance/fees or +arrears cash demand. The arrears-only flat rate is £36.40/month from 4 July 2019; +ongoing liability and fees depend on the amount due. No maintenance incidence +is assigned. Supply it separately from any aggregate third-party amount to +avoid counting it twice. Maintenance may exceed the **administrative cap**, +but ordinary debt and maintenance together remain within the **40% statutory +ceiling**. See [Schedule 7](https://www.legislation.gov.uk/uksi/2013/380/schedule/7) +and [the 2025 explanatory memorandum, paragraphs 5.10–5.12](https://www.legislation.gov.uk/uksi/2025/387/pdfs/uksiem_20250387_en_001.pdf#page=3). + +`uc_last_resort_deduction_amount` accepts the cash demand for the continuing +needs, housing-cost and rent exceptions in [Schedule 6 paragraph 4(3)–(4)](https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4). +Only this component bypasses the statutory ceiling. Its legacy fallback treats +the latent excess above the calibration cap as last resort cash at the same +year's unreformed allowance. The observed excess mixes child maintenance and +last resort heads, which the existing inputs cannot separate; that proxy is a +remaining data limitation. Known maintenance belongs in its separate cash input, +with the last-resort input set to its actual amount (including zero). + +`uc_deduction_demand` combines cash and percentage demand, applying the two caps. +Both deduction and benefit-cap allocation read that cash amount, preserving the +penny per assessment period and any contributed protected floor even if the +standard allowance is zero. `uc_deduction_rate` is its reporting ratio to the +current allowance, with zero returned when that denominator is zero; use cash +demand rather than reconstructing it from the reporting ratio. + ## Validation against DWP deductions statistics Enhanced FRS 2023/24 v1.40.3, against [DWP's Universal Credit deductions statistics](https://www.gov.uk/government/statistics/universal-credit-quarterly-statistics-29-april-2013-to-12-february-2026/universal-credit-deductions-statistics-march-2025-to-february-2026). @@ -29,7 +80,7 @@ The pre-Fair-Repayment-Rate pileup at the cap and both regimes' mean amounts rep ## Limitations -These bound what the module can support. They are stated rather than tuned away. +These bound what the module can support. They are stated rather than tuned away. The historical validation below predates the separate fixed-cash inputs; population validation has not been rerun for this change. ### Aggregates scale with the UC caseload @@ -53,7 +104,7 @@ The `protected_floor` lever limits combined deductions and benefit cap reduction JRF specifies the combined limit, not a priority between the two: their [September 2026 briefing](https://www.jrf.org.uk/social-security/a-protected-minimum-floor-in-universal-credit-to-cut-deep-child-poverty) proposes that "the sum of the 'capped amount' and any debt deductions is limited to the difference between a household's standard allowance and the level of the protected minimum floor". Debt first is the modeling choice, for three reasons. Under the Fair Repayment Rate the 15% deductions cap equals the allowance an 85% floor leaves, so cappable deductions never breach the floor on their own, and the policy JRF builds on (extending the Fair Repayment Rate "to all deductions, including the benefit cap") leaves deductions where that rate puts them. JRF's own example (standard allowance £98 a week, a £15 deduction, an £80 cap reduction, total limited to £15) is consistent with it. And it does not depend on how heavily the household is capped: if the deduction were limited by the gross cap reduction, a household capped down to a few pence would have its deduction squeezed to almost nothing even though the floor then removes most of that cap. The award is the same under either priority; only the split differs. -Where deductions alone do exceed the allowance, the floor binds on the whole of `uc_deductions`, including the above-cap excess that current law exempts from the deductions cap (last resort and child maintenance deductions). JRF's briefing does not say whether their floor exempts those categories — its worked example involves only cappable deductions and the benefit cap — so this is a modeling choice. +Where deductions alone do exceed the allowance, the floor binds on the whole of `uc_deductions`, including statutory last resort exceptions and maintenance allowed above the administrative cap. JRF's briefing does not say whether their floor exempts those categories — its worked example involves only cappable deductions and the benefit cap — so this is a modeling choice. Both components report what the award actually loses, so `uc_deductions` and `uc_benefit_cap_reduction_after_floor` sum to the entitlement forgone, and the applied cap reduction never exceeds the award (a £1,000 cap reduction on a £500 award applies £500). `uc_benefit_cap_reduction`, the regulation 81 amount, itself stays gross, and so does `benefit_cap_reduction`, which adds it to the Housing Benefit reduction. Read `uc_benefit_cap_reduction_after_floor` for the cap reduction applied to a UC award under a floor reform. diff --git a/policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml b/policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml new file mode 100644 index 0000000000..e23ae0a723 --- /dev/null +++ b/policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml @@ -0,0 +1,10 @@ +description: Universal Credit limits ordinary debt and child maintenance deductions together to this share of the standard allowance, except for the continuing needs, housing costs and rent deductions in Schedule 6 paragraph 4(3)-(4). +values: + 2013-04-29: 0.4 +metadata: + label: UC deductions statutory ceiling + unit: /1 + period: year + reference: + - title: Social Security (Claims and Payments) Regulations 2013, Schedule 6 paragraph 4 + href: https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4 diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml new file mode 100644 index 0000000000..465aba3ff1 --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml @@ -0,0 +1,247 @@ +# SI 2013/383 reg 10: advances are cash instalments, not a percentage. +# SI 2013/380 Sch 6 paras 3-4: penny floor, ceiling and exceptions. +# EM to SI 2025/387 paras 5.10-5.12: maintenance may exceed the +# administrative cap, but not the statutory ceiling; £36.40/month. +- name: An allowance increase leaves an affordable fixed advance unchanged + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_advance_repayment_amount: 360 + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 440 + output: + uc_deductions: 360 + universal_credit: 5_640 + +- name: A binding administrative cap can limit a fixed advance + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_advance_repayment_amount: 1_200 + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 440 + output: + # Cash demand is £100/month, capped at 15% x £440 = £66/month. + uc_deductions: 792 + +- name: A five percent deduction scales with the allowance + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_latent_deduction_rate: 0.05 + uc_deduction_combination: THIRD_PARTY_ONLY + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 440 + output: + uc_deductions: 264 + +- name: Mixed fixed and percentage demands share the administrative cap + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_advance_repayment_amount: 600 + uc_latent_deduction_rate: 0.05 + uc_deduction_combination: THIRD_PARTY_ONLY + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 440 + output: + # £50 cash + 5% x £440 = £72; administrative cap £66/month. + uc_deductions: 792 + +- name: Maintenance is fixed cash and may exceed the administrative cap + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_advance_repayment_amount: 720 + uc_child_maintenance_deduction_amount: 436.8 + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 400 + output: + # £60 ordinary + £36.40 maintenance each month, under statutory £160. + uc_deductions: 1_156.8 + +- name: Maintenance and ordinary debt stay within the statutory ceiling + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_child_maintenance_deduction_amount: 436.8 + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 50 + output: + # 40% x £50 x 12, rather than all of £436.80. + uc_deductions: 240 + +- name: Only a last resort cash component can exceed the statutory ceiling + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_child_maintenance_deduction_amount: 436.8 + uc_last_resort_deduction_amount: 120 + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 50 + output: + # £20/month statutory-limited maintenance plus £10 continuing needs. + uc_deductions: 360 + +- name: Fixed deductions still leave a penny per assessment period + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 120 + uc_advance_repayment_amount: 360 + output: + uc_deductions: 119.88 + universal_credit: 0.12 + +- name: Abolishing advances removes an explicitly supplied cash instalment + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_advance_repayment_amount: 360 + gov.dwp.universal_credit.deductions.abolish.advance: true + output: + uc_deductions: 0 + +- name: A legacy advance rate uses the same year's unreformed allowance + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_latent_deduction_rate: 0.1 + uc_deduction_combination: ADVANCE_ONLY + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 440 + output: + # The legacy 10% represented £40.014/month at the unreformed £400.14. + # It does not become £44 when only the allowance is reformed. + uc_advance_repayment_amount: 480.168 + uc_deductions: 480.168 + universal_credit: 5_519.832 + +- name: An explicit zero replaces the legacy advance estimate + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_latent_deduction_rate: 0.1 + uc_deduction_combination: ADVANCE_ONLY + uc_advance_repayment_amount: 0 + output: + uc_deductions: 0 + +- name: A zero standard allowance does not erase a continuing needs deduction + period: 2025 + absolute_error_margin: 0.01 + input: + age: 30 + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_last_resort_deduction_amount: 120 + gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 0 + output: + uc_deduction_demand: 120 + uc_deductions: 120 + universal_credit: 5_880 + +- name: A capped family's fixed advance stays cash at the current allowance + period: 2025 + absolute_error_margin: 0.01 + input: + people: + parent1: + age: 35 + is_claimant_or_partner: true + child_tax_credit_reported: 3_000 + parent2: + age: 33 + is_claimant_or_partner: true + child1: + age: 13 + child2: + age: 11 + child3: + age: 9 + child4: + age: 7 + benunits: + family: + members: [parent1, parent2, child1, child2, child3, child4] + would_claim_uc: false + would_claim_uc_at_legacy_closure: true + uc_advance_repayment_amount: 600 + households: + household: + members: [parent1, parent2, child1, child2, child3, child4] + rent: 30_000 + tenure_type: RENT_FROM_COUNCIL + region: LONDON + output: + # SI 2013/376 reg 81: the extra allowance is offset by the benefit cap. + # Actual family inputs produce £21,277.40 before £600 fixed recovery. + claims_universal_credit: true + uc_advance_repayment_amount: 600 + uc_deductions: 600 + universal_credit: 20_677.4 + +- name: A capped family's fixed advance stays cash after an allowance uplift + period: 2025 + absolute_error_margin: 0.01 + input: + gov.dwp.universal_credit.standard_allowance.amount.COUPLE_OLD: 690.91 + people: + parent1: + age: 35 + is_claimant_or_partner: true + child_tax_credit_reported: 3_000 + parent2: + age: 33 + is_claimant_or_partner: true + child1: + age: 13 + child2: + age: 11 + child3: + age: 9 + child4: + age: 7 + benunits: + family: + members: [parent1, parent2, child1, child2, child3, child4] + would_claim_uc: false + would_claim_uc_at_legacy_closure: true + uc_advance_repayment_amount: 600 + households: + household: + members: [parent1, parent2, child1, child2, child3, child4] + rent: 30_000 + tenure_type: RENT_FROM_COUNCIL + region: LONDON + output: + # SI 2013/376 reg 81: the extra allowance is offset by the benefit cap. + # Actual family inputs produce £21,277.40 before £600 fixed recovery. + claims_universal_credit: true + uc_advance_repayment_amount: 600 + uc_deductions: 600 + universal_credit: 20_677.4 diff --git a/policyengine_uk/tests/test_uc_deductions.py b/policyengine_uk/tests/test_uc_deductions.py index 7ec582d90c..216dd1c00e 100644 --- a/policyengine_uk/tests/test_uc_deductions.py +++ b/policyengine_uk/tests/test_uc_deductions.py @@ -415,3 +415,38 @@ def test_abolishing_all_types_removes_deductions(self): }, ) assert reform.calculate("uc_deductions", YEAR)[0] == 0 + + +def test_allowance_scenario_preserves_the_legacy_advance_cash_reference(): + """The actual UK dated-reform route must retain the unreformed cash anchor. + + SI 2013/383 reg 10 does not index an advance instalment to the allowance. + The existing latent 10% is £40.014/month at the published 2025-26 + single 25+ allowance, £400.14; both demands are below the 15% cap. + """ + situation = make_situation( + uc_latent_deduction_rate={YEAR: 0.1}, + uc_deduction_combination={YEAR: "ADVANCE_ONLY"}, + ) + baseline = Simulation(situation=situation) + reformed = Simulation( + situation=situation, + reform={ + "gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD": { + "2025-01-01.2025-12-31": 440 + } + }, + ) + assert baseline.calculate("uc_standard_allowance", YEAR)[0] == pytest.approx( + 400.14 * 12 + ) + assert reformed.calculate("uc_standard_allowance", YEAR)[0] == pytest.approx( + 440 * 12 + ) + for simulation in (baseline, reformed): + assert simulation.calculate("uc_advance_repayment_amount", YEAR)[ + 0 + ] == pytest.approx(0.1 * 400.14 * 12) + assert simulation.calculate("uc_deductions", YEAR)[0] == pytest.approx( + 0.1 * 400.14 * 12 + ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py b/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py index dfc789654f..ed63031212 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py @@ -32,8 +32,7 @@ def formula(benunit, period, parameters): _, cap_reduction = allocate_uc_reductions( benunit("universal_credit_pre_benefit_cap", period), benunit("uc_benefit_cap_reduction", period), - benunit("uc_deduction_rate", period) - * benunit("uc_standard_allowance", period), + benunit("uc_deduction_demand", period), benunit("uc_maximum_reduction", period), p.minimum_payable * MONTHS_IN_YEAR, ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py new file mode 100644 index 0000000000..b393e12067 --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py @@ -0,0 +1,62 @@ +"""Calibration helpers; cash estimates are not statutory instalment rules.""" + +from policyengine_uk.model_api import * + + +def deduction_type_shares(benunit, period, parameters): + """Split the legacy total by its existing marginal-mean approximation.""" + m = parameters(period).gov.simulation.uc_deductions.mean_monthly_amount_by_type + combination = benunit("uc_deduction_combination", period) + advance = ( + np.isin( + combination.decode_to_str(), + [ + "ADVANCE_ONLY", + "ADVANCE_AND_GOVERNMENT", + "ADVANCE_AND_THIRD_PARTY", + "ALL_THREE", + ], + ) + * m.ADVANCE + ) + third_party = ( + np.isin( + combination.decode_to_str(), + [ + "THIRD_PARTY_ONLY", + "ADVANCE_AND_THIRD_PARTY", + "THIRD_PARTY_AND_GOVERNMENT", + "ALL_THREE", + ], + ) + * m.THIRD_PARTY + ) + government = ( + np.isin( + combination.decode_to_str(), + [ + "GOVERNMENT_ONLY", + "ADVANCE_AND_GOVERNMENT", + "THIRD_PARTY_AND_GOVERNMENT", + "ALL_THREE", + ], + ) + * m.GOVERNMENT + ) + total = advance + third_party + government + return tuple( + np.divide(part, total, out=np.zeros_like(part, dtype=float), where=total > 0) + for part in (advance, third_party, government) + ) + + +def reference_standard_allowance(benunit, period, parameters): + """Same-year current-law allowance, sampled as UK fiscal parameters are. + + The baseline tree is projected but not fiscal-year annualised. A legacy + rate has no cash-origin year, so this preserves its annual cross-section; + it does not establish a debt instalment's path across projection years. + """ + p = parameters(f"{period.start.year}-04-30").baseline.gov.dwp.universal_credit + claimant_type = benunit("uc_standard_allowance_claimant_type", period) + return p.standard_allowance.amount[claimant_type] * MONTHS_IN_YEAR diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py index b556390750..53b6f66d16 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py @@ -18,7 +18,7 @@ def allocate_uc_reductions( gross_cap_reduction: uc_benefit_cap_reduction, the regulation 81 amount of SI 2013/376. benefit_cap_reduction and uc_has_deduction read it too, so it is never floored. - deduction_demand: the deduction rate times the standard allowance, + deduction_demand: cash demand after the administrative/statutory caps, before the one-penny rule. max_reduction: uc_maximum_reduction, infinite when no protected floor is in force (current law). diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py new file mode 100644 index 0000000000..ba3e86c540 --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py @@ -0,0 +1,31 @@ +from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( + deduction_type_shares, + reference_standard_allowance, +) + + +class uc_advance_repayment_amount(Variable): + label = "UC advance repayment cash demand" + documentation = ( + "Annual cash instalments before the deductions cap, abolition and penny floor. " + "An explicit amount, including zero, overrides the legacy estimate. The " + "fallback splits the supplied annual latent rate by the published type means " + "and converts its advance share using that year's unreformed allowance. " + "It is an annual cross-sectional estimate, not a longitudinal debt schedule." + ) + entity = BenUnit + definition_period = YEAR + value_type = float + unit = GBP + reference = "https://www.legislation.gov.uk/uksi/2013/383/regulation/10" + + def formula(benunit, period, parameters): + p = parameters(period).gov.simulation.uc_deductions + advance_share, _, _ = deduction_type_shares(benunit, period, parameters) + latent = max_(benunit("uc_latent_deduction_rate", period), 0) + return ( + min_(latent, p.calibration_cap) + * advance_share + * reference_standard_allowance(benunit, period, parameters) + ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py new file mode 100644 index 0000000000..2531bf0587 --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py @@ -0,0 +1,17 @@ +from policyengine_uk.model_api import * + + +class uc_child_maintenance_deduction_amount(Variable): + label = "UC child maintenance cash deduction demand" + documentation = ( + "Annual cash demand for ongoing child maintenance, fees and arrears, before " + "the statutory ceiling and penny floor. Supply the actual amount separately " + "from other third party debt; no maintenance incidence is imputed. The " + "arrears-only flat rate is £36.40 a month from 4 July 2019; ongoing " + "maintenance and fees depend on the amount due." + ) + entity = BenUnit + definition_period = YEAR + value_type = float + unit = GBP + reference = "https://www.legislation.gov.uk/uksi/2013/380/schedule/7" diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py new file mode 100644 index 0000000000..495791f510 --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py @@ -0,0 +1,45 @@ +from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( + deduction_type_shares, +) + + +class uc_deduction_demand(Variable): + label = "UC cash deductions before the award and protected floor limits" + documentation = ( + "Cash advance and maintenance demands plus the estimated percentage heads. " + "Ordinary debt obeys the administrative cap; maintenance can exceed it, " + "but together they obey the statutory ceiling. Only Schedule 6 " + "paragraph 4(3)-(4) last resort deductions bypass that ceiling. The legacy " + "third party and government rate shares remain calibration proxies, not " + "an assertion that every agreement in those categories is percentage based." + ) + entity = BenUnit + definition_period = YEAR + value_type = float + unit = GBP + reference = "https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4" + + def formula(benunit, period, parameters): + law = parameters(period).gov.dwp.universal_credit.deductions + calibration_cap = parameters( + period + ).gov.simulation.uc_deductions.calibration_cap + _, third_share, government_share = deduction_type_shares( + benunit, period, parameters + ) + percentage_share = third_share * ( + not law.abolish.third_party + ) + government_share * (not law.abolish.government) + allowance = max_(benunit("uc_standard_allowance", period), 0) + latent = max_(benunit("uc_latent_deduction_rate", period), 0) + percentage = min_(latent, calibration_cap) * percentage_share * allowance + advance = max_(benunit("uc_advance_repayment_amount", period), 0) + if law.abolish.advance: + advance = 0 + maintenance = max_(benunit("uc_child_maintenance_deduction_amount", period), 0) + statutory_limit = law.statutory_cap * allowance + ordinary = min_(advance + percentage, law.cap * allowance) + non_exempt = min_(ordinary + maintenance, statutory_limit) + last_resort = max_(benunit("uc_last_resort_deduction_amount", period), 0) + return non_exempt + last_resort diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py index 8271d6053f..27b9088196 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py @@ -1,80 +1,21 @@ from policyengine_uk.model_api import * -from policyengine_uk.variables.gov.dwp.universal_credit.deductions.uc_deduction_combination import ( - UCDeductionCombination, -) class uc_deduction_rate(Variable): label = "UC deduction rate" documentation = ( - "Deductions taken from this benefit unit's Universal Credit award as " - "a fraction of the standard allowance, after removing any abolished " - "deduction types and applying the deductions cap. The above-cap " - "excess (latent demand above 25% of the standard allowance, covering " - "last resort and child maintenance deductions) sits on top of the " - "cap." + "Cash deduction demand divided by the current standard allowance. " + "This reporting ratio changes when a reform changes the allowance while " + "fixed cash demand stays the same. uc_deduction_demand supplies the " + "award calculation directly, including when the allowance is zero." ) entity = BenUnit definition_period = YEAR value_type = float def formula(benunit, period, parameters): - # Law: the cap and abolition switches. Estimation: the mean amounts - # by type (gov.simulation), used only to split a household's total - # rate across its deduction types. - law = parameters(period).gov.dwp.universal_credit.deductions - m = parameters(period).gov.simulation.uc_deductions.mean_monthly_amount_by_type - latent = benunit("uc_latent_deduction_rate", period) - combination = benunit("uc_deduction_combination", period) - - advance_weight = 0.0 if law.abolish.advance else m.ADVANCE - third_party_weight = 0.0 if law.abolish.third_party else m.THIRD_PARTY - government_weight = 0.0 if law.abolish.government else m.GOVERNMENT - - def retained(kept, total): - return kept / max(total, 1e-9) - - retained_share = select( - [ - combination == UCDeductionCombination.ADVANCE_ONLY, - combination == UCDeductionCombination.THIRD_PARTY_ONLY, - combination == UCDeductionCombination.GOVERNMENT_ONLY, - combination == UCDeductionCombination.ADVANCE_AND_GOVERNMENT, - combination == UCDeductionCombination.ADVANCE_AND_THIRD_PARTY, - combination == UCDeductionCombination.THIRD_PARTY_AND_GOVERNMENT, - combination == UCDeductionCombination.ALL_THREE, - ], - [ - retained(advance_weight, m.ADVANCE), - retained(third_party_weight, m.THIRD_PARTY), - retained(government_weight, m.GOVERNMENT), - retained( - advance_weight + government_weight, - m.ADVANCE + m.GOVERNMENT, - ), - retained( - advance_weight + third_party_weight, - m.ADVANCE + m.THIRD_PARTY, - ), - retained( - third_party_weight + government_weight, - m.THIRD_PARTY + m.GOVERNMENT, - ), - retained( - advance_weight + third_party_weight + government_weight, - m.ADVANCE + m.THIRD_PARTY + m.GOVERNMENT, - ), - ], - default=0.0, + allowance = benunit("uc_standard_allowance", period) + demand = benunit("uc_deduction_demand", period) + return np.divide( + demand, allowance, out=np.zeros_like(demand), where=allowance > 0 ) - # The cappable portion covers the three modeled deduction types - # (advances, third party, government debt) and responds to the cap - # and abolition switches. Latent demand above the calibration-window - # cap belongs to categories permitted to exceed the cap (last resort - # and child maintenance deductions), exempt from both. - calibration_cap = parameters( - period - ).gov.simulation.uc_deductions.calibration_cap - cappable = min_(latent, calibration_cap) * retained_share - above_cap_excess = max_(latent - calibration_cap, 0) - return min_(cappable, law.cap) + above_cap_excess diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py index ca3bc4f7fe..53ad896eed 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py @@ -27,20 +27,17 @@ class uc_deductions(Variable): def formula(benunit, period, parameters): p = parameters(period).gov.dwp.universal_credit.deductions - rate = benunit("uc_deduction_rate", period) - standard_allowance = benunit("uc_standard_allowance", period) # Shared with uc_benefit_cap_reduction_after_floor. Under current law # the cap reduces the award first and deductions leave a penny of # what is left. Where a protected minimum floor binds, deductions are met # first, up to the floor allowance, and the cap reduction absorbs the - # rest. The floor then also binds on the above-cap excess that - # current law exempts from the deductions cap (last resort and child - # maintenance deductions); JRF's briefing does not say whether their - # floor exempts those categories, so that is a modeling choice. + # rest. The floor also binds on last resort exceptions and maintenance + # above the administrative cap. JRF's briefing does not say whether + # their floor exempts those categories, so that is a modeling choice. deductions, _ = allocate_uc_reductions( benunit("universal_credit_pre_benefit_cap", period), benunit("uc_benefit_cap_reduction", period), - rate * standard_allowance, + benunit("uc_deduction_demand", period), benunit("uc_maximum_reduction", period), p.minimum_payable * MONTHS_IN_YEAR, ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py new file mode 100644 index 0000000000..52b3ae73e0 --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py @@ -0,0 +1,28 @@ +from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( + reference_standard_allowance, +) + + +class uc_last_resort_deduction_amount(Variable): + label = "UC deductions exempt from the statutory ceiling" + documentation = ( + "Annual cash demand for the continuing fuel and water needs, housing costs " + "and rent exceptions in Schedule 6 paragraph 4(3)-(4). Excludes child " + "maintenance. An explicit amount overrides the legacy approximation, which " + "treats latent demand above the calibration cap as last resort cash at " + "the same year's unreformed allowance. The observed aggregate does not " + "separately identify these legal heads." + ) + entity = BenUnit + definition_period = YEAR + value_type = float + unit = GBP + reference = "https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4" + + def formula(benunit, period, parameters): + p = parameters(period).gov.simulation.uc_deductions + excess = max_( + benunit("uc_latent_deduction_rate", period) - p.calibration_cap, 0 + ) + return excess * reference_standard_allowance(benunit, period, parameters) From 41daefdd1671b029b8c2c650d30787f586cdd69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Juaristi?= <127882282+juaristi22@users.noreply.github.com> Date: Thu, 22 Oct 2026 17:06:26 +0100 Subject: [PATCH 2/3] Preserve deduction-rate inputs and narrow the advance fix --- changelog.d/2410.fixed.md | 2 +- docs/book/validation/uc-deductions.md | 79 ++++++++----------- .../deductions/statutory_cap.yaml | 10 --- .../universal_credit/uc_fixed_deductions.yaml | 57 ------------- .../uc_benefit_cap_reduction_after_floor.py | 3 +- .../deductions/_reduction_allocation.py | 2 +- .../uc_child_maintenance_deduction_amount.py | 17 ---- .../deductions/uc_deduction_demand.py | 45 ----------- .../deductions/uc_deduction_rate.py | 40 ++++++++-- .../deductions/uc_deductions.py | 11 ++- .../uc_last_resort_deduction_amount.py | 28 ------- 11 files changed, 75 insertions(+), 219 deletions(-) delete mode 100644 policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml delete mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py delete mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py delete mode 100644 policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py diff --git a/changelog.d/2410.fixed.md b/changelog.d/2410.fixed.md index 15e57b229b..d5592bbb05 100644 --- a/changelog.d/2410.fixed.md +++ b/changelog.d/2410.fixed.md @@ -1 +1 @@ -- Keep Universal Credit advance repayment cash demand fixed through allowance reforms, accept separate maintenance and last resort cash amounts, and distinguish administrative and statutory deduction limits. +- Keep Universal Credit advance repayment cash demand fixed through standard allowance reforms while preserving supplied deduction rates, existing caps, abolition switches and protected-floor allocation. diff --git a/docs/book/validation/uc-deductions.md b/docs/book/validation/uc-deductions.md index dfa98e39de..5ec105394f 100644 --- a/docs/book/validation/uc-deductions.md +++ b/docs/book/validation/uc-deductions.md @@ -8,56 +8,39 @@ PolicyEngine UK models the money DWP takes off Universal Credit awards to repay The implementation separates **latent demand** from the **statutory cap**. `uc_latent_deduction_rate` assigns deduction demand from the distribution DWP observed in March to May 2025 — the last full months under the 25% cap — and `gov.dwp.universal_credit.deductions.cap` applies the operational cap (40% to October 2019, 30%, 25%, then 15% under the Fair Repayment Rate from 30 April 2025) at runtime. Assigning observed post-cap rates directly would bake the cap into the data and make cap-raising reforms inexpressible. -## Fixed cash and percentage deductions +## Advance repayments under allowance reforms -`uc_advance_repayment_amount` is annual cash demand before the deduction cap, -abolition switches and available-award limits. Set the actual instalments when -known; zero explicitly removes the advance estimate. An allowance reform does -not increase that demand. Recovery can still rise when a higher allowance -relaxes a binding percentage ceiling. +`uc_advance_repayment_amount` accepts annual cash instalments before the cap, +abolition switch and available-award limits. Set the actual amount when known; +zero explicitly removes the advance estimate. A change to the standard allowance +does not increase this demand. Actual recovery can increase if a higher +allowance releases a binding deduction cap. For existing latent-rate and type-combination inputs, the fallback keeps the -existing marginal-mean split and converts the advance share using the **same +existing marginal-mean split and converts its advance share using the **same year's unreformed standard allowance** for the claimant category. The reference -uses the unannualised baseline parameter tree at 30 April, consistently with -fiscal-year sampling. This preserves the year's baseline estimate while -isolating an allowance reform. It does **not** identify a repayment's cash-origin -year or establish unchanged instalments across projected years or changes in -family status. Each year remains a cross-sectional imputation. Supply cash -amounts for the years concerned to describe a particular repayment schedule. - -The remaining third-party and government shares retain their estimated -percentage response. Those aggregate types mix legal heads: rent arrears are -10%–20% of the allowance, several other debts use 5%, continuing fuel/water -costs are cash, and overpayment rates are ceilings rather than instructions to -increase every agreed instalment. The coarse input cannot identify all those -arrangements. This change does not impute new deduction categories or change -dataset inputs. - -`uc_child_maintenance_deduction_amount` accepts known annual maintenance/fees or -arrears cash demand. The arrears-only flat rate is £36.40/month from 4 July 2019; -ongoing liability and fees depend on the amount due. No maintenance incidence -is assigned. Supply it separately from any aggregate third-party amount to -avoid counting it twice. Maintenance may exceed the **administrative cap**, -but ordinary debt and maintenance together remain within the **40% statutory -ceiling**. See [Schedule 7](https://www.legislation.gov.uk/uksi/2013/380/schedule/7) -and [the 2025 explanatory memorandum, paragraphs 5.10–5.12](https://www.legislation.gov.uk/uksi/2025/387/pdfs/uksiem_20250387_en_001.pdf#page=3). - -`uc_last_resort_deduction_amount` accepts the cash demand for the continuing -needs, housing-cost and rent exceptions in [Schedule 6 paragraph 4(3)–(4)](https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4). -Only this component bypasses the statutory ceiling. Its legacy fallback treats -the latent excess above the calibration cap as last resort cash at the same -year's unreformed allowance. The observed excess mixes child maintenance and -last resort heads, which the existing inputs cannot separate; that proxy is a -remaining data limitation. Known maintenance belongs in its separate cash input, -with the last-resort input set to its actual amount (including zero). - -`uc_deduction_demand` combines cash and percentage demand, applying the two caps. -Both deduction and benefit-cap allocation read that cash amount, preserving the -penny per assessment period and any contributed protected floor even if the -standard allowance is zero. `uc_deduction_rate` is its reporting ratio to the -current allowance, with zero returned when that denominator is zero; use cash -demand rather than reconstructing it from the reporting ratio. +reads the projected baseline parameter tree at 30 April, consistently with +fiscal-year sampling. For example, the 2025 single 25+ allowance of £400.14/month +converts a 10% advance share to £40.014/month. Reforming the allowance to £440 +keeps that cash demand unchanged, subject to the current 15% cap and penny floor. +[SI 2013/383 regulation 10](https://www.legislation.gov.uk/uksi/2013/383/regulation/10) +provides for recovery by offset/deduction; it does not set an allowance-indexed +instalment. + +The final award and protected-floor allocation continue to consume +`uc_deduction_rate` times the standard allowance. An explicitly supplied rate +retains its existing effect and overrides the rate formula, including its cash +advance calculation. The usual advance, third-party and government abolition +switches retain their existing behavior. + +This change isolates allowance reforms within each annual cross-section. The +legacy inputs do not identify the cash-origin year, repayment duration or cohort +schedule. They cannot establish unchanged instalments across projected years or +family-status changes. Supply cash for the relevant years to describe a known +advance schedule. Government/third-party percentage proxies and the aggregate +above-cap excess are unchanged; their legal classification, maintenance priority +and annual projection remain separate work under #2410. No maintenance or last +resort cash interface or new category incidence is introduced. ## Validation against DWP deductions statistics @@ -80,7 +63,7 @@ The pre-Fair-Repayment-Rate pileup at the cap and both regimes' mean amounts rep ## Limitations -These bound what the module can support. They are stated rather than tuned away. The historical validation below predates the separate fixed-cash inputs; population validation has not been rerun for this change. +These bound what the module can support. They are stated rather than tuned away. ### Aggregates scale with the UC caseload @@ -104,7 +87,7 @@ The `protected_floor` lever limits combined deductions and benefit cap reduction JRF specifies the combined limit, not a priority between the two: their [September 2026 briefing](https://www.jrf.org.uk/social-security/a-protected-minimum-floor-in-universal-credit-to-cut-deep-child-poverty) proposes that "the sum of the 'capped amount' and any debt deductions is limited to the difference between a household's standard allowance and the level of the protected minimum floor". Debt first is the modeling choice, for three reasons. Under the Fair Repayment Rate the 15% deductions cap equals the allowance an 85% floor leaves, so cappable deductions never breach the floor on their own, and the policy JRF builds on (extending the Fair Repayment Rate "to all deductions, including the benefit cap") leaves deductions where that rate puts them. JRF's own example (standard allowance £98 a week, a £15 deduction, an £80 cap reduction, total limited to £15) is consistent with it. And it does not depend on how heavily the household is capped: if the deduction were limited by the gross cap reduction, a household capped down to a few pence would have its deduction squeezed to almost nothing even though the floor then removes most of that cap. The award is the same under either priority; only the split differs. -Where deductions alone do exceed the allowance, the floor binds on the whole of `uc_deductions`, including statutory last resort exceptions and maintenance allowed above the administrative cap. JRF's briefing does not say whether their floor exempts those categories — its worked example involves only cappable deductions and the benefit cap — so this is a modeling choice. +Where deductions alone do exceed the allowance, the floor binds on the whole of `uc_deductions`, including the above-cap excess that current law exempts from the deductions cap (last resort and child maintenance deductions). JRF's briefing does not say whether their floor exempts those categories — its worked example involves only cappable deductions and the benefit cap — so this is a modeling choice. Both components report what the award actually loses, so `uc_deductions` and `uc_benefit_cap_reduction_after_floor` sum to the entitlement forgone, and the applied cap reduction never exceeds the award (a £1,000 cap reduction on a £500 award applies £500). `uc_benefit_cap_reduction`, the regulation 81 amount, itself stays gross, and so does `benefit_cap_reduction`, which adds it to the Housing Benefit reduction. Read `uc_benefit_cap_reduction_after_floor` for the cap reduction applied to a UC award under a floor reform. diff --git a/policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml b/policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml deleted file mode 100644 index e23ae0a723..0000000000 --- a/policyengine_uk/parameters/gov/dwp/universal_credit/deductions/statutory_cap.yaml +++ /dev/null @@ -1,10 +0,0 @@ -description: Universal Credit limits ordinary debt and child maintenance deductions together to this share of the standard allowance, except for the continuing needs, housing costs and rent deductions in Schedule 6 paragraph 4(3)-(4). -values: - 2013-04-29: 0.4 -metadata: - label: UC deductions statutory ceiling - unit: /1 - period: year - reference: - - title: Social Security (Claims and Payments) Regulations 2013, Schedule 6 paragraph 4 - href: https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4 diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml index 465aba3ff1..1074e2fa75 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml @@ -1,7 +1,5 @@ # SI 2013/383 reg 10: advances are cash instalments, not a percentage. # SI 2013/380 Sch 6 paras 3-4: penny floor, ceiling and exceptions. -# EM to SI 2025/387 paras 5.10-5.12: maintenance may exceed the -# administrative cap, but not the statutory ceiling; £36.40/month. - name: An allowance increase leaves an affordable fixed advance unchanged period: 2025 absolute_error_margin: 0.01 @@ -56,47 +54,6 @@ # £50 cash + 5% x £440 = £72; administrative cap £66/month. uc_deductions: 792 -- name: Maintenance is fixed cash and may exceed the administrative cap - period: 2025 - absolute_error_margin: 0.01 - input: - age: 30 - would_claim_uc: true - universal_credit_pre_benefit_cap: 6_000 - uc_advance_repayment_amount: 720 - uc_child_maintenance_deduction_amount: 436.8 - gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 400 - output: - # £60 ordinary + £36.40 maintenance each month, under statutory £160. - uc_deductions: 1_156.8 - -- name: Maintenance and ordinary debt stay within the statutory ceiling - period: 2025 - absolute_error_margin: 0.01 - input: - age: 30 - would_claim_uc: true - universal_credit_pre_benefit_cap: 6_000 - uc_child_maintenance_deduction_amount: 436.8 - gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 50 - output: - # 40% x £50 x 12, rather than all of £436.80. - uc_deductions: 240 - -- name: Only a last resort cash component can exceed the statutory ceiling - period: 2025 - absolute_error_margin: 0.01 - input: - age: 30 - would_claim_uc: true - universal_credit_pre_benefit_cap: 6_000 - uc_child_maintenance_deduction_amount: 436.8 - uc_last_resort_deduction_amount: 120 - gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 50 - output: - # £20/month statutory-limited maintenance plus £10 continuing needs. - uc_deductions: 360 - - name: Fixed deductions still leave a penny per assessment period period: 2025 absolute_error_margin: 0.01 @@ -151,20 +108,6 @@ output: uc_deductions: 0 -- name: A zero standard allowance does not erase a continuing needs deduction - period: 2025 - absolute_error_margin: 0.01 - input: - age: 30 - would_claim_uc: true - universal_credit_pre_benefit_cap: 6_000 - uc_last_resort_deduction_amount: 120 - gov.dwp.universal_credit.standard_allowance.amount.SINGLE_OLD: 0 - output: - uc_deduction_demand: 120 - uc_deductions: 120 - universal_credit: 5_880 - - name: A capped family's fixed advance stays cash at the current allowance period: 2025 absolute_error_margin: 0.01 diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py b/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py index ed63031212..dfc789654f 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/benefit_cap/uc_benefit_cap_reduction_after_floor.py @@ -32,7 +32,8 @@ def formula(benunit, period, parameters): _, cap_reduction = allocate_uc_reductions( benunit("universal_credit_pre_benefit_cap", period), benunit("uc_benefit_cap_reduction", period), - benunit("uc_deduction_demand", period), + benunit("uc_deduction_rate", period) + * benunit("uc_standard_allowance", period), benunit("uc_maximum_reduction", period), p.minimum_payable * MONTHS_IN_YEAR, ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py index 53b6f66d16..b556390750 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_reduction_allocation.py @@ -18,7 +18,7 @@ def allocate_uc_reductions( gross_cap_reduction: uc_benefit_cap_reduction, the regulation 81 amount of SI 2013/376. benefit_cap_reduction and uc_has_deduction read it too, so it is never floored. - deduction_demand: cash demand after the administrative/statutory caps, + deduction_demand: the deduction rate times the standard allowance, before the one-penny rule. max_reduction: uc_maximum_reduction, infinite when no protected floor is in force (current law). diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py deleted file mode 100644 index 2531bf0587..0000000000 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_child_maintenance_deduction_amount.py +++ /dev/null @@ -1,17 +0,0 @@ -from policyengine_uk.model_api import * - - -class uc_child_maintenance_deduction_amount(Variable): - label = "UC child maintenance cash deduction demand" - documentation = ( - "Annual cash demand for ongoing child maintenance, fees and arrears, before " - "the statutory ceiling and penny floor. Supply the actual amount separately " - "from other third party debt; no maintenance incidence is imputed. The " - "arrears-only flat rate is £36.40 a month from 4 July 2019; ongoing " - "maintenance and fees depend on the amount due." - ) - entity = BenUnit - definition_period = YEAR - value_type = float - unit = GBP - reference = "https://www.legislation.gov.uk/uksi/2013/380/schedule/7" diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py deleted file mode 100644 index 495791f510..0000000000 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_demand.py +++ /dev/null @@ -1,45 +0,0 @@ -from policyengine_uk.model_api import * -from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( - deduction_type_shares, -) - - -class uc_deduction_demand(Variable): - label = "UC cash deductions before the award and protected floor limits" - documentation = ( - "Cash advance and maintenance demands plus the estimated percentage heads. " - "Ordinary debt obeys the administrative cap; maintenance can exceed it, " - "but together they obey the statutory ceiling. Only Schedule 6 " - "paragraph 4(3)-(4) last resort deductions bypass that ceiling. The legacy " - "third party and government rate shares remain calibration proxies, not " - "an assertion that every agreement in those categories is percentage based." - ) - entity = BenUnit - definition_period = YEAR - value_type = float - unit = GBP - reference = "https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4" - - def formula(benunit, period, parameters): - law = parameters(period).gov.dwp.universal_credit.deductions - calibration_cap = parameters( - period - ).gov.simulation.uc_deductions.calibration_cap - _, third_share, government_share = deduction_type_shares( - benunit, period, parameters - ) - percentage_share = third_share * ( - not law.abolish.third_party - ) + government_share * (not law.abolish.government) - allowance = max_(benunit("uc_standard_allowance", period), 0) - latent = max_(benunit("uc_latent_deduction_rate", period), 0) - percentage = min_(latent, calibration_cap) * percentage_share * allowance - advance = max_(benunit("uc_advance_repayment_amount", period), 0) - if law.abolish.advance: - advance = 0 - maintenance = max_(benunit("uc_child_maintenance_deduction_amount", period), 0) - statutory_limit = law.statutory_cap * allowance - ordinary = min_(advance + percentage, law.cap * allowance) - non_exempt = min_(ordinary + maintenance, statutory_limit) - last_resort = max_(benunit("uc_last_resort_deduction_amount", period), 0) - return non_exempt + last_resort diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py index 27b9088196..f4ad8ef7a3 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py @@ -1,21 +1,47 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( + deduction_type_shares, +) class uc_deduction_rate(Variable): label = "UC deduction rate" documentation = ( - "Cash deduction demand divided by the current standard allowance. " - "This reporting ratio changes when a reform changes the allowance while " - "fixed cash demand stays the same. uc_deduction_demand supplies the " - "award calculation directly, including when the allowance is zero." + "Deductions as a fraction of the current Universal Credit standard allowance, " + "after removing abolished ordinary debt types and applying the cap. " + "Advance demand is held in cash through an allowance reform; the rate " + "therefore adjusts when the allowance changes. An explicitly supplied " + "rate retains its existing precedence in the final award. The legacy " + "above-cap excess is unchanged." ) entity = BenUnit definition_period = YEAR value_type = float def formula(benunit, period, parameters): + law = parameters(period).gov.dwp.universal_credit.deductions + calibration_cap = parameters( + period + ).gov.simulation.uc_deductions.calibration_cap + _, third_share, government_share = deduction_type_shares( + benunit, period, parameters + ) + remaining_share = third_share * ( + not law.abolish.third_party + ) + government_share * (not law.abolish.government) allowance = benunit("uc_standard_allowance", period) - demand = benunit("uc_deduction_demand", period) - return np.divide( - demand, allowance, out=np.zeros_like(demand), where=allowance > 0 + latent = benunit("uc_latent_deduction_rate", period) + other_rate = min_(latent, calibration_cap) * remaining_share + advance = benunit("uc_advance_repayment_amount", period) + if law.abolish.advance: + advance = 0 + advance_rate = np.divide( + max_(advance, 0), + allowance, + out=np.zeros_like(allowance), + where=allowance > 0, ) + # Preserve the original unclassified above-cap proxy. Its legal + # categories and time path need separate data/policy work (#2410). + above_cap_excess = max_(latent - calibration_cap, 0) + return min_(advance_rate + other_rate, law.cap) + above_cap_excess diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py index 53ad896eed..ca3bc4f7fe 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deductions.py @@ -27,17 +27,20 @@ class uc_deductions(Variable): def formula(benunit, period, parameters): p = parameters(period).gov.dwp.universal_credit.deductions + rate = benunit("uc_deduction_rate", period) + standard_allowance = benunit("uc_standard_allowance", period) # Shared with uc_benefit_cap_reduction_after_floor. Under current law # the cap reduces the award first and deductions leave a penny of # what is left. Where a protected minimum floor binds, deductions are met # first, up to the floor allowance, and the cap reduction absorbs the - # rest. The floor also binds on last resort exceptions and maintenance - # above the administrative cap. JRF's briefing does not say whether - # their floor exempts those categories, so that is a modeling choice. + # rest. The floor then also binds on the above-cap excess that + # current law exempts from the deductions cap (last resort and child + # maintenance deductions); JRF's briefing does not say whether their + # floor exempts those categories, so that is a modeling choice. deductions, _ = allocate_uc_reductions( benunit("universal_credit_pre_benefit_cap", period), benunit("uc_benefit_cap_reduction", period), - benunit("uc_deduction_demand", period), + rate * standard_allowance, benunit("uc_maximum_reduction", period), p.minimum_payable * MONTHS_IN_YEAR, ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py deleted file mode 100644 index 52b3ae73e0..0000000000 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_last_resort_deduction_amount.py +++ /dev/null @@ -1,28 +0,0 @@ -from policyengine_uk.model_api import * -from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( - reference_standard_allowance, -) - - -class uc_last_resort_deduction_amount(Variable): - label = "UC deductions exempt from the statutory ceiling" - documentation = ( - "Annual cash demand for the continuing fuel and water needs, housing costs " - "and rent exceptions in Schedule 6 paragraph 4(3)-(4). Excludes child " - "maintenance. An explicit amount overrides the legacy approximation, which " - "treats latent demand above the calibration cap as last resort cash at " - "the same year's unreformed allowance. The observed aggregate does not " - "separately identify these legal heads." - ) - entity = BenUnit - definition_period = YEAR - value_type = float - unit = GBP - reference = "https://www.legislation.gov.uk/uksi/2013/380/schedule/6/paragraph/4" - - def formula(benunit, period, parameters): - p = parameters(period).gov.simulation.uc_deductions - excess = max_( - benunit("uc_latent_deduction_rate", period) - p.calibration_cap, 0 - ) - return excess * reference_standard_allowance(benunit, period, parameters) From 52201202239dfb73ddb5224ceff0753cdc2e4787 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 22 Oct 2026 15:29:06 -0400 Subject: [PATCH 3/3] Preserve per-unit missingness for UC advance cash inputs --- .../fix-2574-advance-missingness.fixed.md | 1 + docs/book/validation/uc-deductions.md | 4 +- .../universal_credit/uc_fixed_deductions.yaml | 35 ++++ .../test_uc_advance_repayment_properties.py | 156 ++++++++++++++++++ .../deductions/_deduction_amounts.py | 12 ++ .../deductions/uc_advance_repayment_amount.py | 17 +- .../deductions/uc_deduction_rate.py | 8 + 7 files changed, 221 insertions(+), 12 deletions(-) create mode 100644 changelog.d/fix-2574-advance-missingness.fixed.md create mode 100644 policyengine_uk/tests/test_uc_advance_repayment_properties.py diff --git a/changelog.d/fix-2574-advance-missingness.fixed.md b/changelog.d/fix-2574-advance-missingness.fixed.md new file mode 100644 index 0000000000..fba866c16f --- /dev/null +++ b/changelog.d/fix-2574-advance-missingness.fixed.md @@ -0,0 +1 @@ +- Preserved each benefit unit's Universal Credit advance repayment fallback when other units supply cash, while retaining explicit zero repayments. diff --git a/docs/book/validation/uc-deductions.md b/docs/book/validation/uc-deductions.md index 5ec105394f..d5b9e7e52d 100644 --- a/docs/book/validation/uc-deductions.md +++ b/docs/book/validation/uc-deductions.md @@ -12,7 +12,9 @@ The implementation separates **latent demand** from the **statutory cap**. `uc_l `uc_advance_repayment_amount` accepts annual cash instalments before the cap, abolition switch and available-award limits. Set the actual amount when known; -zero explicitly removes the advance estimate. A change to the standard allowance +zero explicitly removes the advance estimate. Negative values, including the +default -1, mean no amount was supplied. Each omitted benefit unit uses the +fallback even when other units supply cash. A change to the standard allowance does not increase this demand. Actual recovery can increase if a higher allowance releases a binding deduction cap. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml index 1074e2fa75..4446602377 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/uc_fixed_deductions.yaml @@ -108,6 +108,41 @@ output: uc_deductions: 0 +- name: An explicit zero leaves another benefit unit's advance estimate intact + period: 2025 + absolute_error_margin: 0.01 + input: + people: + zero_claimant: + age: 30 + missing_claimant: + age: 30 + benunits: + zero: + members: [zero_claimant] + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_benefit_cap_reduction: 0 + uc_latent_deduction_rate: 0.1 + uc_deduction_combination: ADVANCE_ONLY + uc_advance_repayment_amount: 0 + missing: + members: [missing_claimant] + would_claim_uc: true + universal_credit_pre_benefit_cap: 6_000 + uc_benefit_cap_reduction: 0 + uc_latent_deduction_rate: 0.1 + uc_deduction_combination: ADVANCE_ONLY + households: + zero_household: + members: [zero_claimant] + missing_household: + members: [missing_claimant] + output: + # Only the supplied zero removes the £40.014/month legacy advance. + uc_deductions: [0, 480.168] + universal_credit: [6_000, 5_519.832] + - name: A capped family's fixed advance stays cash at the current allowance period: 2025 absolute_error_margin: 0.01 diff --git a/policyengine_uk/tests/test_uc_advance_repayment_properties.py b/policyengine_uk/tests/test_uc_advance_repayment_properties.py new file mode 100644 index 0000000000..f5445df4f6 --- /dev/null +++ b/policyengine_uk/tests/test_uc_advance_repayment_properties.py @@ -0,0 +1,156 @@ +"""A unit's advance repayment input must retain its own missingness. + +Core creates an input array for the whole population when any benefit unit +supplies a value. Omitted units must still use their legacy cash estimate, +while an explicitly supplied zero must suppress advance repayments. +""" + +import numpy as np +import pytest +from hypothesis import example, given, settings +from hypothesis import strategies as st + +from policyengine_uk import Simulation + +pytestmark = pytest.mark.usefixtures("cloned_uk_tax_benefit_system") + +YEAR = 2025 +FALLBACK = 0.1 * 400.14 * 12 +COMBINATIONS = [ + "NONE", + "ADVANCE_ONLY", + "THIRD_PARTY_ONLY", + "GOVERNMENT_ONLY", + "ADVANCE_AND_GOVERNMENT", + "ADVANCE_AND_THIRD_PARTY", + "THIRD_PARTY_AND_GOVERNMENT", + "ALL_THREE", +] + + +def situation(amounts, year=YEAR, age=30, latent=0.1, combination="ADVANCE_ONLY"): + people, benunits, households = {}, {}, {} + for i, amount in enumerate(amounts): + person = f"person_{i}" + people[person] = {"age": {year: age}} + unit = { + "members": [person], + "would_claim_uc": {year: True}, + "universal_credit_pre_benefit_cap": {year: 6_000}, + "uc_benefit_cap_reduction": {year: 0}, + "uc_latent_deduction_rate": {year: latent}, + "uc_deduction_combination": {year: combination}, + } + if amount is not None: + unit["uc_advance_repayment_amount"] = {year: amount} + benunits[f"benunit_{i}"] = unit + households[f"household_{i}"] = {"members": [person]} + return {"people": people, "benunits": benunits, "households": households} + + +@pytest.mark.parametrize( + "amounts, expected", + [ + ([0, None], [0, FALLBACK]), + ([None, 0], [FALLBACK, 0]), + ([None, None], [FALLBACK, FALLBACK]), + ([0, 0], [0, 0]), + ([120, 240], [120, 240]), + ([-1, 0], [FALLBACK, 0]), + ([-1, -1], [FALLBACK, FALLBACK]), + ], + ids=[ + "zero-then-missing", + "missing-then-zero", + "fully-unsupplied", + "fully-supplied-zero", + "fully-supplied-positive", + "sentinel-and-zero", + "fully-supplied-sentinels", + ], +) +def test_each_unit_resolves_its_own_advance_amount(amounts, expected): + simulation = Simulation(situation=situation(amounts)) + np.testing.assert_allclose( + simulation.calculate("uc_deductions", YEAR), expected, rtol=1e-6, atol=1e-3 + ) + + +cash = st.integers(1, 300_000).map(lambda pennies: pennies / 100) +optional_cash = st.one_of(st.sampled_from([None, -1.0, 0.0]), cash) + + +@settings(max_examples=12, deadline=None, derandomize=True) +@given( + target=optional_cash, + peers=st.lists(optional_cash, min_size=1, max_size=4), + position=st.integers(0, 4), + age=st.integers(18, 60), + latent=st.floats(0, 0.4, allow_nan=False, allow_infinity=False), + combination=st.sampled_from(COMBINATIONS), + year=st.sampled_from([2025, 2026]), +) +@example( + target=None, + peers=[0], + position=1, + age=30, + latent=0.1, + combination="ADVANCE_ONLY", + year=2025, +) +@example( + target=None, + peers=[None, 120], + position=0, + age=24, + latent=0.2, + combination="ALL_THREE", + year=2026, +) +@example( + target=0, + peers=[0, 120], + position=1, + age=30, + latent=0.1, + combination="ADVANCE_ONLY", + year=2025, +) +@example( + target=120, + peers=[0, 240], + position=2, + age=30, + latent=0.1, + combination="ADVANCE_AND_GOVERNMENT", + year=2025, +) +@example( + target=-1, + peers=[0], + position=0, + age=30, + latent=0.1, + combination="ADVANCE_ONLY", + year=2025, +) +def test_advance_deduction_is_independent_of_peers_supplied_cash( + target, peers, position, age, latent, combination, year +): + """Change only other units' supplied cash; retain the target's deduction.""" + target_index = position % (len(peers) + 1) + missing_peers = [None] * len(peers) + supplied_peers = peers.copy() + missing_peers.insert(target_index, target) + supplied_peers.insert(target_index, target) + + def deduction(amounts): + simulation = Simulation( + situation=situation(amounts, year, age, latent, combination) + ) + return simulation.calculate("uc_deductions", year)[target_index] + + assert deduction(supplied_peers) == pytest.approx( + deduction(missing_peers), rel=1e-6, abs=1e-3 + ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py index b393e12067..71016bd19a 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/_deduction_amounts.py @@ -60,3 +60,15 @@ def reference_standard_allowance(benunit, period, parameters): p = parameters(f"{period.start.year}-04-30").baseline.gov.dwp.universal_credit claimant_type = benunit("uc_standard_allowance_claimant_type", period) return p.standard_allowance.amount[claimant_type] * MONTHS_IN_YEAR + + +def estimated_advance_repayment_amount(benunit, period, parameters): + """Convert the legacy advance share to same-year unreformed cash.""" + p = parameters(period).gov.simulation.uc_deductions + advance_share, _, _ = deduction_type_shares(benunit, period, parameters) + latent = max_(benunit("uc_latent_deduction_rate", period), 0) + return ( + min_(latent, p.calibration_cap) + * advance_share + * reference_standard_allowance(benunit, period, parameters) + ) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py index ba3e86c540..4499a675bc 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_advance_repayment_amount.py @@ -1,7 +1,6 @@ from policyengine_uk.model_api import * from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( - deduction_type_shares, - reference_standard_allowance, + estimated_advance_repayment_amount, ) @@ -9,7 +8,9 @@ class uc_advance_repayment_amount(Variable): label = "UC advance repayment cash demand" documentation = ( "Annual cash instalments before the deductions cap, abolition and penny floor. " - "An explicit amount, including zero, overrides the legacy estimate. The " + "An explicit nonnegative amount, including zero, overrides the legacy " + "estimate. Negative values, including the default -1, mean no amount " + "was supplied; the deduction rate then uses the fallback for that unit. The " "fallback splits the supplied annual latent rate by the published type means " "and converts its advance share using that year's unreformed allowance. " "It is an annual cross-sectional estimate, not a longitudinal debt schedule." @@ -17,15 +18,9 @@ class uc_advance_repayment_amount(Variable): entity = BenUnit definition_period = YEAR value_type = float + default_value = -1 unit = GBP reference = "https://www.legislation.gov.uk/uksi/2013/383/regulation/10" def formula(benunit, period, parameters): - p = parameters(period).gov.simulation.uc_deductions - advance_share, _, _ = deduction_type_shares(benunit, period, parameters) - latent = max_(benunit("uc_latent_deduction_rate", period), 0) - return ( - min_(latent, p.calibration_cap) - * advance_share - * reference_standard_allowance(benunit, period, parameters) - ) + return estimated_advance_repayment_amount(benunit, period, parameters) diff --git a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py index f4ad8ef7a3..d1b5539560 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit/deductions/uc_deduction_rate.py @@ -1,6 +1,7 @@ from policyengine_uk.model_api import * from policyengine_uk.variables.gov.dwp.universal_credit.deductions._deduction_amounts import ( deduction_type_shares, + estimated_advance_repayment_amount, ) @@ -33,6 +34,13 @@ def formula(benunit, period, parameters): latent = benunit("uc_latent_deduction_rate", period) other_rate = min_(latent, calibration_cap) * remaining_share advance = benunit("uc_advance_repayment_amount", period) + # A partially supplied input array contains -1 for omitted units. + # Resolve those units independently, retaining explicitly supplied zero. + advance = where( + advance >= 0, + advance, + estimated_advance_repayment_amount(benunit, period, parameters), + ) if law.abolish.advance: advance = 0 advance_rate = np.divide(