From 3eee5f005a7e965b296b1ffabb20f90a1b3c5504 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 1 Oct 2026 16:01:38 -0400 Subject: [PATCH 01/22] WIP: count a shared non-dependant in each joint tenant's HB size criteria Adds the non_dependant_normally_resides_with input (default: every joint occupier, LHA Guidance Manual 2.110; head-only or other joint occupiers for 2.093 example 2) and routes HB 13D(3) other occupiers through it. Still to do: 13D(2)(a)(i), 13D(3A), reg 74(5) and CTR para 8(5) apportionment, tests, impact. Co-Authored-By: Claude Opus 5.5 --- .../variables/gov/dwp/LHA_allowed_bedrooms.py | 14 ++- .../housing_benefit_LHA_allowed_bedrooms.py | 31 ++++- .../non_dependant_normally_resides_with.py | 115 ++++++++++++++++++ 3 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py diff --git a/policyengine_uk/variables/gov/dwp/LHA_allowed_bedrooms.py b/policyengine_uk/variables/gov/dwp/LHA_allowed_bedrooms.py index a89c371159..cd7a81e243 100644 --- a/policyengine_uk/variables/gov/dwp/LHA_allowed_bedrooms.py +++ b/policyengine_uk/variables/gov/dwp/LHA_allowed_bedrooms.py @@ -26,7 +26,9 @@ def rooms_for_children(boys_under_10, older_boys, girls_under_10, older_girls): return over_10_rooms + under_10_rooms -def bedrooms_for_children(benunit, period, own_child=None, other_child=None): +def bedrooms_for_children( + benunit, period, own_child=None, other_child=None, count_other=None +): """Bedrooms for the children under 16 in the family's size criteria. Children must share rooms in pairs unless they are opposite-sex and one @@ -37,7 +39,9 @@ def bedrooms_for_children(benunit, period, own_child=None, other_child=None): default, every member under 16). ``other_child`` marks people under 16 in other families of the household who count in the household head's family's size criteria, such as a non-dependant's child; they share rooms - with the head family's own children. + with the head family's own children. ``count_other``, if given, maps a + person mask to the number of those people counted for each family, in + place of counting them all for the household head's family. """ person = benunit.members age = person("age", period) @@ -53,8 +57,10 @@ def count(group): own = benunit.sum(own_child & group) if other_child is None: return own - others = person.household.sum(other_child & under_16 & group) - return own + head_family * benunit.max(others) + others = other_child & under_16 & group + if count_other is not None: + return own + count_other(others) + return own + head_family * benunit.max(person.household.sum(others)) return rooms_for_children( count(under_10 & male), diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py index 414d2d577c..b9afff8c6a 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py @@ -2,6 +2,29 @@ from policyengine_uk.variables.gov.dwp.LHA_allowed_bedrooms import ( bedrooms_for_children, ) +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + non_dependants_residing_with, +) + + +def housing_benefit_other_occupiers(benunit, period, other_occupier): + """For each family, the number of people marked by ``other_occupier`` + (occupiers outside every family liable for the household's rent) who + occupy its dwelling (HB Regs 2006 reg 13D(12)). A boarder or lodger, who + pays the householder, counts for the household head's family. A + non-dependant counts for each joint occupier they normally reside with + (LHA Guidance Manual paras 2.093 and 2.110; see + non_dependant_normally_resides_with).""" + person = benunit.members + boarder_or_lodger = person("pays_rent_to_householder", period) + head_family = benunit.any(person("is_household_head", period)) + of_householder = head_family * benunit.max( + person.household.sum(other_occupier & boarder_or_lodger) + ) + non_dependants = non_dependants_residing_with( + benunit, period, other_occupier & ~boarder_or_lodger + ) + return of_householder + non_dependants class housing_benefit_LHA_allowed_bedrooms(Variable): @@ -59,9 +82,8 @@ def formula(benunit, period, parameters): # everyone in a non-dependant's, boarder's or lodger's family, # including their children. other_occupier = ~head_family & ~sharer & occupier - is_head_family = benunit.any(person("is_household_head", period)) - other_occupiers = is_head_family * benunit.max( - person.household.sum(other_occupier & aged_16_or_over) + other_occupiers = housing_benefit_other_occupiers( + benunit, period, other_occupier & aged_16_or_over ) # Reg 13D(3)(c)-(e): the occupiers' children, the claimant's own and # other families', share rooms with each other. @@ -70,6 +92,9 @@ def formula(benunit, period, parameters): period, own_child=occupier, other_child=other_occupier, + count_other=lambda mask: housing_benefit_other_occupiers( + benunit, period, mask + ), ) # Reg 13D(3A) and (3B): additional bedrooms. additional = benunit("housing_benefit_LHA_additional_bedrooms", period) diff --git a/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py new file mode 100644 index 0000000000..7488f1ceff --- /dev/null +++ b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py @@ -0,0 +1,115 @@ +from policyengine_uk.model_api import * + + +class NonDependantResidence(Enum): + EVERY_JOINT_OCCUPIER = "Every family liable for the household's rent" + HOUSEHOLD_HEAD_FAMILY = "The household head's family only" + OTHER_JOINT_OCCUPIERS = ( + "The families sharing the household's rent with the household head's " + "family only" + ) + + +class non_dependant_normally_resides_with(Variable): + value_type = Enum + possible_values = NonDependantResidence + default_value = NonDependantResidence.EVERY_JOINT_OCCUPIER + entity = BenUnit + label = "Joint occupiers this family's non-dependants normally reside with" + documentation = ( + "For a family of non-dependants in a household whose rent is shared " + "by joint occupiers (joint tenants and other sharers of the rent), " + "which of those joint occupiers the family normally resides with for " + "Housing Benefit and Council Tax Reduction. This is a question of " + "fact. A non-dependant who lives with all of them, such as a friend " + "of two joint tenants, is each one's non-dependant: they count in " + "each joint tenant's size criteria and their deduction is apportioned " + "between them. One who lives with only one joint tenant, such as that " + "tenant's sister, counts only for that tenant, who bears the whole " + "deduction. The default is every joint occupier. With more than one " + "family sharing the rent with the household head's family, the third " + "value covers all of those families together. Where no family shares " + "the rent, every value means the household head's family. Universal " + "Credit does not use this input: a non-dependant counts in one Universal " + "Credit claim only, which the model gives to the household head's " + "family (see is_non_dependant_of_household_head)." + ) + definition_period = YEAR + reference = ( + "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", + "https://www.legislation.gov.uk/uksi/2006/213/regulation/13D", + "https://www.legislation.gov.uk/uksi/2006/213/regulation/74", + "https://www.legislation.gov.uk/uksi/2006/214/regulation/3", + "https://www.legislation.gov.uk/uksi/2006/214/regulation/55", + "https://www.legislation.gov.uk/uksi/2012/2885/regulation/9", + "https://www.legislation.gov.uk/uksi/2012/2885/schedule/1/paragraph/8", + "https://assets.publishing.service.gov.uk/media/5a758238ed915d6faf2b38a2/lha-guidance-manual.pdf#page=33", + ) + + +def _joint_occupiers_by_residence(benunit, period): + """Pairs of (residence value, whether each family is one of the joint + occupiers a non-dependant with that value normally resides with).""" + person = benunit.members + values = NonDependantResidence + head_family = benunit.any(person("is_household_head", period)) + sharer = benunit("liable_for_share_of_household_rent", period) & ~head_family + in_sharer_family = person.benunit( + "liable_for_share_of_household_rent", period + ) & ~person.benunit.any(person("is_household_head", period)) + rent_is_shared = benunit.any(person.household.any(in_sharer_family)) + return ( + (values.EVERY_JOINT_OCCUPIER, head_family | sharer), + (values.HOUSEHOLD_HEAD_FAMILY, head_family), + (values.OTHER_JOINT_OCCUPIERS, where(rent_is_shared, sharer, head_family)), + ) + + +def non_dependants_residing_with(benunit, period, non_dependant): + """For each family, the number of the household's people marked by + ``non_dependant`` (members of non-dependant families) who normally reside + with it under non_dependant_normally_resides_with.""" + person = benunit.members + residence = person.benunit("non_dependant_normally_resides_with", period) + count = 0 + for value, joint_occupier in _joint_occupiers_by_residence(benunit, period): + in_household = benunit.max( + person.household.sum(non_dependant & (residence == value)) + ) + count = count + joint_occupier * in_household + return count + + +def apportioned_non_dependant_deductions(benunit, period, deductions, equally): + """For each family, its part of the deductions for the household's + non-dependants (``deductions``, one amount per person and zero for anyone + who is not a non-dependant), each split between the joint occupiers the + non-dependant normally resides with. + + With ``equally`` false (Housing Benefit, reg 74(5)), each joint occupier's + part is its share of the rent among them: the people liable for the rent + in its family over those in all of them. With ``equally`` true (Council + Tax Reduction, SI 2012/2885 Sch 1 para 8(5)), each part is one over the + number of people liable among them, and the whole where only the family + is liable. + """ + person = benunit.members + residence = person.benunit("non_dependant_normally_resides_with", period) + liable = person("is_liable_for_household_rent", period) + liable_in_family = benunit.sum(liable) + total = 0 + for value, joint_occupier in _joint_occupiers_by_residence(benunit, period): + liable_in_joint_occupiers = benunit.max( + person.household.sum(liable & benunit.project(joint_occupier)) + ) + if equally: + part = where( + liable_in_joint_occupiers > liable_in_family, + 1 / max_(liable_in_joint_occupiers, 1), + 1, + ) + else: + part = liable_in_family / max_(liable_in_joint_occupiers, 1) + pool = benunit.max(person.household.sum(deductions * (residence == value))) + total = total + joint_occupier * part * pool + return total From 55fb4624a406d9ae0dea05ac5305885d4dd1ed9f Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 2 Oct 2026 01:24:16 -0400 Subject: [PATCH 02/22] Count a shared non-dependant for each joint tenant in HB and CTR A non-dependant who normally resides with several joint occupiers is each one's non-dependant (HB Regs 2006 reg 3; LHA Guidance Manual 2.110): they count in each joint tenant's size criteria (reg 13D(3), (3A)) and keep each from the young individual's shared accommodation rate (13D(2)(a)(i)), and their deduction is apportioned (reg 74(5); CTR Sch 1 para 8(5)). One who lives with only one joint tenant counts for that tenant alone, who bears the whole deduction (2.093 example 2; HBGM A5 5.622). The new BenUnit input non_dependant_normally_resides_with records which, by default every joint occupier. Universal Credit is unchanged (Sch 4 para 9(2)(f)). Co-Authored-By: Claude Opus 5.5 --- ...HA_joint_tenants_shared_non_dependant.yaml | 450 ++++++++++++++++++ ..._tenant_shared_non_dependant_properties.py | 303 ++++++++++++ .../housing_benefit_non_dep_deductions.py | 17 +- ...housing_benefit_LHA_additional_bedrooms.py | 16 +- .../gov/dwp/housing_benefit_LHA_category.py | 5 +- ...sing_benefit_claimant_has_non_dependant.py | 47 ++ .../dwp/is_non_dependant_of_household_head.py | 8 +- .../gov/dwp/lha_renter_has_non_dependant.py | 63 +-- .../council_tax_reduction/_legacy.py | 17 +- ...ouncil_tax_reduction_non_dep_deductions.py | 24 +- 10 files changed, 896 insertions(+), 54 deletions(-) create mode 100644 policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml create mode 100644 policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py create mode 100644 policyengine_uk/variables/gov/dwp/housing_benefit_claimant_has_non_dependant.py diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml new file mode 100644 index 0000000000..eae3d1f763 --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml @@ -0,0 +1,450 @@ +# Joint tenants and a non-dependant who lives with them. +# +# Housing Benefit (HB Regs 2006 and HB (SPC) Regs 2006): a non-dependant is +# anyone who "normally resides with a claimant" outside the claimant's family +# and the joint occupiers (reg 3(1), (2)(d)), and "resides with" requires +# sharing accommodation other than a bathroom, lavatory or communal area +# (reg 3(4)). Whose non-dependant someone is in a joint tenancy is a question +# of fact (JP v Bournemouth BC [2018] UKUT 75 (AAC), para 34). DWP: +# - LHA Guidance Manual (April 2014) para 2.110: "Joint tenants who have a +# shared non-dependant have the person counted for the size criteria, but +# only have an apportioned non-dependant deduction" (John, Alex and Peter: +# each tenant gets the two-bedroom rate; also para 2.123 example 4). +# - Para 2.093 example 2: Sarah's sister Susan lives with joint tenants Sarah +# and Rachel and "is treated as Sarah's non-dependant so Sarah is allowed the +# two bedroom LHA rate. Rachel is allowed the shared room rate." +# - HB Guidance Manual A5 para 5.622: "If a person is a non-dependant of only +# one of the joint occupiers, take the whole of the deduction from that +# joint occupier's entitlement." +# Reg 74(5) (SPC reg 55(5)) apportions the deduction for "a non-dependant in +# respect of more than one joint occupier" by the number of joint occupiers +# and their shares of the payments. Council Tax Reduction apportions it +# equally between the liable persons it is a non-dependant of (SI 2012/2885 +# Sch 1 para 8(5) and the Welsh and Scottish equivalents). +# +# The input non_dependant_normally_resides_with, on the non-dependant's +# family, says which joint occupiers they reside with; by default all of them. +# +# Universal Credit is different: a non-dependant already treated as one in +# another UC claim for the same accommodation is not one again (UC Sch 4 para +# 9(2)(f)), so they count in one claim only, which the model gives to the +# household head's family. +# +# Rent: £20,800 a year (£400 a week), split by the people liable (HB reg +# 12B(4)). Maidstone rates (VOA, April 2024, held for 2025-26): B £172.60, C +# £208.27 a week. The individual deductions are inputs, so the tests do not +# depend on the deduction rates. + +- name: Joint tenants with a shared non-dependant each count them (LHA Guidance Manual 2.110) + period: 2026 + absolute_error_margin: 0.01 + input: + people: + john: + age: 30 + is_household_head: true + alex: + age: 30 + peter: + age: 30 + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + john_family: + members: [john] + alex_family: + members: [alex] + liable_for_share_of_household_rent: true + peter_family: + members: [peter] + households: + home: + members: [john, alex, peter] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + non_dependant_normally_resides_with: + [EVERY_JOINT_OCCUPIER, EVERY_JOINT_OCCUPIER, EVERY_JOINT_OCCUPIER] + # HB: Peter is an occupier (reg 13D(12)) and a non-dependant (reg 3) of + # each joint tenant: John and Alex are each entitled to 2 bedrooms, are + # not young individuals without a non-dependant (13D(2)(a)(i)), and get + # the two-bedroom rate (C). + housing_benefit_LHA_allowed_bedrooms: [2, 2, 1] + housing_benefit_claimant_has_non_dependant: [true, true, false] + housing_benefit_LHA_category: [C, C, A] + # Reg 74(5): equal shares of the rent, so half of the deduction each. + housing_benefit_non_dep_deductions: [500, 500, 0] + # CTR Sch 1 para 8(5): equally between the two liable persons. + council_tax_reduction_non_dep_deductions: [150, 150, 0] + # UC: Peter counts in John's claim only (Sch 4 para 9(2)(f)). + LHA_allowed_bedrooms: [2, 1, 1] + lha_renter_has_non_dependant: [true, false, false] + +- name: A joint tenant's sister counts only for that tenant (LHA Guidance Manual 2.093 example 2) + period: 2026 + absolute_error_margin: 0.01 + input: + people: + sarah: + age: 30 + is_household_head: true + is_male: false + rachel: + age: 30 + is_male: false + susan: + age: 28 + is_male: false + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + sarah_family: + members: [sarah] + rachel_family: + members: [rachel] + liable_for_share_of_household_rent: true + susan_family: + members: [susan] + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [sarah, rachel, susan] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Sarah: herself and Susan, 2 bedrooms, the two-bedroom rate. Rachel: + # 1 bedroom, a young individual with no non-dependant (13D(2)(a)(i)), and + # she shares the dwelling's rooms in any case (13D(2)(a)(ii)): the shared + # accommodation rate. + housing_benefit_LHA_allowed_bedrooms: [2, 1, 1] + housing_benefit_claimant_has_non_dependant: [true, false, false] + housing_benefit_LHA_category: [C, A, A] + # Susan is a non-dependant of one joint occupier only, so reg 74(5) does + # not apply and Sarah bears the whole deduction (HBGM A5 para 5.622); so + # too for CTR, which apportions only a non-dependant of two or more + # liable persons. + housing_benefit_non_dep_deductions: [1_000, 0, 0] + council_tax_reduction_non_dep_deductions: [300, 0, 0] + +- name: The sister of a joint tenant who is not the household head counts only for her + period: 2026 + absolute_error_margin: 0.01 + input: + people: + rachel: + age: 31 + is_household_head: true + is_male: false + sarah: + age: 30 + is_male: false + susan: + age: 28 + is_male: false + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + rachel_family: + members: [rachel] + sarah_family: + members: [sarah] + liable_for_share_of_household_rent: true + susan_family: + members: [susan] + non_dependant_normally_resides_with: OTHER_JOINT_OCCUPIERS + households: + home: + members: [rachel, sarah, susan] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + housing_benefit_LHA_allowed_bedrooms: [1, 2, 1] + housing_benefit_claimant_has_non_dependant: [false, true, false] + housing_benefit_LHA_category: [A, C, A] + housing_benefit_non_dep_deductions: [0, 1_000, 0] + council_tax_reduction_non_dep_deductions: [0, 300, 0] + # UC is unchanged: one claim only, the household head's. + LHA_allowed_bedrooms: [2, 1, 1] + +- name: Joint tenants sharing a kitchen and bathroom each get the shared room rate (LHA Guidance Manual 2.093 example 1) + period: 2026 + input: + people: + ali: + age: 40 + is_household_head: true + mustafa: + age: 40 + benunits: + ali_family: + members: [ali] + mustafa_family: + members: [mustafa] + liable_for_share_of_household_rent: true + households: + home: + members: [ali, mustafa] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + housing_benefit_LHA_allowed_bedrooms: [1, 1] + housing_benefit_claimant_has_non_dependant: [false, false] + housing_benefit_LHA_category: [A, A] + +- name: A shared non-dependant is apportioned by the joint occupiers' shares of the rent + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 45 + is_household_head: true + head_partner: + age: 44 + sharer_1: + age: 40 + sharer_2: + age: 41 + friend: + age: 38 + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + head_family: + members: [head, head_partner] + sharer_1_family: + members: [sharer_1] + liable_for_share_of_household_rent: true + sharer_2_family: + members: [sharer_2] + liable_for_share_of_household_rent: true + friend_family: + members: [friend] + households: + home: + members: [head, head_partner, sharer_1, sharer_2, friend] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Four people liable: the couple's share is 2/4, each single sharer's + # 1/4 (reg 12B(4)), and the deduction follows (reg 74(5)). + share_of_household_rent: [0.5, 0.25, 0.25, 0] + housing_benefit_non_dep_deductions: [500, 250, 250, 0] + # CTR: equally between the four liable persons; the applicant couple's + # family bears one person's part, as for the council tax itself (see + # council_tax_reduction_joint_liability_share). + council_tax_reduction_non_dep_deductions: [75, 75, 75, 0] + # The friend counts in each joint occupier's size criteria. + housing_benefit_LHA_allowed_bedrooms: [2, 2, 2, 1] + +- name: A non-dependant of the joint occupiers other than the household head's family + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 45 + is_household_head: true + head_partner: + age: 44 + sharer_1: + age: 40 + sharer_2: + age: 41 + friend: + age: 38 + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + head_family: + members: [head, head_partner] + sharer_1_family: + members: [sharer_1] + liable_for_share_of_household_rent: true + sharer_2_family: + members: [sharer_2] + liable_for_share_of_household_rent: true + friend_family: + members: [friend] + non_dependant_normally_resides_with: OTHER_JOINT_OCCUPIERS + households: + home: + members: [head, head_partner, sharer_1, sharer_2, friend] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # The friend lives with the two sharers only: each bears half the HB + # deduction (equal shares of the rent between them) and half the CTR + # deduction; the household head's couple bears none and does not count + # the friend. + housing_benefit_non_dep_deductions: [0, 500, 500, 0] + council_tax_reduction_non_dep_deductions: [0, 150, 150, 0] + housing_benefit_LHA_allowed_bedrooms: [1, 2, 2, 1] + +- name: Without joint occupiers every value means the household head's family + period: 2026 + absolute_error_margin: 0.01 + input: + people: + renter: + age: 55 + is_household_head: true + daughter: + age: 27 + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + renter_family: + members: [renter] + daughter_family: + members: [daughter] + non_dependant_normally_resides_with: OTHER_JOINT_OCCUPIERS + households: + home: + members: [renter, daughter] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + housing_benefit_LHA_allowed_bedrooms: [2, 1] + housing_benefit_claimant_has_non_dependant: [true, false] + housing_benefit_non_dep_deductions: [1_000, 0] + council_tax_reduction_non_dep_deductions: [300, 0] + +- name: A shared non-dependant couple is one bedroom for each joint tenant + period: 2026 + input: + people: + john: + age: 30 + is_household_head: true + alex: + age: 30 + peter: + age: 30 + paula: + age: 29 + benunits: + john_family: + members: [john] + alex_family: + members: [alex] + liable_for_share_of_household_rent: true + peter_family: + members: [peter, paula] + households: + home: + members: [john, alex, peter, paula] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # HB reg 13D(3)(a): an occupier couple is one category, so one bedroom, + # in each joint tenant's size criteria. + housing_benefit_LHA_allowed_bedrooms: [2, 2, 1] + # UC: each non-dependant not a child has a bedroom (Sch 4 para + # 10(1)(c)), in the household head's claim only. + LHA_allowed_bedrooms: [3, 1, 1] + +- name: A shared non-dependant's child counts for each joint tenant + period: 2026 + input: + people: + john: + age: 30 + is_household_head: true + alex: + age: 30 + peter: + age: 30 + peter_child: + age: 5 + benunits: + john_family: + members: [john] + alex_family: + members: [alex] + liable_for_share_of_household_rent: true + peter_family: + members: [peter, peter_child] + households: + home: + members: [john, alex, peter, peter_child] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Peter and his child occupy each joint tenant's dwelling (reg 13D(12)): + # 1 + Peter + the child (13D(3)(e)) = 3 bedrooms each. + housing_benefit_LHA_allowed_bedrooms: [3, 3, 2] + +- name: A lodger of the household head counts only for the household head + period: 2026 + input: + people: + john: + age: 40 + is_household_head: true + alex: + age: 40 + lodger: + age: 40 + rent_paid_as_lodger: 5_200 + benunits: + john_family: + members: [john] + alex_family: + members: [alex] + liable_for_share_of_household_rent: true + lodger_family: + members: [lodger] + households: + home: + members: [john, alex, lodger] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # A lodger, who pays the household head, is not a non-dependant (reg + # 3(2)(e)) and occupies the head's dwelling only. + housing_benefit_LHA_allowed_bedrooms: [2, 1, 1] + housing_benefit_claimant_has_non_dependant: [false, false, false] + +- name: A shared non-dependant who needs overnight care gives each joint tenant an additional bedroom + period: 2026 + input: + people: + john: + age: 40 + is_household_head: true + alex: + age: 40 + peter: + age: 40 + attendance_allowance: 5_000 + has_non_resident_overnight_carer: true + benunits: + john_family: + members: [john] + alex_family: + members: [alex] + liable_for_share_of_household_rent: true + peter_family: + members: [peter] + households: + home: + members: [john, alex, peter] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # HB reg 13D(3A)(a)(iii): a person who occupies the claimant's dwelling + # and requires overnight care. + housing_benefit_LHA_additional_bedrooms: [1, 1, 1] + housing_benefit_LHA_allowed_bedrooms: [3, 3, 2] diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py new file mode 100644 index 0000000000..60bb0e3f77 --- /dev/null +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -0,0 +1,303 @@ +"""Property-based tests for non-dependants of joint occupiers in Housing +Benefit and Council Tax Reduction (non_dependant_normally_resides_with). + +Invariants, for any generated population of households: + +1. Conservation (HB reg 74(5)): in every household, the families' Housing + Benefit non-dependant deductions sum to the household's individual + deductions for its non-dependants, whichever joint occupiers each one + resides with. +2. Bounds (CTR Sch 1 para 8(5)): each family's Council Tax Reduction part is + between zero and the household's deductions, and the parts sum to at most + the household's deductions (equal shares per liable person, with a couple + bearing one person's part). +3. Differential: with every non-dependant shared (the default), the Housing + Benefit deductions equal the previous formula (each family's share of the + rent times the household's deductions) and the Council Tax Reduction + deductions equal the previous formula (the deductions outside the family + times council_tax_reduction_joint_liability_share). +4. Attribution: a shared non-dependant counts in the household head's + family's size criteria exactly as when they are the head family's only, + and in a sharer's exactly as when they are the other joint occupiers' + only; a family that is not a joint occupier bears no deduction. +5. No-op: in a household with no sharers, the residence input changes + nothing. +6. Universal Credit does not depend on the residence input. +7. Monotonicity: marking a non-dependant as one joint occupier's only never + raises another joint occupier's bedrooms or deductions. +""" + +import numpy as np +from hypothesis import HealthCheck, given, settings +from hypothesis import strategies as st + +from policyengine_uk import Simulation + +YEAR = 2026 +PROPERTY_SETTINGS = settings( + max_examples=8, + deadline=None, + derandomize=True, + suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large], +) +RESIDENCE = [ + "EVERY_JOINT_OCCUPIER", + "HOUSEHOLD_HEAD_FAMILY", + "OTHER_JOINT_OCCUPIERS", +] +income = st.floats(0, 60_000, allow_nan=False, allow_infinity=False) + + +@st.composite +def family(draw, max_adults=2): + return dict( + ages=draw(st.lists(st.integers(18, 70), min_size=1, max_size=max_adults)), + child_age=draw(st.one_of(st.none(), st.integers(0, 15))), + income=draw(income), + ) + + +@st.composite +def households(draw): + return dict( + head=draw(family()), + sharers=draw(st.lists(family(), min_size=0, max_size=2)), + non_dependants=draw( + st.lists( + st.tuples(family(), st.sampled_from(RESIDENCE)), + min_size=0, + max_size=2, + ) + ), + lodger=draw(st.booleans()), + rent=draw(st.floats(2_000, 30_000, allow_nan=False)), + ) + + +population = st.lists(households(), min_size=1, max_size=5) + + +def build(population, residence_override=None): + """One situation for the whole population, with each family's role.""" + people, benunits, homes, roles = {}, {}, {}, [] + for h, house in enumerate(population): + members = [] + + def add_family(name, fam, role, extra): + ids = [] + for i, age in enumerate(fam["ages"]): + pid = f"{name}_adult_{i}" + people[pid] = { + "age": {YEAR: age}, + "is_claimant_or_partner": {YEAR: True}, + "is_household_head": {YEAR: False}, + "employment_income": {YEAR: fam["income"] if i == 0 else 0}, + } + ids.append(pid) + if fam["child_age"] is not None: + pid = f"{name}_child" + people[pid] = { + "age": {YEAR: fam["child_age"]}, + "is_claimant_or_partner": {YEAR: False}, + "is_household_head": {YEAR: False}, + } + ids.append(pid) + benunits[name] = {"members": ids, **extra} + members.extend(ids) + roles.append(role) + return ids + + head_ids = add_family(f"h{h}_head", house["head"], "head", {}) + people[head_ids[0]]["is_household_head"] = {YEAR: True} + for f, sharer in enumerate(house["sharers"]): + add_family( + f"h{h}_s{f}", + sharer, + "sharer", + {"liable_for_share_of_household_rent": {YEAR: True}}, + ) + for f, (non_dep, residence) in enumerate(house["non_dependants"]): + add_family( + f"h{h}_n{f}", + non_dep, + "non_dependant", + { + "non_dependant_normally_resides_with": { + YEAR: residence_override or residence + } + }, + ) + if house["lodger"]: + ids = add_family( + f"h{h}_l", + dict(ages=[40], child_age=None, income=10_000), + "lodger", + {}, + ) + people[ids[0]]["rent_paid_as_lodger"] = {YEAR: 4_000} + homes[f"h{h}"] = { + "members": members, + "rent": {YEAR: house["rent"]}, + "tenure_type": {YEAR: "RENT_PRIVATELY"}, + "brma": {YEAR: "MAIDSTONE"}, + } + situation = {"people": people, "benunits": benunits, "households": homes} + return Simulation(situation=situation), np.array(roles) + + +def calc(sim, variable): + return np.asarray(sim.calculate(variable, YEAR), dtype=float) + + +def benunit_household(sim): + """Household index of each benefit unit.""" + person_benunit = sim.populations["benunit"].members_entity_id + person_household = sim.populations["household"].members_entity_id + out = np.zeros(sim.populations["benunit"].count, dtype=int) + out[person_benunit] = person_household + return out + + +def per_household(sim, benunit_values): + return np.bincount( + benunit_household(sim), + weights=benunit_values, + minlength=sim.populations["household"].count, + ) + + +def person_per_household(sim, person_values): + return np.bincount( + sim.populations["household"].members_entity_id, + weights=person_values, + minlength=sim.populations["household"].count, + ) + + +def has_sharer(sim, roles): + return ( + per_household(sim, (roles == "sharer").astype(float))[benunit_household(sim)] + > 0 + ) + + +@PROPERTY_SETTINGS +@given(population) +def test_housing_benefit_deductions_are_conserved(population): + sim, roles = build(population) + deductions = calc(sim, "household_benefits_individual_non_dep_deduction") * calc( + sim, "is_non_dependant_of_household_head" + ) + families = calc(sim, "housing_benefit_non_dep_deductions") + np.testing.assert_allclose( + per_household(sim, families), person_per_household(sim, deductions), atol=1e-6 + ) + # A family that is not a joint occupier bears none. + assert np.all(families[(roles == "non_dependant") | (roles == "lodger")] == 0) + + +@PROPERTY_SETTINGS +@given(population) +def test_council_tax_reduction_deductions_are_bounded(population): + sim, roles = build(population) + deductions = calc(sim, "council_tax_reduction_individual_non_dep_deduction") + in_household = person_per_household(sim, deductions) + families = calc(sim, "council_tax_reduction_non_dep_deductions") + assert np.all(families >= -1e-9) + assert np.all(families <= in_household[benunit_household(sim)] + 1e-6) + assert np.all(per_household(sim, families) <= in_household + 1e-6) + assert np.all(families[(roles == "non_dependant") | (roles == "lodger")] == 0) + + +@PROPERTY_SETTINGS +@given(population) +def test_shared_default_matches_the_previous_formulas(population): + sim, roles = build(population, residence_override="EVERY_JOINT_OCCUPIER") + household = benunit_household(sim) + hb_individual = calc(sim, "household_benefits_individual_non_dep_deduction") * calc( + sim, "is_non_dependant_of_household_head" + ) + share = calc(sim, "share_of_household_rent") + np.testing.assert_allclose( + calc(sim, "housing_benefit_non_dep_deductions"), + share * person_per_household(sim, hb_individual)[household], + atol=1e-6, + ) + ctr_individual = calc(sim, "council_tax_reduction_individual_non_dep_deduction") + own = np.bincount( + sim.populations["benunit"].members_entity_id, + weights=ctr_individual, + minlength=sim.populations["benunit"].count, + ) + previous = (person_per_household(sim, ctr_individual)[household] - own) * calc( + sim, "council_tax_reduction_joint_liability_share" + ) + joint_occupier = (roles == "head") | (roles == "sharer") + np.testing.assert_allclose( + calc(sim, "council_tax_reduction_non_dep_deductions")[joint_occupier], + previous[joint_occupier], + atol=1e-6, + ) + + +@PROPERTY_SETTINGS +@given(population) +def test_shared_counts_as_head_only_for_the_head_and_as_others_only_for_sharers( + population, +): + shared, roles = build(population, residence_override="EVERY_JOINT_OCCUPIER") + head_only, _ = build(population, residence_override="HOUSEHOLD_HEAD_FAMILY") + others_only, _ = build(population, residence_override="OTHER_JOINT_OCCUPIERS") + rooms = "housing_benefit_LHA_allowed_bedrooms" + head = roles == "head" + sharer = roles == "sharer" + np.testing.assert_array_equal( + calc(shared, rooms)[head], calc(head_only, rooms)[head] + ) + np.testing.assert_array_equal( + calc(shared, rooms)[sharer], calc(others_only, rooms)[sharer] + ) + # Monotonicity: one joint occupier's non-dependant never raises another's + # bedrooms or deductions. + deductions = "housing_benefit_non_dep_deductions" + assert np.all(calc(head_only, rooms)[sharer] <= calc(shared, rooms)[sharer]) + assert np.all( + calc(head_only, deductions)[sharer] <= calc(shared, deductions)[sharer] + 1e-6 + ) + with_sharer = has_sharer(shared, roles) + assert np.all( + calc(others_only, rooms)[head & with_sharer] + <= calc(shared, rooms)[head & with_sharer] + ) + assert np.all( + calc(others_only, deductions)[head & with_sharer] + <= calc(shared, deductions)[head & with_sharer] + 1e-6 + ) + + +@PROPERTY_SETTINGS +@given(population) +def test_residence_is_a_no_op_without_sharers_and_for_universal_credit(population): + sims = [build(population, residence_override=r) for r in RESIDENCE] + roles = sims[0][1] + without_sharer = ~has_sharer(sims[0][0], roles) + for variable in [ + "housing_benefit_LHA_allowed_bedrooms", + "housing_benefit_LHA_additional_bedrooms", + "housing_benefit_non_dep_deductions", + "council_tax_reduction_non_dep_deductions", + "housing_benefit_claimant_has_non_dependant", + ]: + reference = calc(sims[0][0], variable)[without_sharer] + for sim, _ in sims[1:]: + np.testing.assert_allclose( + calc(sim, variable)[without_sharer], reference, atol=1e-6 + ) + for variable in [ + "LHA_allowed_bedrooms", + "uc_non_dep_deductions", + "lha_renter_has_non_dependant", + ]: + reference = calc(sims[0][0], variable) + for sim, _ in sims[1:]: + np.testing.assert_allclose(calc(sim, variable), reference, atol=1e-6) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py b/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py index e5e9e3a933..de9212436f 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + apportioned_non_dependant_deductions, +) class housing_benefit_non_dep_deductions(Variable): @@ -11,6 +14,7 @@ class housing_benefit_non_dep_deductions(Variable): "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", "https://www.legislation.gov.uk/uksi/2006/213/regulation/74", "https://www.legislation.gov.uk/uksi/2006/214/regulation/55", + "https://assets.publishing.service.gov.uk/media/5a7ce2b840f0b6629523c64c/hbgm-a5-calculating-benefit.pdf", ) def formula(benunit, period, parameters): @@ -19,12 +23,15 @@ def formula(benunit, period, parameters): # boarders, lodgers and the landlord's household are not # non-dependants (reg 3(2)(d)-(e), 3(4)). A non-dependant of more # than one joint occupier is apportioned between them by their shares - # of the payments (reg 74(5); SPC reg 55(5)), so each family liable - # for the household's rent bears its share; a boarder or lodger bears - # none. + # of the payments (reg 74(5); SPC reg 55(5)); one who resides with + # only one joint occupier is deducted in full from that occupier's + # award (HB Guidance Manual A5 para 5.622). Which joint occupiers a + # non-dependant resides with is non_dependant_normally_resides_with; + # a boarder or lodger bears none. person = benunit.members deductions = person( "household_benefits_individual_non_dep_deduction", period ) * person("is_non_dependant_of_household_head", period) - share = benunit("share_of_household_rent", period) - return share * benunit.max(person.household.sum(deductions)) + return apportioned_non_dependant_deductions( + benunit, period, deductions, equally=False + ) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_additional_bedrooms.py b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_additional_bedrooms.py index 5c9d55d1ee..ebd9bca24b 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_additional_bedrooms.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_additional_bedrooms.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.housing_benefit_LHA_allowed_bedrooms import ( + housing_benefit_other_occupiers, +) class housing_benefit_LHA_additional_bedrooms(Variable): @@ -11,10 +14,12 @@ class housing_benefit_LHA_additional_bedrooms(Variable): "meets_lha_overnight_care_condition), and one if the claimant or " "partner is a qualifying parent or carer (see " "is_housing_benefit_qualifying_parent_or_carer): two if both. " - "Occupiers outside the family count for the household head's family: " - "non-dependants, boarders and lodgers and their children, but not a " - "sharer of the rent or a child placed with them as a foster child or " - "for adoption. The definitions require a bedroom in the dwelling for " + "Occupiers outside the family count as in " + "housing_benefit_LHA_allowed_bedrooms: boarders and lodgers and their " + "children for the household head's family, and non-dependants and " + "their children for each joint occupier they normally reside with, " + "but not a sharer of the rent or a child placed with them as a foster " + "child or for adoption. The definitions require a bedroom in the dwelling for " "the carer or the foster child; the model does not observe the " "dwelling's bedrooms and assumes there is one. Children and couples " "who cannot share a bedroom because of disability are not modelled." @@ -37,8 +42,7 @@ def formula(benunit, period, parameters): sharer = person.benunit("liable_for_share_of_household_rent", period) placed = person("is_child_or_young_person_placed_with_family", period) other = overnight_care & ~head_family & ~sharer & ~placed - is_head_family = benunit.any(person("is_household_head", period)) - others = is_head_family * benunit.max(person.household.sum(other)) + others = housing_benefit_other_occupiers(benunit, period, other) # Reg 13D(3A)(a)(i)-(iv): the claimant, partner, other members of the # family, and a child or young person for whom the claimant or # partner is a qualifying parent or carer. diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_category.py b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_category.py index 305cf304bf..16d12d7032 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_category.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_category.py @@ -8,7 +8,8 @@ class housing_benefit_LHA_category(Variable): label = "LHA category of dwelling (Housing Benefit)" documentation = ( "The Housing Benefit category of dwelling. The shared accommodation " - "rate applies to a young individual with no non-dependant, and to a " + "rate applies to a young individual with no non-dependant residing " + "with them (see housing_benefit_claimant_has_non_dependant), and to a " "claimant entitled to one bedroom who lacks exclusive use of " "self-contained accommodation, unless the severe disability premium " "applies. Otherwise the category follows the number of bedrooms in " @@ -30,7 +31,7 @@ def formula(benunit, period, parameters): # HB Regs 2006 reg 13D(2)(a)(i). young_individual = ( benunit("is_housing_benefit_young_individual", period) - & ~benunit("lha_renter_has_non_dependant", period) + & ~benunit("housing_benefit_claimant_has_non_dependant", period) & ~severe_disability ) # Reg 13D(2)(a)(ii): entitled to one bedroom but neither condition in diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit_claimant_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/housing_benefit_claimant_has_non_dependant.py new file mode 100644 index 0000000000..b5ab95cddf --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/housing_benefit_claimant_has_non_dependant.py @@ -0,0 +1,47 @@ +from policyengine_uk.model_api import * +from policyengine_uk.variables.gov.dwp.lha_renter_has_non_dependant import ( + has_non_dependant_in_benefit_unit, +) +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + non_dependants_residing_with, +) + + +class housing_benefit_claimant_has_non_dependant(Variable): + value_type = bool + entity = BenUnit + label = "Housing Benefit claimant has a non-dependant residing with them" + documentation = ( + "Whether a non-dependant resides with the claimant, for the young " + "individual's shared accommodation rate: someone in the benefit unit " + "who is neither a claimant or partner nor a child or young person, or " + "a non-dependant of another family (see " + "is_non_dependant_of_household_head) who normally resides with this " + "family. In a household whose rent is shared, a non-dependant resides " + "with each joint occupier given by non_dependant_normally_resides_with " + "(by default all of them); otherwise with the household head's " + "family. Joint tenants and other sharers of the rent, boarders and " + "lodgers are not non-dependants." + ) + definition_period = YEAR + reference = ( + "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", + "https://www.legislation.gov.uk/uksi/2006/213/regulation/13D", + "https://www.legislation.gov.uk/uksi/2006/213/regulation/21", + "https://assets.publishing.service.gov.uk/media/5a758238ed915d6faf2b38a2/lha-guidance-manual.pdf#page=33", + ) + + def formula(benunit, period, parameters): + person = benunit.members + within_benefit_unit = has_non_dependant_in_benefit_unit(benunit, period) + # HB Regs 2006 reg 3(1), (2)(d)-(e) and (4): a non-dependant of + # several joint occupiers resides with each of them (LHA Guidance + # Manual paras 2.050 and 2.110); one who lives with one joint tenant + # only resides with that tenant alone (para 2.093, example 2). + non_dependant_claimants = person("is_claimant_or_partner", period) & person( + "is_non_dependant_of_household_head", period + ) + other_families = non_dependants_residing_with( + benunit, period, non_dependant_claimants + ) + return within_benefit_unit | (other_families > 0) diff --git a/policyengine_uk/variables/gov/dwp/is_non_dependant_of_household_head.py b/policyengine_uk/variables/gov/dwp/is_non_dependant_of_household_head.py index 5042743e15..5a841b9768 100644 --- a/policyengine_uk/variables/gov/dwp/is_non_dependant_of_household_head.py +++ b/policyengine_uk/variables/gov/dwp/is_non_dependant_of_household_head.py @@ -13,9 +13,11 @@ class is_non_dependant_of_household_head(Variable): "of anyone. The household head and their household are not " "non-dependants of a boarder or lodger who pays them. Universal " "Credit counts a non-dependant in one claim only, which the model " - "gives to the household head's family; Housing Benefit and Council " - "Tax Reduction apportion a non-dependant of several joint occupiers " - "between them. A non-dependant's own children are non-dependants " + "gives to the household head's family. For Housing Benefit and " + "Council Tax Reduction a non-dependant is the non-dependant of each " + "joint occupier they normally reside with (see " + "non_dependant_normally_resides_with): they count in each one's size " + "criteria and their deduction is apportioned between them. A non-dependant's own children are non-dependants " "too; a child looked after by a local authority is not (see " "LHA_allowed_bedrooms). Carers engaged through a charity are not " "identified." diff --git a/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py index 5d0f6f3ce0..091e20739d 100644 --- a/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py +++ b/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py @@ -1,45 +1,54 @@ from policyengine_uk.model_api import * +def has_non_dependant_in_benefit_unit(benunit, period): + """Whether someone in the benefit unit is neither a claimant or partner + nor a child or young person, nor a child or young person placed with the + family as a foster child or for adoption.""" + person = benunit.members + claimant_or_partner = person("is_claimant_or_partner", period) + # A child or young person under either scheme (UC reg 5; HB reg 19) + # is a dependant, not a non-dependant. + age = person("age", period) + # A foster child or a child placed for adoption is not a non-dependant + # either (UC Sch 4 para 9(2)(c) and (g); HB reg 3(2)(c) and reg 21(3)). + child_or_qyp = ( + person("is_child_or_qualifying_young_person_for_universal_credit", period) + | person("is_child_or_young_person_for_legacy_benefits", period) + | person("is_child_or_young_person_placed_with_family", period) + | ((age >= 16) & (age < 17)) + ) + return benunit.any(~claimant_or_partner & ~child_or_qyp) + + class lha_renter_has_non_dependant(Variable): value_type = bool entity = BenUnit - label = "LHA renter has a non-dependant" + label = "LHA renter has a non-dependant (Universal Credit)" documentation = ( - "Someone in this benefit unit who is neither a claimant or partner " - "nor a child or young person, or, for the household head's family, a " - "claimant or partner of another family who is a non-dependant of the " - "household head (see is_non_dependant_of_household_head): joint " - "tenants and other sharers of the rent, boarders and lodgers are not " - "non-dependants, and a sharer, boarder or lodger has none from the " - "household head's family. A child or young person placed with the " - "family as a foster child or for adoption is not a non-dependant." + "Universal Credit: someone in this benefit unit who is neither a " + "claimant or partner nor a child or young person, or, for the " + "household head's family, a claimant or partner of another family " + "who is a non-dependant of the household head (see " + "is_non_dependant_of_household_head): joint tenants and other " + "sharers of the rent, boarders and lodgers are not non-dependants, " + "and a non-dependant counts in one Universal Credit claim only, which " + "the model gives to the household head's family. A child or young " + "person placed with the family as a foster child or for adoption is " + "not a non-dependant. Housing Benefit has its own test: see " + "housing_benefit_claimant_has_non_dependant." ) definition_period = YEAR reference = ( "https://www.legislation.gov.uk/uksi/2013/376/schedule/4/paragraph/9", - "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", - "https://www.legislation.gov.uk/uksi/2006/213/regulation/21", + "https://www.legislation.gov.uk/uksi/2013/376/schedule/4/paragraph/28", ) def formula(benunit, period, parameters): person = benunit.members - claimant_or_partner = person("is_claimant_or_partner", period) - # A child or young person under either scheme (UC reg 5; HB reg 19) - # is a dependant, not a non-dependant. - age = person("age", period) - # A foster child or a child placed for adoption is not a - # non-dependant either (UC Sch 4 para 9(2)(c) and (g); HB reg 3(2)(c) - # and reg 21(3)). - child_or_qyp = ( - person("is_child_or_qualifying_young_person_for_universal_credit", period) - | person("is_child_or_young_person_for_legacy_benefits", period) - | person("is_child_or_young_person_placed_with_family", period) - | ((age >= 16) & (age < 17)) - ) - within_benefit_unit = benunit.any(~claimant_or_partner & ~child_or_qyp) - # UC Regs 2013 Sch 4 para 9(2)(d)-(f); HB Regs 2006 reg 3(2)(d)-(e). - non_dependant_claimants = claimant_or_partner & person( + within_benefit_unit = has_non_dependant_in_benefit_unit(benunit, period) + # UC Regs 2013 Sch 4 para 9(2)(d)-(f). + non_dependant_claimants = person("is_claimant_or_partner", period) & person( "is_non_dependant_of_household_head", period ) head_family = benunit.any(person("is_household_head", period)) diff --git a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py index 966d230ff7..7efae3e8e3 100644 --- a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py +++ b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + apportioned_non_dependant_deductions, +) from policyengine_uk.variables.household.demographic.highest_education import ( EducationType, ) @@ -85,13 +88,15 @@ def local_non_dep_deductions( ) is_benunit_head = benunit.members("is_benunit_head", period) deductions_to_count = is_benunit_head * benunit.project(deduction_for_benunit) - deductions_in_household = benunit.max( - benunit.members.household.sum(deductions_to_count) - ) # A non-dependant of two or more jointly liable people is apportioned - # equally between them (SI 2012/2885 Sch 1 para 8(5)). - share = benunit("council_tax_reduction_joint_liability_share", period) - return (deductions_in_household - deduction_for_benunit) * share + # equally between them (SI 2012/2885 Sch 1 para 8(5)); one who resides + # with only one of them is deducted in full from that one. Deductions + # are only for families outside every family liable for the household's + # rent (council_tax_reduction_individual_non_dep_deduction_eligible), so + # a claimant is never charged its own. + return apportioned_non_dependant_deductions( + benunit, period, deductions_to_count, equally=True + ) def normal_gross_income_non_dep_deduction( diff --git a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py index 6241abf4c7..739283f64e 100644 --- a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py +++ b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + apportioned_non_dependant_deductions, +) class council_tax_reduction_non_dep_deductions(Variable): @@ -7,14 +10,25 @@ class council_tax_reduction_non_dep_deductions(Variable): label = "CTR non-dependent deductions" definition_period = YEAR unit = GBP + reference = ( + "https://www.legislation.gov.uk/uksi/2012/2885/regulation/9", + "https://www.legislation.gov.uk/uksi/2012/2885/schedule/1/paragraph/8", + "https://www.legislation.gov.uk/wsi/2013/3029/schedule/1/paragraph/3", + "https://www.legislation.gov.uk/wsi/2013/3029/schedule/6/paragraph/5", + "https://www.legislation.gov.uk/ssi/2021/249/regulation/90", + "https://www.legislation.gov.uk/ssi/2012/319/regulation/48", + ) def formula(benunit, period, parameters): deductions = benunit.members( "council_tax_reduction_individual_non_dep_deduction", period ) - deductions_in_household = benunit.max(benunit.members.household.sum(deductions)) - deductions_in_benunit = benunit.sum(deductions) # A non-dependant of two or more jointly liable people is apportioned - # equally between them (SI 2012/2885 Sch 1 para 8(5)). - share = benunit("council_tax_reduction_joint_liability_share", period) - return (deductions_in_household - deductions_in_benunit) * share + # equally between them (SI 2012/2885 Sch 1 para 8(5); WSI 2013/3029 + # Sch 1 para 3(5) and Sch 6 para 5(5); SSI 2021/249 reg 90(5); SSI + # 2012/319 reg 48(5)); one who resides with only one of them is + # deducted in full from that one (see + # non_dependant_normally_resides_with). + return apportioned_non_dependant_deductions( + benunit, period, deductions, equally=True + ) From 921dca4d949d5cf77113e1937ea1d35da82c892b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 2 Oct 2026 01:26:58 -0400 Subject: [PATCH 03/22] Changelog for #2029 Co-Authored-By: Claude Opus 5.5 --- changelog.d/2029.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/2029.fixed.md diff --git a/changelog.d/2029.fixed.md b/changelog.d/2029.fixed.md new file mode 100644 index 0000000000..cd33b9672f --- /dev/null +++ b/changelog.d/2029.fixed.md @@ -0,0 +1 @@ +- Count a non-dependant who normally resides with several joint tenants in each one's Housing Benefit size criteria and shared accommodation test, apportioning the HB and Council Tax Reduction deductions only between the joint tenants they reside with (new input `non_dependant_normally_resides_with`). From 691d168e388dbb850ab67e6b43d4ba6d0599dc57 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 2 Oct 2026 02:09:13 -0400 Subject: [PATCH 04/22] Keep the previous CTR non-dependant split where the rent is not shared Without sharers the CTR claimant is the family of the household's oldest adult (council_tax_reduction_claimant_benunit), which need not be the is_household_head family that the joint-occupier split targets; the first real enhanced FRS run moved CTR in fewer than 10 survey households. The joint-occupier apportionment (SI 2012/2885 Sch 1 para 8(5)) now applies only where the rent is shared; otherwise the claimant keeps every other family's deductions as before. Adds a Hypothesis differential for the no-sharer case and tightens the CTR bounds to shared households. Co-Authored-By: Claude Opus 5.5 --- ..._tenant_shared_non_dependant_properties.py | 41 ++++++++++++++++--- .../council_tax_reduction/_legacy.py | 41 +++++++++++++++---- ...ouncil_tax_reduction_non_dep_deductions.py | 14 ++----- 3 files changed, 72 insertions(+), 24 deletions(-) diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index 60bb0e3f77..fcbf4b328d 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -8,9 +8,11 @@ deductions for its non-dependants, whichever joint occupiers each one resides with. 2. Bounds (CTR Sch 1 para 8(5)): each family's Council Tax Reduction part is - between zero and the household's deductions, and the parts sum to at most - the household's deductions (equal shares per liable person, with a couple - bearing one person's part). + between zero and the household's deductions; where the rent is shared, + the joint occupiers' parts sum to at most the household's deductions + (equal shares per liable person, with a couple bearing one person's part) + and no other family bears any. Where it is not shared, every family's + deductions equal the previous formula (differential). 3. Differential: with every non-dependant shared (the default), the Housing Benefit deductions equal the previous formula (each family's share of the rent times the household's deductions) and the Council Tax Reduction @@ -51,7 +53,7 @@ @st.composite def family(draw, max_adults=2): return dict( - ages=draw(st.lists(st.integers(18, 70), min_size=1, max_size=max_adults)), + ages=draw(st.lists(st.integers(18, 90), min_size=1, max_size=max_adults)), child_age=draw(st.one_of(st.none(), st.integers(0, 15))), income=draw(income), ) @@ -205,8 +207,35 @@ def test_council_tax_reduction_deductions_are_bounded(population): families = calc(sim, "council_tax_reduction_non_dep_deductions") assert np.all(families >= -1e-9) assert np.all(families <= in_household[benunit_household(sim)] + 1e-6) - assert np.all(per_household(sim, families) <= in_household + 1e-6) - assert np.all(families[(roles == "non_dependant") | (roles == "lodger")] == 0) + # Where the rent is shared, the joint occupiers' parts never exceed the + # household's deductions, and no one else bears any. + shared = has_sharer(sim, roles) + joint_occupier = (roles == "head") | (roles == "sharer") + joint_parts = per_household(sim, families * (shared & joint_occupier)) + assert np.all(joint_parts <= in_household + 1e-6) + assert np.all(families[shared & ~joint_occupier] == 0) + + +@PROPERTY_SETTINGS +@given(population) +def test_council_tax_reduction_is_unchanged_without_sharers(population): + """Differential: where no family shares the rent, every family's CTR + non-dependant deductions equal the previous formula (the deductions of + every other family), whoever the oldest adult's claiming family is.""" + sim, roles = build(population) + deductions = calc(sim, "council_tax_reduction_individual_non_dep_deduction") + own = np.bincount( + sim.populations["benunit"].members_entity_id, + weights=deductions, + minlength=sim.populations["benunit"].count, + ) + previous = person_per_household(sim, deductions)[benunit_household(sim)] - own + without_sharer = ~has_sharer(sim, roles) + np.testing.assert_allclose( + calc(sim, "council_tax_reduction_non_dep_deductions")[without_sharer], + previous[without_sharer], + atol=1e-6, + ) @PROPERTY_SETTINGS diff --git a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py index 7efae3e8e3..80454efa6c 100644 --- a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py +++ b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py @@ -13,6 +13,37 @@ def is_full_time_student_non_dep(person, period): ) +def council_tax_reduction_joint_liability_non_dep_deductions( + benunit, period, deductions, own +): + """Each family's deductions for the household's non-dependants + (``deductions``, one amount per person; ``own``, the family's own amount). + + Where the household's rent is shared, a non-dependant of two or more + jointly liable people is apportioned equally between them (SI 2012/2885 + Sch 1 para 8(5); WSI 2013/3029 Sch 1 para 3(5) and Sch 6 para 5(5); SSI + 2021/249 reg 90(5); SSI 2012/319 reg 48(5)), and one who resides with + only one of them is deducted in full from that one (see + non_dependant_normally_resides_with). Otherwise the claimant, the family + of the household's oldest adult (see + council_tax_reduction_claimant_benunit), has every other family's + deductions, as before. + """ + person = benunit.members + rent_is_shared = benunit.any( + person.household.any( + person.benunit("liable_for_share_of_household_rent", period) + ) + ) + in_household = benunit.max(person.household.sum(deductions)) + share = benunit("council_tax_reduction_joint_liability_share", period) + sole = (in_household - own) * share + joint = apportioned_non_dependant_deductions( + benunit, period, deductions, equally=True + ) + return where(rent_is_shared, joint, sole) + + def legacy_council_tax_reduction( benunit, period, @@ -88,14 +119,8 @@ def local_non_dep_deductions( ) is_benunit_head = benunit.members("is_benunit_head", period) deductions_to_count = is_benunit_head * benunit.project(deduction_for_benunit) - # A non-dependant of two or more jointly liable people is apportioned - # equally between them (SI 2012/2885 Sch 1 para 8(5)); one who resides - # with only one of them is deducted in full from that one. Deductions - # are only for families outside every family liable for the household's - # rent (council_tax_reduction_individual_non_dep_deduction_eligible), so - # a claimant is never charged its own. - return apportioned_non_dependant_deductions( - benunit, period, deductions_to_count, equally=True + return council_tax_reduction_joint_liability_non_dep_deductions( + benunit, period, deductions_to_count, deduction_for_benunit ) diff --git a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py index 739283f64e..4ea0d2b3e8 100644 --- a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py +++ b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/council_tax_reduction_non_dep_deductions.py @@ -1,6 +1,6 @@ from policyengine_uk.model_api import * -from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( - apportioned_non_dependant_deductions, +from policyengine_uk.variables.gov.local_authorities.council_tax_reduction._legacy import ( + council_tax_reduction_joint_liability_non_dep_deductions, ) @@ -23,12 +23,6 @@ def formula(benunit, period, parameters): deductions = benunit.members( "council_tax_reduction_individual_non_dep_deduction", period ) - # A non-dependant of two or more jointly liable people is apportioned - # equally between them (SI 2012/2885 Sch 1 para 8(5); WSI 2013/3029 - # Sch 1 para 3(5) and Sch 6 para 5(5); SSI 2021/249 reg 90(5); SSI - # 2012/319 reg 48(5)); one who resides with only one of them is - # deducted in full from that one (see - # non_dependant_normally_resides_with). - return apportioned_non_dependant_deductions( - benunit, period, deductions, equally=True + return council_tax_reduction_joint_liability_non_dep_deductions( + benunit, period, deductions, benunit.sum(deductions) ) From 69df794998d229ff2b81aa751756fca36781075d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 2 Oct 2026 02:24:36 -0400 Subject: [PATCH 05/22] Compare money to the penny in the joint-tenant properties The model's amounts are float32, so household sums taken in different orders differ by up to about 1e-3; a 1e-6 bound failed on rounding alone. Co-Authored-By: Claude Opus 5.5 --- ..._tenant_shared_non_dependant_properties.py | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index fcbf4b328d..b620fc6ed4 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -48,6 +48,9 @@ "OTHER_JOINT_OCCUPIERS", ] income = st.floats(0, 60_000, allow_nan=False, allow_infinity=False) +# Amounts are float32 in the model, so sums taken in different orders differ +# by up to about 1e-3 at these magnitudes: compare money to the penny. +MONEY_TOLERANCE = 0.01 @st.composite @@ -192,7 +195,9 @@ def test_housing_benefit_deductions_are_conserved(population): ) families = calc(sim, "housing_benefit_non_dep_deductions") np.testing.assert_allclose( - per_household(sim, families), person_per_household(sim, deductions), atol=1e-6 + per_household(sim, families), + person_per_household(sim, deductions), + atol=MONEY_TOLERANCE, ) # A family that is not a joint occupier bears none. assert np.all(families[(roles == "non_dependant") | (roles == "lodger")] == 0) @@ -205,14 +210,14 @@ def test_council_tax_reduction_deductions_are_bounded(population): deductions = calc(sim, "council_tax_reduction_individual_non_dep_deduction") in_household = person_per_household(sim, deductions) families = calc(sim, "council_tax_reduction_non_dep_deductions") - assert np.all(families >= -1e-9) - assert np.all(families <= in_household[benunit_household(sim)] + 1e-6) + assert np.all(families >= -MONEY_TOLERANCE) + assert np.all(families <= in_household[benunit_household(sim)] + MONEY_TOLERANCE) # Where the rent is shared, the joint occupiers' parts never exceed the # household's deductions, and no one else bears any. shared = has_sharer(sim, roles) joint_occupier = (roles == "head") | (roles == "sharer") joint_parts = per_household(sim, families * (shared & joint_occupier)) - assert np.all(joint_parts <= in_household + 1e-6) + assert np.all(joint_parts <= in_household + MONEY_TOLERANCE) assert np.all(families[shared & ~joint_occupier] == 0) @@ -234,7 +239,7 @@ def test_council_tax_reduction_is_unchanged_without_sharers(population): np.testing.assert_allclose( calc(sim, "council_tax_reduction_non_dep_deductions")[without_sharer], previous[without_sharer], - atol=1e-6, + atol=MONEY_TOLERANCE, ) @@ -250,7 +255,7 @@ def test_shared_default_matches_the_previous_formulas(population): np.testing.assert_allclose( calc(sim, "housing_benefit_non_dep_deductions"), share * person_per_household(sim, hb_individual)[household], - atol=1e-6, + atol=MONEY_TOLERANCE, ) ctr_individual = calc(sim, "council_tax_reduction_individual_non_dep_deduction") own = np.bincount( @@ -265,7 +270,7 @@ def test_shared_default_matches_the_previous_formulas(population): np.testing.assert_allclose( calc(sim, "council_tax_reduction_non_dep_deductions")[joint_occupier], previous[joint_occupier], - atol=1e-6, + atol=MONEY_TOLERANCE, ) @@ -291,7 +296,8 @@ def test_shared_counts_as_head_only_for_the_head_and_as_others_only_for_sharers( deductions = "housing_benefit_non_dep_deductions" assert np.all(calc(head_only, rooms)[sharer] <= calc(shared, rooms)[sharer]) assert np.all( - calc(head_only, deductions)[sharer] <= calc(shared, deductions)[sharer] + 1e-6 + calc(head_only, deductions)[sharer] + <= calc(shared, deductions)[sharer] + MONEY_TOLERANCE ) with_sharer = has_sharer(shared, roles) assert np.all( @@ -300,7 +306,7 @@ def test_shared_counts_as_head_only_for_the_head_and_as_others_only_for_sharers( ) assert np.all( calc(others_only, deductions)[head & with_sharer] - <= calc(shared, deductions)[head & with_sharer] + 1e-6 + <= calc(shared, deductions)[head & with_sharer] + MONEY_TOLERANCE ) @@ -320,7 +326,7 @@ def test_residence_is_a_no_op_without_sharers_and_for_universal_credit(populatio reference = calc(sims[0][0], variable)[without_sharer] for sim, _ in sims[1:]: np.testing.assert_allclose( - calc(sim, variable)[without_sharer], reference, atol=1e-6 + calc(sim, variable)[without_sharer], reference, atol=MONEY_TOLERANCE ) for variable in [ "LHA_allowed_bedrooms", @@ -329,4 +335,6 @@ def test_residence_is_a_no_op_without_sharers_and_for_universal_credit(populatio ]: reference = calc(sims[0][0], variable) for sim, _ in sims[1:]: - np.testing.assert_allclose(calc(sim, variable), reference, atol=1e-6) + np.testing.assert_allclose( + calc(sim, variable), reference, atol=MONEY_TOLERANCE + ) From 68647f9b6bb885b39e3e964dc05e25cbb108266b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Fri, 2 Oct 2026 07:14:37 -0400 Subject: [PATCH 06/22] Address review r1: supplied rent shares, joint occupiers never non-dependants - A non-dependant of every joint occupier is split exactly as before by share_of_household_rent (HB) and council_tax_reduction_joint_liability_share (CTR), honouring supplied values; one of some joint occupiers is split by their supplied HB shares over the subset's total (reg 74(5)). - Members of the head's and sharers' families are never anyone's non-dependant through the other-family path, whatever their rent (HB reg 3(2)(a), (d); CTR reg 9(2)(a), (d)). - Documentation of the HB size criteria for sharers. - YAML regressions: supplied shares, subset shares, a zero-rent sharer, CTR without sharers (national and Merton), the CTR couple convention. - Properties cover zero rent and supplied shares; the generator supplies formula shares to every household when any household supplies them. Co-Authored-By: Claude Opus 5.5 --- ...HA_joint_tenants_shared_non_dependant.yaml | 181 ++++++++++++++++++ ..._tenant_shared_non_dependant_properties.py | 86 +++++++-- .../housing_benefit_non_dep_deductions.py | 6 +- .../housing_benefit_LHA_allowed_bedrooms.py | 8 +- .../council_tax_reduction/_legacy.py | 2 +- .../non_dependant_normally_resides_with.py | 72 +++++-- 6 files changed, 319 insertions(+), 36 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml index eae3d1f763..c5c92795d4 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml @@ -448,3 +448,184 @@ # and requires overnight care. housing_benefit_LHA_additional_bedrooms: [1, 1, 1] housing_benefit_LHA_allowed_bedrooms: [3, 3, 2] + +- name: Supplied rent shares set each joint tenant's part of a shared non-dependant's deduction + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + sharer: + age: 40 + friend: + age: 40 + household_benefits_individual_non_dep_deduction: 1_000 + benunits: + head_family: + members: [head] + share_of_household_rent: 0.75 + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + share_of_household_rent: 0.25 + friend_family: + members: [friend] + share_of_household_rent: 0 + households: + home: + members: [head, sharer, friend] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Reg 74(5): "having regard to ... the proportion of the payments in + # respect of the dwelling payable by each of them". + housing_benefit_non_dep_deductions: [750, 250, 0] + +- name: A non-dependant of some joint tenants is split by their supplied rent shares + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + sharer_1: + age: 40 + sharer_2: + age: 41 + friend: + age: 38 + household_benefits_individual_non_dep_deduction: 1_000 + benunits: + head_family: + members: [head] + share_of_household_rent: 0.5 + sharer_1_family: + members: [sharer_1] + liable_for_share_of_household_rent: true + share_of_household_rent: 0.3 + sharer_2_family: + members: [sharer_2] + liable_for_share_of_household_rent: true + share_of_household_rent: 0.2 + friend_family: + members: [friend] + share_of_household_rent: 0 + non_dependant_normally_resides_with: OTHER_JOINT_OCCUPIERS + households: + home: + members: [head, sharer_1, sharer_2, friend] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # 0.3 / (0.3 + 0.2) and 0.2 / (0.3 + 0.2) of the deduction. + housing_benefit_non_dep_deductions: [0, 600, 400, 0] + +- name: A sharer with no rent is never its own or the head's non-dependant + period: 2026 + input: + people: + head: + age: 30 + is_household_head: true + sharer: + age: 30 + benunits: + head_family: + members: [head] + housing_benefit_shares_accommodation: false + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + housing_benefit_shares_accommodation: false + households: + home: + members: [head, sharer] + rent: 0 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # HB reg 3(2)(a), (d): neither joint occupier is a non-dependant of + # either, whatever the rent; so each 30-year-old is a young individual + # with no non-dependant (13D(2)(a)(i)). + housing_benefit_claimant_has_non_dependant: [false, false] + housing_benefit_LHA_allowed_bedrooms: [1, 1] + housing_benefit_LHA_category: [A, A] + +- name: Without sharers the CTR deductions keep the previous formula, national and local + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + council_tax_reduction_individual_non_dep_deduction: 0 + merton_council_tax_reduction_individual_non_dep_deduction: 0 + adult_1: + age: 40 + council_tax_reduction_individual_non_dep_deduction: 300 + merton_council_tax_reduction_individual_non_dep_deduction: 300 + adult_2: + age: 40 + council_tax_reduction_individual_non_dep_deduction: 200 + merton_council_tax_reduction_individual_non_dep_deduction: 200 + benunits: + head_family: + members: [head] + family_1: + members: [adult_1] + family_2: + members: [adult_2] + households: + home: + members: [head, adult_1, adult_2] + rent: 20_800 + tenure_type: RENT_PRIVATELY + output: + # Every family has every other family's deductions (only the claimant's + # value is used): 300 + 200, 200 and 300. + council_tax_reduction_non_dep_deductions: [500, 200, 300] + merton_council_tax_reduction_non_dep_deductions: [500, 200, 300] + +- name: A non-dependant of only a couple who share the rent with a sharer falls wholly on the couple's CTR claim + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 45 + is_household_head: true + head_partner: + age: 44 + sharer: + age: 40 + relative: + age: 30 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + head_family: + members: [head, head_partner] + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + relative_family: + members: [relative] + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [head, head_partner, sharer, relative] + rent: 20_800 + tenure_type: RENT_PRIVATELY + output: + # The model treats a couple as one claim here, as it does when no one + # else is liable: the relative resides with that family alone, so its + # claim bears the whole deduction. Where both partners are named joint + # tenants (liable under LGFA 1992 s.6, not only s.9), the literal Sch 1 + # para 8(5) would split it between the two of them; the model cannot + # tell how a couple is liable. + council_tax_reduction_non_dep_deductions: [300, 0, 0] diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index b620fc6ed4..6e082a4ce9 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -15,9 +15,12 @@ deductions equal the previous formula (differential). 3. Differential: with every non-dependant shared (the default), the Housing Benefit deductions equal the previous formula (each family's share of the - rent times the household's deductions) and the Council Tax Reduction - deductions equal the previous formula (the deductions outside the family - times council_tax_reduction_joint_liability_share). + rent, computed or supplied, times the household's deductions) and the + Council Tax Reduction deductions equal the previous formula (the + deductions outside the family times + council_tax_reduction_joint_liability_share), wherever the rent is + positive. With no rent a sharer is not rent-liable, and the previous + formulas wrongly counted its members as non-dependants. 4. Attribution: a shared non-dependant counts in the household head's family's size criteria exactly as when they are the head family's only, and in a sharer's exactly as when they are the other joint occupiers' @@ -30,7 +33,7 @@ """ import numpy as np -from hypothesis import HealthCheck, given, settings +from hypothesis import HealthCheck, assume, given, settings from hypothesis import strategies as st from policyengine_uk import Simulation @@ -75,7 +78,12 @@ def households(draw): ) ), lodger=draw(st.booleans()), - rent=draw(st.floats(2_000, 30_000, allow_nan=False)), + rent=draw(st.one_of(st.just(0.0), st.floats(2_000, 30_000, allow_nan=False))), + # Supplied rent-share weights for the head and up to two sharers + # (normalised over the families liable for the rent), or None. + share_weights=draw( + st.one_of(st.none(), st.lists(st.floats(0.05, 1), min_size=3, max_size=3)) + ), ) @@ -85,6 +93,7 @@ def households(draw): def build(population, residence_override=None): """One situation for the whole population, with each family's role.""" people, benunits, homes, roles = {}, {}, {}, [] + supplied = any(house["share_weights"] is not None for house in population) for h, house in enumerate(population): members = [] @@ -112,14 +121,37 @@ def add_family(name, fam, role, extra): roles.append(role) return ids - head_ids = add_family(f"h{h}_head", house["head"], "head", {}) + weights = house["share_weights"] + shares = [None] * (1 + len(house["sharers"])) + if weights is not None: + used = weights[: len(shares)] + shares = [w / sum(used) for w in used] + elif supplied: + # policyengine-core treats a variable given for some families as + # an input for all, defaulting the rest to zero, so supply the + # formula's shares (people liable over people liable in the + # household; every adult here is a claimant or partner). + adults = [len(house["head"]["ages"])] + [ + len(sharer["ages"]) for sharer in house["sharers"] + ] + shares = [a / sum(adults) for a in adults] + + def share_input(i): + if shares[i] is None: + return {} + return {"share_of_household_rent": {YEAR: shares[i]}} + + head_ids = add_family(f"h{h}_head", house["head"], "head", share_input(0)) people[head_ids[0]]["is_household_head"] = {YEAR: True} for f, sharer in enumerate(house["sharers"]): add_family( f"h{h}_s{f}", sharer, "sharer", - {"liable_for_share_of_household_rent": {YEAR: True}}, + { + "liable_for_share_of_household_rent": {YEAR: True}, + **share_input(f + 1), + }, ) for f, (non_dep, residence) in enumerate(house["non_dependants"]): add_family( @@ -129,7 +161,8 @@ def add_family(name, fam, role, extra): { "non_dependant_normally_resides_with": { YEAR: residence_override or residence - } + }, + **({"share_of_household_rent": {YEAR: 0.0}} if supplied else {}), }, ) if house["lodger"]: @@ -137,7 +170,7 @@ def add_family(name, fam, role, extra): f"h{h}_l", dict(ages=[40], child_age=None, income=10_000), "lodger", - {}, + {"share_of_household_rent": {YEAR: 0.0}} if supplied else {}, ) people[ids[0]]["rent_paid_as_lodger"] = {YEAR: 4_000} homes[f"h{h}"] = { @@ -179,6 +212,13 @@ def person_per_household(sim, person_values): ) +def in_joint_occupier_family(sim, roles): + """Whether each person belongs to the household head's or a sharer's + family: such people are never anyone's non-dependant.""" + person_role = roles[sim.populations["benunit"].members_entity_id] + return (person_role == "head") | (person_role == "sharer") + + def has_sharer(sim, roles): return ( per_household(sim, (roles == "sharer").astype(float))[benunit_household(sim)] @@ -190,8 +230,12 @@ def has_sharer(sim, roles): @given(population) def test_housing_benefit_deductions_are_conserved(population): sim, roles = build(population) - deductions = calc(sim, "household_benefits_individual_non_dep_deduction") * calc( - sim, "is_non_dependant_of_household_head" + # A sharer with no rent is not rent-liable, but is still a joint + # occupier and so no one's non-dependant (HB reg 3(2)(d)). + deductions = ( + calc(sim, "household_benefits_individual_non_dep_deduction") + * calc(sim, "is_non_dependant_of_household_head") + * ~in_joint_occupier_family(sim, roles) ) families = calc(sim, "housing_benefit_non_dep_deductions") np.testing.assert_allclose( @@ -252,11 +296,7 @@ def test_shared_default_matches_the_previous_formulas(population): sim, "is_non_dependant_of_household_head" ) share = calc(sim, "share_of_household_rent") - np.testing.assert_allclose( - calc(sim, "housing_benefit_non_dep_deductions"), - share * person_per_household(sim, hb_individual)[household], - atol=MONEY_TOLERANCE, - ) + previous_hb = share * person_per_household(sim, hb_individual)[household] ctr_individual = calc(sim, "council_tax_reduction_individual_non_dep_deduction") own = np.bincount( sim.populations["benunit"].members_entity_id, @@ -267,9 +307,17 @@ def test_shared_default_matches_the_previous_formulas(population): sim, "council_tax_reduction_joint_liability_share" ) joint_occupier = (roles == "head") | (roles == "sharer") + # With no rent, a sharer is not rent-liable, so the previous formulas + # counted its own members as non-dependants; that case is excluded. + positive_rent = np.array([house["rent"] > 0 for house in population])[household] + hb = calc(sim, "housing_benefit_non_dep_deductions") + np.testing.assert_allclose( + hb[positive_rent], previous_hb[positive_rent], atol=MONEY_TOLERANCE + ) + compared = joint_occupier & positive_rent np.testing.assert_allclose( - calc(sim, "council_tax_reduction_non_dep_deductions")[joint_occupier], - previous[joint_occupier], + calc(sim, "council_tax_reduction_non_dep_deductions")[compared], + previous[compared], atol=MONEY_TOLERANCE, ) @@ -279,6 +327,8 @@ def test_shared_default_matches_the_previous_formulas(population): def test_shared_counts_as_head_only_for_the_head_and_as_others_only_for_sharers( population, ): + # Only households with both a sharer and a non-dependant test anything. + assume(any(h["sharers"] and h["non_dependants"] for h in population)) shared, roles = build(population, residence_override="EVERY_JOINT_OCCUPIER") head_only, _ = build(population, residence_override="HOUSEHOLD_HEAD_FAMILY") others_only, _ = build(population, residence_override="OTHER_JOINT_OCCUPIERS") diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py b/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py index de9212436f..58f47e83c9 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/non_dep_deduction/housing_benefit_non_dep_deductions.py @@ -33,5 +33,9 @@ def formula(benunit, period, parameters): "household_benefits_individual_non_dep_deduction", period ) * person("is_non_dependant_of_household_head", period) return apportioned_non_dependant_deductions( - benunit, period, deductions, equally=False + benunit, + period, + deductions, + equally=False, + every_joint_occupier_part=benunit("share_of_household_rent", period), ) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py index 2ba4cb8061..3fbdba58d0 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit_LHA_allowed_bedrooms.py @@ -48,8 +48,12 @@ class housing_benefit_LHA_allowed_bedrooms(Variable): "non-dependant, boarder or " "lodger are occupiers too, and share rooms with the claimant's " "children. A child or young person placed with a family in the " - "household as a foster child or for adoption is not an occupier. A " - "sharer's, boarder's or lodger's own claim counts only their own " + "household as a foster child or for adoption is not an occupier. " + "Where the rent is shared, a non-dependant and their children count " + "for each joint occupier they normally reside with, by default every " + "one (see non_dependant_normally_resides_with), while a boarder or " + "lodger, who pays the household head, counts for the head's family " + "only. A boarder's or lodger's own claim counts only their own " "family." ) definition_period = YEAR diff --git a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py index 80454efa6c..9e24fa9e7b 100644 --- a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py +++ b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py @@ -39,7 +39,7 @@ def council_tax_reduction_joint_liability_non_dep_deductions( share = benunit("council_tax_reduction_joint_liability_share", period) sole = (in_household - own) * share joint = apportioned_non_dependant_deductions( - benunit, period, deductions, equally=True + benunit, period, deductions, equally=True, every_joint_occupier_part=share ) return where(rent_is_shared, joint, sole) diff --git a/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py index dd55e982c7..4df32b9c2d 100644 --- a/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py +++ b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py @@ -65,52 +65,96 @@ def _joint_occupiers_by_residence(benunit, period): ) +def _outside_joint_occupiers(benunit, period): + """Whether each person is outside every family liable for the household's + rent (the household head's family and the sharers). A joint occupier is + never a non-dependant of itself or of another joint occupier (HB Regs + 2006 reg 3(2)(a), (d); SI 2012/2885 reg 9(2)(a), (d)), whatever its own + rent.""" + person = benunit.members + head_family = person.benunit.any(person("is_household_head", period)) + sharer = person.benunit("liable_for_share_of_household_rent", period) + return ~head_family & ~sharer + + +def _household_total_over_families(benunit, period, value, families): + """For each family, the household total of a family-level ``value`` over + the families marked by ``families``.""" + person = benunit.members + on_head = person("is_benunit_head", period) + return benunit.max( + person.household.sum(on_head * benunit.project(value * families)) + ) + + def non_dependants_residing_with(benunit, period, non_dependant): """For each family, the sum of ``non_dependant`` (a count or weight for each member of a non-dependant family, zero for anyone else) over the household's people who normally reside with it under - non_dependant_normally_resides_with.""" + non_dependant_normally_resides_with. Members of the joint occupiers' + families are never counted.""" person = benunit.members residence = person.benunit("non_dependant_normally_resides_with", period) + source = non_dependant * _outside_joint_occupiers(benunit, period) count = 0 for value, joint_occupier in _joint_occupiers_by_residence(benunit, period): - in_household = benunit.max( - person.household.sum(non_dependant * (residence == value)) - ) + in_household = benunit.max(person.household.sum(source * (residence == value))) count = count + joint_occupier * in_household return count -def apportioned_non_dependant_deductions(benunit, period, deductions, equally): +def apportioned_non_dependant_deductions( + benunit, period, deductions, equally, every_joint_occupier_part +): """For each family, its part of the deductions for the household's non-dependants (``deductions``, one amount per person and zero for anyone - who is not a non-dependant), each split between the joint occupiers the - non-dependant normally resides with. + who is not a non-dependant; members of the joint occupiers' families are + never counted), each split between the joint occupiers the non-dependant + normally resides with. + + For a non-dependant of every joint occupier, each family's part is + ``every_joint_occupier_part``: its share of the rent for Housing Benefit + (share_of_household_rent) and its joint liability share for Council Tax + Reduction (council_tax_reduction_joint_liability_share), as before. - With ``equally`` false (Housing Benefit, reg 74(5)), each joint occupier's - part is its share of the rent among them: the people liable for the rent - in its family over those in all of them. With ``equally`` true (Council - Tax Reduction, SI 2012/2885 Sch 1 para 8(5)), each part is one over the + For a non-dependant of some of them, with ``equally`` false (Housing + Benefit, reg 74(5)), each joint occupier's part is its share of the rent + over the shares of all of them, or its people liable for the rent over + theirs where those shares sum to zero; with ``equally`` true (Council Tax + Reduction, SI 2012/2885 Sch 1 para 8(5)), each part is one over the number of people liable among them, and the whole where only the family is liable. """ person = benunit.members residence = person.benunit("non_dependant_normally_resides_with", period) + source = deductions * _outside_joint_occupiers(benunit, period) liable = person("is_liable_for_household_rent", period) liable_in_family = benunit.sum(liable) + share = benunit("share_of_household_rent", period) + values = NonDependantResidence total = 0 for value, joint_occupier in _joint_occupiers_by_residence(benunit, period): liable_in_joint_occupiers = benunit.max( person.household.sum(liable & benunit.project(joint_occupier)) ) - if equally: + if value == values.EVERY_JOINT_OCCUPIER: + part = every_joint_occupier_part + elif equally: part = where( liable_in_joint_occupiers > liable_in_family, 1 / max_(liable_in_joint_occupiers, 1), 1, ) else: - part = liable_in_family / max_(liable_in_joint_occupiers, 1) - pool = benunit.max(person.household.sum(deductions * (residence == value))) + share_of_joint_occupiers = _household_total_over_families( + benunit, period, share, joint_occupier + ) + part = where( + share_of_joint_occupiers > 0, + share + / where(share_of_joint_occupiers > 0, share_of_joint_occupiers, 1), + liable_in_family / max_(liable_in_joint_occupiers, 1), + ) + pool = benunit.max(person.household.sum(source * (residence == value))) total = total + joint_occupier * part * pool return total From b435c91e2fee7f6834264f307e653905e5f14e15 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 3 Oct 2026 09:01:31 -0400 Subject: [PATCH 07/22] Address review r2: head-only sharer flag, supplied shares without sharers - rent_shared_with_another_family: a sharer flag on the household head's own family shares the rent with no one; the residence helper and the CTR wrapper both use it, so the no-sharer CTR formula holds there. - Without another family sharing the rent, every residence value takes the caller's part, so supplied rent shares give one result. - Document the CTR convention: several jointly liable families each bear one person's part; a non-dependant's only host family, a couple included, bears the whole deduction (s.6 vs s.9 liability not observed). - Properties: supplied zero shares; the old-formula differential compares households where every joint occupier has rent of its own. - YAML regressions for both fixes. Co-Authored-By: Claude Opus 5.5 --- ...HA_joint_tenants_shared_non_dependant.yaml | 66 +++++++++++++++++++ ..._tenant_shared_non_dependant_properties.py | 39 +++++++---- .../council_tax_reduction/_legacy.py | 24 +++---- .../non_dependant_normally_resides_with.py | 29 ++++++-- 4 files changed, 129 insertions(+), 29 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml index c5c92795d4..d7bfd00078 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml @@ -629,3 +629,69 @@ # para 8(5) would split it between the two of them; the model cannot # tell how a couple is liable. council_tax_reduction_non_dep_deductions: [300, 0, 0] + +- name: A sharer flag on the household head's own family shares the rent with no one + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + council_tax_reduction_individual_non_dep_deduction: 0 + merton_council_tax_reduction_individual_non_dep_deduction: 0 + adult_1: + age: 40 + council_tax_reduction_individual_non_dep_deduction: 300 + merton_council_tax_reduction_individual_non_dep_deduction: 300 + adult_2: + age: 40 + council_tax_reduction_individual_non_dep_deduction: 200 + merton_council_tax_reduction_individual_non_dep_deduction: 200 + benunits: + head_family: + members: [head] + liable_for_share_of_household_rent: true + family_1: + members: [adult_1] + family_2: + members: [adult_2] + households: + home: + members: [head, adult_1, adult_2] + rent: 20_800 + tenure_type: RENT_PRIVATELY + output: + # The head's family is always liable; the flag matters only for other + # families, so this is the no-sharer case and the previous formula holds. + council_tax_reduction_non_dep_deductions: [500, 200, 300] + merton_council_tax_reduction_non_dep_deductions: [500, 200, 300] + +- name: Without sharers every residence value takes the supplied rent share + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + daughter: + age: 22 + household_benefits_individual_non_dep_deduction: 1_000 + benunits: + head_family: + members: [head] + share_of_household_rent: 0.6 + daughter_family: + members: [daughter] + share_of_household_rent: 0 + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [head, daughter] + rent: 20_800 + tenure_type: RENT_PRIVATELY + output: + # As for the default value: the household head's family's supplied + # share of the rent times the deduction. + housing_benefit_non_dep_deductions: [600, 0] diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index 6e082a4ce9..e87bf9c295 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -8,19 +8,23 @@ deductions for its non-dependants, whichever joint occupiers each one resides with. 2. Bounds (CTR Sch 1 para 8(5)): each family's Council Tax Reduction part is - between zero and the household's deductions; where the rent is shared, - the joint occupiers' parts sum to at most the household's deductions - (equal shares per liable person, with a couple bearing one person's part) - and no other family bears any. Where it is not shared, every family's - deductions equal the previous formula (differential). + between zero and the household's deductions; where another family shares + the rent, the joint occupiers' parts sum to at most the household's + deductions (a non-dependant of several jointly liable families is split + equally per liable person, each family bearing one person's part; one of + a single family, a couple included, is that family's whole deduction) + and no other family bears any. Where no other family shares the rent, + every family's deductions equal the previous formula (differential). 3. Differential: with every non-dependant shared (the default), the Housing Benefit deductions equal the previous formula (each family's share of the rent, computed or supplied, times the household's deductions) and the Council Tax Reduction deductions equal the previous formula (the deductions outside the family times - council_tax_reduction_joint_liability_share), wherever the rent is - positive. With no rent a sharer is not rent-liable, and the previous - formulas wrongly counted its members as non-dependants. + council_tax_reduction_joint_liability_share) in every household where the + previous formulas classified the joint occupiers correctly: where every + joint-occupier family has rent of its own. The previous rent-based flags + counted a joint occupier with no rent of its own (no household rent, or a + supplied zero share) as a non-dependant; that is the intended correction. 4. Attribution: a shared non-dependant counts in the household head's family's size criteria exactly as when they are the head family's only, and in a sharer's exactly as when they are the other joint occupiers' @@ -82,7 +86,14 @@ def households(draw): # Supplied rent-share weights for the head and up to two sharers # (normalised over the families liable for the rent), or None. share_weights=draw( - st.one_of(st.none(), st.lists(st.floats(0.05, 1), min_size=3, max_size=3)) + st.one_of( + st.none(), + st.lists( + st.one_of(st.just(0.0), st.floats(0.05, 1)), + min_size=3, + max_size=3, + ), + ) ), ) @@ -123,7 +134,7 @@ def add_family(name, fam, role, extra): weights = house["share_weights"] shares = [None] * (1 + len(house["sharers"])) - if weights is not None: + if weights is not None and sum(weights[: len(shares)]) > 0: used = weights[: len(shares)] shares = [w / sum(used) for w in used] elif supplied: @@ -307,9 +318,11 @@ def test_shared_default_matches_the_previous_formulas(population): sim, "council_tax_reduction_joint_liability_share" ) joint_occupier = (roles == "head") | (roles == "sharer") - # With no rent, a sharer is not rent-liable, so the previous formulas - # counted its own members as non-dependants; that case is excluded. - positive_rent = np.array([house["rent"] > 0 for house in population])[household] + # The previous formulas classified a joint occupier with no rent of its + # own (no household rent, or a supplied zero share) as a non-dependant; + # compare only households where every joint occupier has rent. + rentless = joint_occupier & (calc(sim, "benunit_rent") <= 0) + positive_rent = per_household(sim, rentless.astype(float))[household] == 0 hb = calc(sim, "housing_benefit_non_dep_deductions") np.testing.assert_allclose( hb[positive_rent], previous_hb[positive_rent], atol=MONEY_TOLERANCE diff --git a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py index 9e24fa9e7b..745c4f3975 100644 --- a/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py +++ b/policyengine_uk/variables/gov/local_authorities/council_tax_reduction/_legacy.py @@ -1,6 +1,7 @@ from policyengine_uk.model_api import * from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( apportioned_non_dependant_deductions, + rent_shared_with_another_family, ) from policyengine_uk.variables.household.demographic.highest_education import ( EducationType, @@ -19,22 +20,23 @@ def council_tax_reduction_joint_liability_non_dep_deductions( """Each family's deductions for the household's non-dependants (``deductions``, one amount per person; ``own``, the family's own amount). - Where the household's rent is shared, a non-dependant of two or more - jointly liable people is apportioned equally between them (SI 2012/2885 - Sch 1 para 8(5); WSI 2013/3029 Sch 1 para 3(5) and Sch 6 para 5(5); SSI - 2021/249 reg 90(5); SSI 2012/319 reg 48(5)), and one who resides with - only one of them is deducted in full from that one (see - non_dependant_normally_resides_with). Otherwise the claimant, the family + Where a family other than the household head's shares the rent, a + non-dependant of two or more jointly liable families is apportioned + equally between their liable people (SI 2012/2885 Sch 1 para 8(5); WSI + 2013/3029 Sch 1 para 3(5) and Sch 6 para 5(5); SSI 2021/249 reg 90(5); + SSI 2012/319 reg 48(5)), each family bearing one person's part as for + the council tax itself (council_tax_reduction_joint_liability_share). + One who resides with only one of them is deducted in full from that + family, a couple included: the model cannot tell whether both partners + are named tenants liable under LGFA 1992 s.6 (when the literal para 8(5) + would split it between them) or liable only as spouses (s.9). See + non_dependant_normally_resides_with. Otherwise the claimant, the family of the household's oldest adult (see council_tax_reduction_claimant_benunit), has every other family's deductions, as before. """ person = benunit.members - rent_is_shared = benunit.any( - person.household.any( - person.benunit("liable_for_share_of_household_rent", period) - ) - ) + rent_is_shared = rent_shared_with_another_family(benunit, period) in_household = benunit.max(person.household.sum(deductions)) share = benunit("council_tax_reduction_joint_liability_share", period) sole = (in_household - own) * share diff --git a/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py index 4df32b9c2d..fadc43cb8c 100644 --- a/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py +++ b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py @@ -47,6 +47,17 @@ class non_dependant_normally_resides_with(Variable): ) +def rent_shared_with_another_family(benunit, period): + """Whether a family other than the household head's shares the + household's rent (liable_for_share_of_household_rent). The head's family + is always liable, so the flag on the head's own family means nothing.""" + person = benunit.members + in_sharer_family = person.benunit( + "liable_for_share_of_household_rent", period + ) & ~person.benunit.any(person("is_household_head", period)) + return benunit.any(person.household.any(in_sharer_family)) + + def _joint_occupiers_by_residence(benunit, period): """Pairs of (residence value, whether each family is one of the joint occupiers a non-dependant with that value normally resides with).""" @@ -54,10 +65,7 @@ def _joint_occupiers_by_residence(benunit, period): values = NonDependantResidence head_family = benunit.any(person("is_household_head", period)) sharer = benunit("liable_for_share_of_household_rent", period) & ~head_family - in_sharer_family = person.benunit( - "liable_for_share_of_household_rent", period - ) & ~person.benunit.any(person("is_household_head", period)) - rent_is_shared = benunit.any(person.household.any(in_sharer_family)) + rent_is_shared = rent_shared_with_another_family(benunit, period) return ( (values.EVERY_JOINT_OCCUPIER, head_family | sharer), (values.HOUSEHOLD_HEAD_FAMILY, head_family), @@ -123,11 +131,21 @@ def apportioned_non_dependant_deductions( theirs where those shares sum to zero; with ``equally`` true (Council Tax Reduction, SI 2012/2885 Sch 1 para 8(5)), each part is one over the number of people liable among them, and the whole where only the family - is liable. + is liable. A family that is a non-dependant's only host, a couple + included, bears the whole deduction: the model cannot tell whether both + partners are named tenants liable under LGFA 1992 s.6 (when the literal + para 8(5) would split it between them) or liable only as spouses (s.9). + + Where no family other than the household head's shares the rent, every + residence value means the head's family alone, which takes + ``every_joint_occupier_part``. """ person = benunit.members residence = person.benunit("non_dependant_normally_resides_with", period) source = deductions * _outside_joint_occupiers(benunit, period) + # Without another family sharing the rent, every value means the + # household head's family alone, so each takes the caller's part. + rent_is_shared = rent_shared_with_another_family(benunit, period) liable = person("is_liable_for_household_rent", period) liable_in_family = benunit.sum(liable) share = benunit("share_of_household_rent", period) @@ -155,6 +173,7 @@ def apportioned_non_dependant_deductions( / where(share_of_joint_occupiers > 0, share_of_joint_occupiers, 1), liable_in_family / max_(liable_in_joint_occupiers, 1), ) + part = where(rent_is_shared, part, every_joint_occupier_part) pool = benunit.max(person.household.sum(source * (residence == value))) total = total + joint_occupier * part * pool return total From b0584b65e39a71bd5d481f15f8ddcd0bbc64d54a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 18:26:33 -0500 Subject: [PATCH 08/22] Read non-dependant residence in the HB severe disability conditions Main added housing_benefit_severe_disability_premium_applies after #2035's base (01d140e77, in #2006), and housing_benefit_LHA_category reads it beside housing_benefit_has_non_dependant. The merge (c7e610b18) sent only the second through non_dependant_normally_resides_with, so the two tests could name different non-dependants. A disabled joint tenant lost the conditions, and took the shared accommodation rate, for a non-dependant who lives with the other tenant only, or for another joint tenant with no rent. The conditions' test for non-dependants outside the family now goes through non_dependants_residing_with, as housing_benefit_has_non_dependant does (HB Regs 2006 Sch 3 para 14(2)(a)(ii) with reg 3(1), (2)(d) and (4); LHA Guidance Manual paras 2.093 and 2.110). With the default input each liable family keeps main's result, except that a member of a joint occupier's family with no rent of its own no longer counts. That exception also qualifies the merge message, which says each result equals main's wherever the input keeps its default: a joint occupier with no rent is never a non-dependant in housing_benefit_has_non_dependant, the Housing Benefit deductions and, now, these conditions (68647f9b6). Main's other severe disability premium tests, has_non_dependant_for_severe_disability_premium and the Council Tax Reduction one, keep their explicit input (severe_disability_premium_joint_occupier_exclusion_applies) and do not read the residence input. Tests: - LHA_joint_tenants_shared_non_dependant.yaml gains four cases: a non-dependant of the other tenant only, of the household head only and of every tenant, and a sharer with a supplied zero share of the rent. - test_joint_tenant_shared_non_dependant_properties.py gains a property: for joint occupiers on the daily living component of Personal Independence Payment, the conditions hold exactly when housing_benefit_has_non_dependant is false. It fails on c7e610b18's formula. - changelog.d/2029.fixed.md names the conditions and limits its sentence on a joint tenant with no rent to the Housing Benefit rules it covers. Co-Authored-By: Claude Fable 5.2 --- changelog.d/2029.fixed.md | 2 +- ...HA_joint_tenants_shared_non_dependant.yaml | 152 ++++++++++++++++++ ..._tenant_shared_non_dependant_properties.py | 37 ++++- ...nefit_severe_disability_premium_applies.py | 26 ++- 4 files changed, 208 insertions(+), 9 deletions(-) diff --git a/changelog.d/2029.fixed.md b/changelog.d/2029.fixed.md index 7e9f787bb7..be7a1fdac0 100644 --- a/changelog.d/2029.fixed.md +++ b/changelog.d/2029.fixed.md @@ -1 +1 @@ -Let a non-dependant live with only some of a household's joint tenants in Housing Benefit and Council Tax Reduction (new input `non_dependant_normally_resides_with`; the default is every joint tenant, as before): only those joint tenants count the non-dependant in their size criteria and shared accommodation test, and only they bear the non-dependant deduction. Housing Benefit no longer treats a joint tenant with no rent of their own as a non-dependant. +Let a non-dependant live with only some of a household's joint tenants in Housing Benefit and Council Tax Reduction (new input `non_dependant_normally_resides_with`; the default is every joint tenant, as before): only those joint tenants count the non-dependant in their Housing Benefit size criteria and shared accommodation test, including the severe disability premium conditions that test reads, and only they bear the non-dependant deduction in either benefit. Those Housing Benefit rules no longer treat a joint tenant with no rent of their own as a non-dependant. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml index af6d567821..bbf50e0adc 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml @@ -793,3 +793,155 @@ housing_benefit_LHA_allowed_bedrooms: [3, 2, 2] housing_benefit_has_non_dependant: [true, false, true] housing_benefit_non_dep_deductions: [600, 0, 0] + +# The Housing Benefit severe disability premium conditions (HB Regs 2006 Sch 3 +# para 14(2)(a)(ii) with (4)) need no non-dependant aged 18 or over residing +# with the claimant, and a claimant who meets them is off the shared +# accommodation rate (reg 13D(2)(a)). That test reads the same residence as +# the young individual's (housing_benefit_has_non_dependant). + +- name: A disabled joint tenant keeps the severe disability premium conditions when the non-dependant lives with the other tenant only + period: 2026 + input: + people: + head: + age: 30 + is_household_head: true + pip_dl: 3_000 + sharer: + age: 30 + friend: + age: 30 + benunits: + head_family: + members: [head] + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + friend_family: + members: [friend] + non_dependant_normally_resides_with: OTHER_JOINT_OCCUPIERS + households: + home: + members: [head, sharer, friend] + rent: 18_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # The friend is the sharer's non-dependant alone (LHA Guidance Manual + # para 2.093 example 2), so no non-dependant resides with the head, who + # receives the PIP daily living component: para 14(2)(a) applies, the + # shared accommodation rate does not, and the head has the one-bedroom + # rate (B). The sharer counts the friend: 2 bedrooms (C). + housing_benefit_has_non_dependant: [false, true, false] + housing_benefit_severe_disability_premium_applies: [true, false, false] + housing_benefit_LHA_allowed_bedrooms: [1, 2, 1] + housing_benefit_LHA_category: [B, C, A] + +- name: A disabled sharer keeps the severe disability premium conditions when the non-dependant lives with the household head only + period: 2026 + input: + people: + head: + age: 30 + is_household_head: true + sharer: + age: 30 + pip_dl: 3_000 + friend: + age: 30 + benunits: + head_family: + members: [head] + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + friend_family: + members: [friend] + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [head, sharer, friend] + rent: 18_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + housing_benefit_has_non_dependant: [true, false, false] + housing_benefit_severe_disability_premium_applies: [false, true, false] + housing_benefit_LHA_allowed_bedrooms: [2, 1, 1] + housing_benefit_LHA_category: [C, B, A] + +- name: A non-dependant of every joint tenant rules out each tenant's severe disability premium conditions + period: 2026 + input: + people: + head: + age: 30 + is_household_head: true + pip_dl: 3_000 + sharer: + age: 30 + pip_dl: 3_000 + friend: + age: 30 + benunits: + head_family: + members: [head] + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + friend_family: + members: [friend] + households: + home: + members: [head, sharer, friend] + rent: 18_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # The default: the friend resides with both joint tenants (LHA Guidance + # Manual para 2.110), so para 14(2)(a)(ii) rules the conditions out for + # each. Each counts the friend: 2 bedrooms (C). + non_dependant_normally_resides_with: + [EVERY_JOINT_OCCUPIER, EVERY_JOINT_OCCUPIER, EVERY_JOINT_OCCUPIER] + housing_benefit_has_non_dependant: [true, true, false] + housing_benefit_severe_disability_premium_applies: [false, false, false] + housing_benefit_LHA_category: [C, C, A] + +- name: A sharer given no share of the rent is not a non-dependant in the severe disability premium conditions + period: 2026 + input: + people: + head: + age: 40 + is_household_head: true + pip_dl: 3_000 + sharer: + age: 40 + benunits: + head_family: + members: [head] + share_of_household_rent: 1 + housing_benefit_shares_accommodation: true + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + share_of_household_rent: 0 + housing_benefit_shares_accommodation: true + households: + home: + members: [head, sharer] + rent: 18_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # With no rent of its own the sharer's family is not rent-liable, so the + # rent-based flag marks the sharer. A joint occupier is still no one's + # non-dependant (reg 3(2)(d)): the head, on the PIP daily living + # component, meets para 14(2)(a). Both lack exclusive use of + # self-contained accommodation; the head has the one-bedroom rate (B) + # all the same, and the sharer the shared accommodation rate (A). + is_non_dependant_of_household_head: [false, true] + housing_benefit_has_non_dependant: [false, false] + housing_benefit_severe_disability_premium_applies: [true, false] + housing_benefit_LHA_category: [B, A] diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index 6fef9ec695..c6a670c795 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -42,6 +42,12 @@ 6. Universal Credit does not depend on the residence input. 7. Monotonicity: marking a non-dependant as one joint occupier's only never raises another joint occupier's bedrooms or deductions. +8. One residence for both Housing Benefit tests: a joint occupier who + receives the daily living component of Personal Independence Payment + meets the severe disability premium conditions (HB Regs 2006 Sch 3 para + 14(2)(a)) exactly when no non-dependant resides with them + (housing_benefit_has_non_dependant), whichever joint occupiers each + non-dependant resides with, and whatever the other joint occupiers' rent. """ import numpy as np @@ -109,8 +115,10 @@ def households(draw): population = st.lists(households(), min_size=1, max_size=5) -def build(population, residence_override=None): - """One situation for the whole population, with each family's role.""" +def build(population, residence_override=None, disabled_roles=()): + """One situation for the whole population, with each family's role. The + adults of the families in ``disabled_roles`` receive the daily living + component of Personal Independence Payment.""" people, benunits, homes, roles = {}, {}, {}, [] supplied = any(house["share_weights"] is not None for house in population) for h, house in enumerate(population): @@ -126,6 +134,8 @@ def add_family(name, fam, role, extra): "is_household_head": {YEAR: False}, "employment_income": {YEAR: fam["income"] if i == 0 else 0}, } + if role in disabled_roles: + people[pid]["pip_dl"] = {YEAR: 3_000} ids.append(pid) if fam["child_age"] is not None: pid = f"{name}_child" @@ -445,3 +455,26 @@ def test_residence_is_a_no_op_without_sharers_and_for_universal_credit(populatio np.testing.assert_allclose( calc(sim, variable), reference, atol=MONEY_TOLERANCE ) + + +@PROPERTY_SETTINGS +@given(population) +def test_severe_disability_premium_reads_the_same_residence(population): + """A joint occupier whose claimant and partner receive the daily living + component of Personal Independence Payment meets the severe disability + premium conditions (HB Regs 2006 Sch 3 para 14(2)(a)) exactly when no + non-dependant resides with them (reg 3; + housing_benefit_has_non_dependant). Every generated non-dependant family + has an adult aged 18 or over with no qualifying benefit, so the two + tests name the same families. The household heads' families receive the + component in one population and the sharers' in the other. The other + joint occupiers then receive no qualifying benefit, which tests that + they are never non-dependants, whatever their rent.""" + for role in ["head", "sharer"]: + sim, roles = build(population, disabled_roles=(role,)) + disabled = roles == role + applies = calc(sim, "housing_benefit_severe_disability_premium_applies") + has_non_dependant = calc(sim, "housing_benefit_has_non_dependant") + np.testing.assert_array_equal( + applies[disabled], 1 - has_non_dependant[disabled] + ) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py index aa247a5dcb..cd3c5bfedf 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + non_dependants_residing_with, +) class housing_benefit_severe_disability_premium_applies(Variable): @@ -10,7 +13,12 @@ class housing_benefit_severe_disability_premium_applies(Variable): "Benefit severe disability premium: the claimant (and any partner) " "receives a qualifying disability benefit, and no non-dependant aged " "18 or over normally resides with them, other than one who receives " - "a qualifying benefit or is blind. A partner who is blind and " + "a qualifying benefit or is blind. Where the rent is shared, another " + "family's non-dependant resides with each joint occupier that " + "non_dependant_normally_resides_with gives, by default every one, " + "and a joint occupier's own family is never another's " + "non-dependant, whatever its rent (as for " + "housing_benefit_has_non_dependant). A partner who is blind and " "receives no qualifying benefit is treated as not being the " "claimant's partner, so the claimant is tested as a single person. " "Not modelled: who receives Carer's Allowance, Carer Support Payment " @@ -22,6 +30,8 @@ class housing_benefit_severe_disability_premium_applies(Variable): reference = ( "https://www.legislation.gov.uk/uksi/2006/213/schedule/3/paragraph/14", "https://www.legislation.gov.uk/uksi/2006/214/schedule/3/paragraph/6", + "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", + "https://www.legislation.gov.uk/uksi/2006/214/regulation/3", ) def formula(benunit, period, parameters): @@ -53,10 +63,14 @@ def formula(benunit, period, parameters): ) | person("is_child_or_young_person_placed_with_family", period) within = benunit.any(adult_non_dependant & ~claimant_or_partner & ~young_person) liable_family = benunit.any(person("is_liable_for_household_rent", period)) - outside = benunit.max( - person.household.sum( - adult_non_dependant - & person("is_non_dependant_of_household_head", period) - ) + # Outside the family, reg 3(1), (2)(d) and (4): the non-dependants + # who normally reside with this joint occupier + # (non_dependant_normally_resides_with; LHA Guidance Manual paras + # 2.093 and 2.110). A member of a joint occupier's family is no one's + # non-dependant, even where the family has no rent of its own. + outside = non_dependants_residing_with( + benunit, + period, + adult_non_dependant & person("is_non_dependant_of_household_head", period), ) return all_qualify & ~within & ~(liable_family & (outside > 0)) From e8e8fe369528e3379186266a9c12d41fce065036 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 15 Nov 2026 18:26:44 -0500 Subject: [PATCH 09/22] Bound each Council Tax Reduction applicant by its own scheme's deductions After the merge, the bounds property covered only applicants under the scheme of the household head's family. council_tax_reduction_individual_non_dep_deduction reports that scheme, and main recomputes the deductions of an applicant under the other one (#2015). An applicant under the other scheme, such as a pensioner who shares the rent with a working-age household head, had no upper bound. The test now builds the same population with council_tax_reduction_pensioner reversed for each household head's family, and reads each person's deduction under the other scheme from it. Every applicant, and the joint occupiers' parts under each scheme, are bounded by the household's deductions under that scheme. The test does not call the model's helper (individual_non_dep_deduction) for this. Outside a formula, Simulation.calculate returns enum names, so the helper's comparisons with Country and EducationType members fail and every amount comes back zero. Co-Authored-By: Claude Fable 5.2 --- ..._tenant_shared_non_dependant_properties.py | 75 +++++++++++++------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index c6a670c795..581260fff5 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -9,17 +9,18 @@ two members', reg 74(3)), whichever joint occupiers each one resides with. 2. Bounds (CTR Sch 1 para 8(5)): each family's Council Tax Reduction part is - between zero and the household's deductions (for an applicant under the - household head's family's scheme, whose amounts the person-level - deduction reports); where another family shares - the rent, the joint occupiers' parts sum to at most the household's - deductions (a non-dependant of several jointly liable families is split - equally per liable person, each family bearing one person's part; one of - a single family, a couple included, is that family's whole deduction) - and no other family bears any. Where no other family shares the rent, - every family's deductions equal the previous formula (differential): the - household head's family, the only one that claims, has every other - family's deductions, one for each couple. + between zero and the household's deductions under the family's own + scheme (the person-level deduction reports the household head's family's + scheme; an applicant under the other scheme has the amounts recomputed + under its own); where another family shares the rent, the joint + occupiers' parts under each scheme sum to at most the household's + deductions under that scheme (a non-dependant of several jointly liable + families is split equally per liable person, each family bearing one + person's part; one of a single family, a couple included, is that + family's whole deduction) and no other family bears any. Where no other + family shares the rent, every family's deductions equal the previous + formula (differential): the household head's family, the only one that + claims, has every other family's deductions, one for each couple. 3. Differential: with every non-dependant shared (the default), the Housing Benefit deductions equal the previous formula (each family's share of the rent, computed or supplied, times the household's deductions) and the @@ -115,10 +116,13 @@ def households(draw): population = st.lists(households(), min_size=1, max_size=5) -def build(population, residence_override=None, disabled_roles=()): +def build( + population, residence_override=None, disabled_roles=(), pensioner_families=None +): """One situation for the whole population, with each family's role. The adults of the families in ``disabled_roles`` receive the daily living - component of Personal Independence Payment.""" + component of Personal Independence Payment. ``pensioner_families``, one + value for each family in order, supplies council_tax_reduction_pensioner.""" people, benunits, homes, roles = {}, {}, {}, [] supplied = any(house["share_weights"] is not None for house in population) for h, house in enumerate(population): @@ -146,6 +150,10 @@ def add_family(name, fam, role, extra): } ids.append(pid) benunits[name] = {"members": ids, **extra} + if pensioner_families is not None: + benunits[name]["council_tax_reduction_pensioner"] = { + YEAR: bool(pensioner_families[len(roles)]) + } members.extend(ids) roles.append(role) return ids @@ -275,6 +283,18 @@ def under_head_scheme(sim, roles): return pensioner == head_scheme[benunit_household(sim)] +def other_scheme_individual_deduction(population, sim, roles): + """Each person's Council Tax Reduction non-dependant deduction under the + scheme (pensioner or working-age) that the household head's family is + not under: council_tax_reduction_individual_non_dep_deduction in the + same population with the scheme of each household head's family + reversed and every other family's kept.""" + pensioner = calc(sim, "council_tax_reduction_pensioner") + reversed_for_head = np.where(roles == "head", 1 - pensioner, pensioner) + other, _ = build(population, pensioner_families=reversed_for_head) + return calc(other, "council_tax_reduction_individual_non_dep_deduction") + + def has_sharer(sim, roles): return ( per_household(sim, (roles == "sharer").astype(float))[benunit_household(sim)] @@ -313,17 +333,30 @@ def test_council_tax_reduction_deductions_are_bounded(population): in_household = person_per_household(sim, deductions) families = calc(sim, "council_tax_reduction_non_dep_deductions") assert np.all(families >= -MONEY_TOLERANCE) - # The household's deductions are those under the household head's - # family's scheme, so they bound the applicants under that scheme. + # The household's deductions under each scheme bound the applicants + # under that scheme: the person-level variable reports the household + # head's family's scheme, and the same population with that family's + # scheme reversed reports the other. same_scheme = under_head_scheme(sim, roles) - bound = in_household[benunit_household(sim)] - assert np.all(families[same_scheme] <= bound[same_scheme] + MONEY_TOLERANCE) - # Where the rent is shared, the joint occupiers' parts never exceed the - # household's deductions, and no one else bears any. + other_in_household = person_per_household( + sim, other_scheme_individual_deduction(population, sim, roles) + ) + household = benunit_household(sim) + bound = np.where( + same_scheme, in_household[household], other_in_household[household] + ) + assert np.all(families <= bound + MONEY_TOLERANCE) + # Where the rent is shared, the joint occupiers' parts under each scheme + # never exceed the household's deductions under it, and no one else + # bears any. shared = has_sharer(sim, roles) joint_occupier = (roles == "head") | (roles == "sharer") - joint_parts = per_household(sim, families * (shared & joint_occupier & same_scheme)) - assert np.all(joint_parts <= in_household + MONEY_TOLERANCE) + for scheme, total in [ + (same_scheme, in_household), + (~same_scheme, other_in_household), + ]: + joint_parts = per_household(sim, families * (shared & joint_occupier & scheme)) + assert np.all(joint_parts <= total + MONEY_TOLERANCE) assert np.all(families[shared & ~joint_occupier] == 0) From f89f4a44cac4c8227616850ddcd0ccdec7e0de04 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 09:47:05 -0500 Subject: [PATCH 10/22] Give the UC shared-rate non-dependant test UC's own definitions UC Regs 2013 Sch 4 para 28(3)-(4): a specified renter is not responsible for a child or qualifying young person and has no non-dependant, both in Universal Credit's terms (regs 4-5 and para 9). lha_renter_has_non_dependant is already UC-only for other families (uc_non_dependants_counted with other_family_non_dependants, kept as is), but its in-unit part still read a blend: a child or young person under either scheme, a placed child, or anyone aged 16. It now reads is_benefit_unit_non_dependant_for_universal_credit, which already leaves out the claimant or partner, a qualifying young person and the renter's foster child (para 9(2)(c)). The union responsibility term in is_lha_shared_accommodation_rate_specified_renter existed to cover the blend: a Child Benefit young person who is not a UC qualifying young person (a 19-year-old in non-advanced education past the UC terminal date) was not on the flag. They are now a non-dependant on it, so the specified-renter test reads UC responsibility only. is_responsible_for_child_or_young_person_for_uc_or_housing_benefit keeps its formula; no formula reads it now, and its docstring says so. In the C4 case of LHA_other_families_children_and_additional_bedrooms.yaml, the sharer's looked-after 17-year-old is the sharer's foster child, so not the sharer's own non-dependant: the sharer's flag goes from true to false. The sharer is 40, so no category changes. Rebuilds part of PolicyEngine/policyengine-uk#2030 (c51820e06) on #2035. Co-Authored-By: Claude Opus 5.5 --- ...lies_children_and_additional_bedrooms.yaml | 7 +++- ...red_accommodation_rate_specified_renter.py | 18 ++++---- ..._young_person_for_uc_or_housing_benefit.py | 34 +++++++-------- .../gov/dwp/lha_renter_has_non_dependant.py | 42 ++++++++++--------- 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml index 75b512d66a..ea49d91b3f 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml @@ -403,6 +403,7 @@ # the foster parent condition (para 29(9A)). is_responsible_for_child_or_young_person_for_uc_or_housing_benefit: false lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: false LHA_allowed_bedrooms: 2 LHA_category: C @@ -1596,8 +1597,10 @@ uc_non_dependants_counted: [true, false] LHA_allowed_bedrooms: [2, 2] # The third condition in para 28(4) fails, so the head, single and - # under 35, is not a specified renter (para 27): category C, not A. - lha_renter_has_non_dependant: [true, true] + # under 35, is not a specified renter (para 27): category C, not A. The + # foster child is not a non-dependant of the sharer, their foster parent + # (para 9(2)(c)); the sharer, aged 40, is no specified renter anyway. + lha_renter_has_non_dependant: [true, false] is_lha_shared_accommodation_rate_specified_renter: [false, false] LHA_category: [C, C] # The head's £13,000 share of the rent exceeds Maidstone's two-bedroom diff --git a/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py b/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py index e95ee179ed..f530b6be8e 100644 --- a/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py +++ b/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py @@ -15,8 +15,9 @@ class is_lha_shared_accommodation_rate_specified_renter(Variable): "accommodation age threshold and not excepted by a disability benefit " "(para 29(5); armed forces independence payment counts as attendance " "allowance, reg. 2) or as a foster parent or adopter (para 29(9A)); " - "not responsible for a child or qualifying young person; and with no " - "non-dependant under the household composition proxy. The age and " + "not responsible for a child or qualifying young person under UC " + "regs 4 and 5; and with no non-dependant (see " + "lha_renter_has_non_dependant). The age and " "the exceptions are the renter's own: the other member of a couple " "claiming as a single person is neither the renter nor a " "non-dependant (para 9(2)(b)). Other paragraph 29 exceptions are not " @@ -31,6 +32,8 @@ class is_lha_shared_accommodation_rate_specified_renter(Variable): "https://www.legislation.gov.uk/uksi/2013/376/schedule/4/paragraph/9", "https://www.legislation.gov.uk/uksi/2013/376/regulation/2", "https://www.legislation.gov.uk/uksi/2013/376/regulation/3", + "https://www.legislation.gov.uk/uksi/2013/376/regulation/4", + "https://www.legislation.gov.uk/uksi/2013/376/regulation/5", ) def formula(benunit, period, parameters): @@ -64,12 +67,13 @@ def formula(benunit, period, parameters): return ( (~benunit("is_couple", period) | claims_as_single_person) & (renter_age < p.shared_accommodation_age_threshold) - # Para 28(3)-(4). A Housing Benefit young person who is not a - # Universal Credit qualifying young person is a non-dependant - # (para 9), which the household composition proxy does not - # identify; either way the renter is not a specified renter. + # Para 28(3)-(4): responsibility for a child or qualifying young + # person under UC regs 4 and 5, and the para 9 non-dependant. A + # Housing Benefit young person who is not a Universal Credit + # qualifying young person is a non-dependant (para 9(2)), which + # lha_renter_has_non_dependant counts. & ~benunit( - "is_responsible_for_child_or_young_person_for_uc_or_housing_benefit", + "is_responsible_for_child_or_qualifying_young_person_for_universal_credit", period, ) & ~benunit("lha_renter_has_non_dependant", period) diff --git a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py index f7181fe776..e34c6f8c48 100644 --- a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py +++ b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py @@ -4,28 +4,22 @@ class is_responsible_for_child_or_young_person_for_uc_or_housing_benefit(Variable): """Responsible for a child or young person under UC or Housing Benefit rules. + A union of the two schemes' tests that no formula reads. UC counts a + child or qualifying young person (UC Regs 2013 regs 4-5); Housing Benefit + counts a child or young person, whose young-person test follows Child + Benefit (HB Regs 2006 regs 2, 19). Each scheme's rules read its own test: Universal Credit's LHA shared accommodation test - (is_lha_shared_accommodation_rate_specified_renter) reads this. UC counts - a child or qualifying young person (UC Regs 2013 regs 4-5); Housing - Benefit counts a child or young person, whose young-person test follows - Child Benefit (HB Regs 2006 regs 2, 19). A Housing Benefit young person - who is not a UC qualifying young person is, under UC, a non-dependant - (UC Sch 4 para 9), which the household composition proxy - (lha_renter_has_non_dependant) does not identify. Either way the renter - is not limited to the shared accommodation rate (UC Sch 4 para - 28(3)-(4)), so the UC test reads responsibility under either scheme. - Housing Benefit's own test does not read this: housing_benefit_LHA_category - reads is_housing_benefit_young_individual (is_single_person and age) and - housing_benefit_has_non_dependant (HB reg 13D(2)(a)(i)). The benefit - cap rates, where a non-dependant does not matter, read each scheme's own - responsibility test. + (is_lha_shared_accommodation_rate_specified_renter) reads + is_responsible_for_child_or_qualifying_young_person_for_universal_credit + (UC Sch 4 para 28(3)), and counts a Housing Benefit young person who is + not a UC qualifying young person as a non-dependant + (lha_renter_has_non_dependant; para 28(4)). Housing Benefit's test, + housing_benefit_LHA_category, reads is_housing_benefit_young_individual + and housing_benefit_has_non_dependant (HB reg 13D(2)(a)(i)). The benefit + cap rates read each scheme's own responsibility test. - The UC test includes reg 5(1)(a), which makes a 16-year-old a qualifying - young person until the 1 September after their 16th birthday, whatever - their education. Housing Benefit's young person follows Child Benefit, - whose school-leaver rules (Child Benefit (General) Regulations 2006 regs 4, - 5 and 7) are not modelled, so a 16-year-old in the benefit unit who is not - a claimant or partner also counts here for the year. + The union also counts every 16-year-old in the benefit unit who is not a + claimant or partner, for the year. """ value_type = bool diff --git a/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py index d792dfa077..5f223417ee 100644 --- a/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py +++ b/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py @@ -9,8 +9,10 @@ class lha_renter_has_non_dependant(Variable): entity = BenUnit label = "LHA renter has a non-dependant (Universal Credit)" documentation = ( - "Universal Credit: someone in this benefit unit who is neither a " - "claimant or partner nor a child or young person, or, for the claim " + "Universal Credit: someone in this benefit unit who is a Universal " + "Credit non-dependant (is_benefit_unit_non_dependant_for_universal_credit: " + "aged 16 or over and neither the claimant or partner, a qualifying " + "young person nor the renter's foster child), or, for the claim " "that counts the household's non-dependants (see " "uc_non_dependants_counted), anyone that claim treats as a " "non-dependant from another family (see other_family_non_dependants). " @@ -27,35 +29,35 @@ class lha_renter_has_non_dependant(Variable): "tenants and other " "sharers of the rent, boarders and lodgers are not non-dependants, and " "the flag leaves out a child or qualifying young person no one in the " - "renter's extended benefit unit is responsible for (para 9(2)(g)). A " - "child or young person placed with the family as a foster child or " - "for adoption is not the renter's non-dependant. Housing Benefit uses " + "renter's extended benefit unit is responsible for (para 9(2)(g)). " + "The test uses Universal Credit's own qualifying young person (reg " + "5), not Housing Benefit's or a rule for every 16-year-old: a Child " + "Benefit young person past the Universal Credit terminal date is a " + "non-dependant here. Housing Benefit uses " "housing_benefit_has_non_dependant." ) definition_period = YEAR reference = ( "https://www.legislation.gov.uk/uksi/2013/376/schedule/4/paragraph/9", "https://www.legislation.gov.uk/uksi/2013/376/schedule/4/paragraph/28", - "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", - "https://www.legislation.gov.uk/uksi/2006/213/regulation/21", + "https://www.legislation.gov.uk/uksi/2013/376/regulation/2", + "https://www.legislation.gov.uk/uksi/2013/376/regulation/5", ) def formula(benunit, period, parameters): person = benunit.members - claimant_or_partner = person("is_claimant_or_partner", period) - # A child or young person under either scheme (UC reg 5; HB reg 19) - # is a dependant, not a non-dependant. - age = person("age", period) - # A foster child or a child placed for adoption is not a - # non-dependant either (UC Sch 4 para 9(2)(c) and (g); HB reg 3(2)(c) - # and reg 21(3)). - child_or_qyp = ( - person("is_child_or_qualifying_young_person_for_universal_credit", period) - | person("is_child_or_young_person_for_legacy_benefits", period) - | person("is_child_or_young_person_placed_with_family", period) - | ((age >= 16) & (age < 17)) + # UC Regs 2013 Sch 4 para 9(1)(c) and (2)(a)-(d), (g): a member of the + # renter's benefit unit aged 16 or over who is neither the claimant or + # partner, a qualifying young person (reg 5) nor the renter's foster + # child (para 9(2)(c), (3)). There is no separate rule for + # 16-year-olds: one outside reg 5 is a non-dependant (para 28(4)), and + # one within it is a qualifying young person the renter is + # responsible for (para 28(3)) unless no one in the extended benefit + # unit is (para 9(2)(g)), so outside that case the renter is not a + # specified renter either way. + within_benefit_unit = benunit.any( + person("is_benefit_unit_non_dependant_for_universal_credit", period) ) - within_benefit_unit = benunit.any(~claimant_or_partner & ~child_or_qyp) # UC Regs 2013 Sch 4 para 28(4): "no person is a non-dependant in # relation to the renter". The people from other families whom the # counting claim treats as its non-dependants are those whose From 8630436da375e1ccafe6ac08f4c8d64359588d01 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 09:47:15 -0500 Subject: [PATCH 11/22] Drop the 16-year-old rule from the HB shared-rate non-dependant test HB Regs 2006 reg 13D(2)(a)(i) gives the shared accommodation rate to a young individual "who has no non-dependant residing with him". Reg 3(1) makes a non-dependant anyone who normally resides with the claimant except those in reg 3(2): (a) a member of the claimant's family, whose young person is the Child Benefit one (reg 19), and (c) a child or young person placed with the claimant (reg 21(3)). No provision makes every 16-year-old a dependant for the year, yet housing_benefit_has_non_dependant's in-unit part treated one as such. A 16-year-old outside the Child Benefit young person test was then neither in the claimant's family (so the claimant was a single claimant) nor a non-dependant, and a young claimant living with them got the shared rate. The in-unit part now reads is_benefit_unit_non_dependant_for_legacy_benefits (not the claimant or partner, not a Child Benefit child or qualifying young person, which takes in placed children, and not the household head or a member paying the head as a boarder or lodger), the definition housing_benefit_non_dep_deductions already uses for in-unit non-dependants. The other-family part, #2035's per-joint-occupier attribution (non_dependants_residing_with), is unchanged. Rebuilds part of PolicyEngine/policyengine-uk#2030 (c51820e06) on #2035. Co-Authored-By: Claude Opus 5.5 --- .../housing_benefit_has_non_dependant.py | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py index 1e14db7a87..982cdf9379 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py @@ -9,9 +9,12 @@ class housing_benefit_has_non_dependant(Variable): entity = BenUnit label = "Has a non-dependant residing with them (Housing Benefit)" documentation = ( - "Someone in this benefit unit who is neither a claimant or partner " - "nor a child or young person (including one placed with the family " - "as a foster child or for adoption), or, for a family liable for the " + "Someone in this benefit unit who is a Housing Benefit non-dependant " + "(is_benefit_unit_non_dependant_for_legacy_benefits: neither a " + "claimant or partner nor a child or young person, including one " + "placed with the family as a foster child or for adoption; a " + "16-year-old outside the Child Benefit young person test is one), " + "or, for a family liable for the " "household's rent (the household head's or a sharer's), anyone in " "the household who is a non-dependant (see " "is_non_dependant_of_household_head) and normally resides with it. " @@ -33,18 +36,18 @@ class housing_benefit_has_non_dependant(Variable): def formula(benunit, period, parameters): # HB Regs 2006 reg 3(1)-(2), (4) and reg 74(5). person = benunit.members - claimant_or_partner = person("is_claimant_or_partner", period) - age = person("age", period) - # Reg 3(2)(c): a child or young person living with the claimant who - # is not a member of the household by virtue of reg 21, such as one - # placed with the claimant or partner as a foster child or for - # adoption (reg 21(3)), is not a non-dependant. - child_or_young_person = ( - person("is_child_or_young_person_for_legacy_benefits", period) - | person("is_child_or_young_person_placed_with_family", period) - | ((age >= 16) & (age < 17)) + # Reg 3(2)(a) and (c) with regs 19 and 21(3): a member of the benefit + # unit who is neither the claimant or partner nor a child or young + # person, whether in the claimant's family or placed with the + # claimant or partner. The young person test is Child Benefit's (reg + # 19), with no separate rule for 16-year-olds: one outside it is a + # non-dependant, and one within it who is not placed makes the + # claimant a lone parent rather than a single claimant (reg 2(1)), so + # either way the claimant is not a young individual with no + # non-dependant (reg 13D(2)(a)(i)). + within_benefit_unit = benunit.any( + person("is_benefit_unit_non_dependant_for_legacy_benefits", period) ) - within_benefit_unit = benunit.any(~claimant_or_partner & ~child_or_young_person) liable_family = benunit.any(person("is_liable_for_household_rent", period)) # Reg 3(1), (2)(d) and (4): a non-dependant of several joint # occupiers resides with each of them (LHA Guidance Manual paras From e472a4f91566cf2f058f5a98b694b97eea3806a3 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 09:48:41 -0500 Subject: [PATCH 12/22] Test the shared-rate non-dependant condition under each scheme LHA_shared_accommodation_non_dependants.yaml has nine cases with each scheme's flag, responsibility and category: a 16-year-old in education and one outside both young person tests; a 19-year-old past the UC terminal date (a UC non-dependant, an HB young person); a looked-after 17-year-old in education and one who has left (a UC foster child, an HB non-dependant); a foster child under 16; a joint tenant's adult son; a lodger's adult son; and a looked-after 16-year-old school leaver. The 16-year-old cases set is_before_first_september_following_16th_birthday to false for everyone, so neither UC reg 5(1)(a) nor Child Benefit (General) Regs 2006 reg 4 holds. The joint tenant's son follows #2035's attribution: he counts for his own family only in housing_benefit_has_non_dependant, while housing_benefit_non_dep_deductions apportions his deduction to both joint occupiers (reg 74(5)). The case pins both. HB regs 3(1) and (4) give one residence test for both, so this is left as an open question rather than changed here. test_lha_shared_rate_non_dependant_properties.py states four invariants. The deduction-implies-non-dependant invariant excepts, for HB, a joint occupier charged part of another joint occupier's in-unit non-dependant (the same split), and an example pins it. The UC and HB person-level definitions agree below 19 except for a looked-after person, whom UC's person-level definition already leaves out as a foster child. The generator draws whether a 16-year-old is before the 1 September after their 16th birthday and whether a 19-year-old is before the UC terminal date. The existing UC flag expectations in LHA_claimant_composition.yaml and rent_of_sharers_boarders_and_lodgers.yaml gain the matching HB flag; the two schemes agree in each. Rebuilds PolicyEngine/policyengine-uk#2030's tests (0b99784c9, ba6e55459, f71697e3b) on #2035. Co-Authored-By: Claude Opus 5.5 --- .../lha-sar-non-dep-per-scheme.fixed.md | 1 + .../family/LHA_claimant_composition.yaml | 9 + ...A_shared_accommodation_non_dependants.yaml | 351 ++++++++++++++++ .../rent_of_sharers_boarders_and_lodgers.yaml | 1 + ...ha_shared_rate_non_dependant_properties.py | 383 ++++++++++++++++++ 5 files changed, 745 insertions(+) create mode 100644 changelog.d/lha-sar-non-dep-per-scheme.fixed.md create mode 100644 policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml create mode 100644 policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py diff --git a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md new file mode 100644 index 0000000000..92c56e3857 --- /dev/null +++ b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md @@ -0,0 +1 @@ +- The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`lha_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml index e1f7891896..16a52fa7a1 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml @@ -14,6 +14,7 @@ is_claimant_or_partner: true is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: true # Single; 17 < 35; no dependant or non-dependant: A (previously B). LHA_category: A @@ -25,6 +26,7 @@ age: 30 output: lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: true # Single; 30 < 35; no other occupants: A. LHA_category: A @@ -70,6 +72,7 @@ output: is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false lha_renter_has_non_dependant: true + housing_benefit_has_non_dependant: true is_lha_shared_accommodation_rate_specified_renter: false # No UC QYP (UC Regs 2013 reg 5(3): training under a contract of # employment does not count), but a non-dependant blocks A. The @@ -100,6 +103,7 @@ is_couple: false is_responsible_for_child_or_qualifying_young_person_for_universal_credit: true lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: false # Responsibility for a UC QYP blocks A. The QYP has a bedroom (Sch 4 # para 10(1)(b)): 1 + 1 = 2: C. @@ -129,6 +133,7 @@ is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false # The partner is not a non-dependant (UC Sch 4 para 9(2)(b)). lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: false # The partner is under 18 with no reg. 8 circumstance, so the renter # claims as a single person (UC Regs 2013 reg. 3(3)(a)) and is "a member # of a couple claiming as a single person" under 35 (Sch 4 para 28(2); @@ -188,6 +193,7 @@ members: [renter, apprentice] output: lha_renter_has_non_dependant: [true, false] + housing_benefit_has_non_dependant: [true, false] is_lha_shared_accommodation_rate_specified_renter: [false, true] # The renter (the household head, the elder) has the apprentice as a # non-dependant: 1 + 1 non-dependant aged 16+ = 2: C. Only the household @@ -215,6 +221,7 @@ members: [renter, student_claimant] output: lha_renter_has_non_dependant: [true, false] + housing_benefit_has_non_dependant: [true, false] # The other family's claimant is the household head's non-dependant even # if their age and education meet the QYP test: 1 + 1 = 2: C. The # student's own family has no non-dependant: A. @@ -241,6 +248,7 @@ output: eldest_claimant_or_partner_age: [30, 40] lha_renter_has_non_dependant: [false, false] + housing_benefit_has_non_dependant: [false, false] # A person liable on a commercial basis for their occupation is not a # non-dependant (UC Sch 4 para 9(2)(d)), so neither family adds a bedroom # to the other. Renter: single, 30 < 35, no non-dependant: A. Household @@ -267,6 +275,7 @@ members: [other_renter] output: lha_renter_has_non_dependant: [false, false] + housing_benefit_has_non_dependant: [false, false] # Single, 30 < 35, nobody else in this household: A. # Other renter 40 >= 35; 1 bedroom: B. LHA_category: [A, B] diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml new file mode 100644 index 0000000000..375ea5566f --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -0,0 +1,351 @@ +# The non-dependant condition of the LHA shared accommodation rate, by scheme. +# +# Universal Credit: a specified renter has "no person [who] is a non-dependant +# in relation to the renter" (UC Regs 2013 Sch 4 para 28(4)), using para 9 and +# the UC qualifying young person (reg 5). The renter must also not be +# responsible for a child or qualifying young person (para 28(3)). +# +# Housing Benefit: the shared rate applies to "a young individual who has no +# non-dependant residing with him" (HB Regs 2006 reg 13D(2)(a)(i)), using reg 3 +# and the Child Benefit young person (reg 19). A young individual is a single +# claimant, so not a lone parent responsible for a child or young person +# (reg 2(1)). +# +# A 16-year-old is a dependant only within each scheme's young person test. +# Outside it, they are a non-dependant. Either way the renter misses the shared +# rate. The cases with a 16-year-old outside both tests set +# is_before_first_september_following_16th_birthday to false for every person, +# so that neither UC reg 5(1)(a) nor Child Benefit (General) Regs 2006 reg 4 +# holds. +# +# Bedrooms: everyone aged 16 or over other than the claimant or partner has a +# bedroom (UC Sch 4 para 10(1)(b)-(c); HB reg 13D(3)(b)), so 1 + 1 = 2: C. + +- name: A 16-year-old who has left education is a non-dependant under both schemes + period: 2026 + input: + people: + parent: + age: 33 + is_household_head: true + is_claimant_or_partner: true + is_before_first_september_following_16th_birthday: false + son: + age: 16 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + is_before_first_september_following_16th_birthday: false + benunits: + family: + members: [parent, son] + households: + home: + members: [parent, son] + output: + is_benefit_unit_non_dependant_for_universal_credit: [false, true] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, true] + # UC: not a qualifying young person, so a non-dependant (para 9(2)). + is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false + lha_renter_has_non_dependant: true + is_lha_shared_accommodation_rate_specified_renter: false + LHA_category: C + # HB: not a Child Benefit qualifying young person, so the parent is a + # single claimant under 35, but the son is a non-dependant residing with + # them: not 13D(2)(a)(i), and 2 bedrooms: C. + is_single_person: true + is_housing_benefit_young_individual: true + housing_benefit_has_non_dependant: true + housing_benefit_LHA_category: C + +- name: A 16-year-old in full-time education is a dependant under both schemes + period: 2026 + input: + people: + parent: + age: 33 + is_household_head: true + is_claimant_or_partner: true + son: + age: 16 + is_claimant_or_partner: false + current_education: UPPER_SECONDARY + benunits: + family: + members: [parent, son] + households: + home: + members: [parent, son] + output: + is_benefit_unit_non_dependant_for_universal_credit: [false, false] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] + # UC: responsible for a qualifying young person (para 28(3)). + is_responsible_for_child_or_qualifying_young_person_for_universal_credit: true + lha_renter_has_non_dependant: false + is_lha_shared_accommodation_rate_specified_renter: false + LHA_category: C + # HB: a lone parent, not a single claimant, so not a young individual. + is_single_person: false + is_housing_benefit_young_individual: false + housing_benefit_has_non_dependant: false + housing_benefit_LHA_category: C + +- name: A 19-year-old past the UC terminal date is a UC non-dependant but an HB young person + period: 2026 + input: + people: + parent: + age: 34 + is_household_head: true + is_claimant_or_partner: true + daughter: + age: 19 + is_claimant_or_partner: false + current_education: POST_SECONDARY + age_started_or_accepted_current_education_or_training: 18 + is_before_universal_credit_qualifying_young_person_terminal_date: false + benunits: + family: + members: [parent, daughter] + households: + home: + members: [parent, daughter] + output: + # UC reg 5(1)(b): a qualifying young person only up to the 1 September + # after the 19th birthday, which has passed: a non-dependant. + is_benefit_unit_non_dependant_for_universal_credit: [false, true] + is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false + lha_renter_has_non_dependant: true + is_lha_shared_accommodation_rate_specified_renter: false + LHA_category: C + # Child Benefit (General) Regs 2006 reg 3(4): in non-advanced education + # begun before 19, so a young person (HB reg 19) in the parent's family: + # not a non-dependant (reg 3(2)(a)), but the parent is a lone parent. + is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] + housing_benefit_has_non_dependant: false + is_single_person: false + is_housing_benefit_young_individual: false + housing_benefit_LHA_category: C + +- name: A looked-after 17-year-old in education placed with a renter is not a non-dependant + period: 2026 + input: + people: + renter: + age: 28 + is_household_head: true + is_claimant_or_partner: true + placed: + age: 17 + is_claimant_or_partner: false + current_education: POST_SECONDARY + is_looked_after_by_local_authority: true + benunits: + family: + members: [renter, placed] + households: + home: + members: [renter, placed] + output: + # UC: a qualifying young person no one is responsible for (reg 4(6)(a)) + # is not a non-dependant (Sch 4 para 9(2)(g)). The renter is a foster + # parent, so excepted from the shared rate anyway (para 29(9A)). + is_child_or_young_person_placed_with_family: [false, true] + is_benefit_unit_non_dependant_for_universal_credit: [false, false] + is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false + lha_renter_has_non_dependant: false + lha_renter_meets_foster_parent_condition: true + is_lha_shared_accommodation_rate_specified_renter: false + # HB: a young person placed by a local authority is not a member of the + # household (reg 21(3)(a)) and not a non-dependant (reg 3(2)(c)). + is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] + housing_benefit_has_non_dependant: false + +- name: A looked-after 17-year-old who has left education is a UC foster child but an HB non-dependant + period: 2026 + input: + people: + renter: + age: 28 + is_household_head: true + is_claimant_or_partner: true + placed: + age: 17 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + is_looked_after_by_local_authority: true + benunits: + family: + members: [renter, placed] + households: + home: + members: [renter, placed] + output: + # UC: not a qualifying young person, but a looked-after person under 18 + # placed with the renter, so the renter's foster child (para 9(3), with + # the foster parent definition in reg 2) and not a non-dependant (para + # 9(2)(c); is_lha_foster_child). This is the model's reading; the WRA + # 2012 s.40 definition of a child (under 16) would make them a + # non-dependant. HB: not a young person (reg 19), so reg 21(3) and reg + # 3(2)(c) do not apply: a non-dependant. + is_lha_foster_child: [false, true] + is_child_or_young_person_placed_with_family: [false, false] + is_benefit_unit_non_dependant_for_universal_credit: [false, false] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, true] + lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: true + +- name: A foster child under 16 is a non-dependant under neither scheme + period: 2026 + input: + people: + renter: + age: 28 + is_household_head: true + is_claimant_or_partner: true + foster_child: + age: 9 + is_claimant_or_partner: false + is_looked_after_by_local_authority: true + benunits: + family: + members: [renter, foster_child] + households: + home: + members: [renter, foster_child] + output: + # UC Sch 4 para 9(2)(c); HB reg 3(2)(c) with reg 21(3)(a). + is_benefit_unit_non_dependant_for_universal_credit: [false, false] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] + lha_renter_has_non_dependant: false + housing_benefit_has_non_dependant: false + +- name: A joint tenant's adult son counts for that tenant only in the HB shared rate test and in one UC claim + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 45 + is_household_head: true + is_claimant_or_partner: true + son: + age: 22 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + household_benefits_individual_non_dep_deduction: 400 + sharer: + age: 28 + is_claimant_or_partner: true + benunits: + head_family: + members: [head, son] + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + households: + home: + members: [head, son, sharer] + rent: 18_000 + tenure_type: RENT_PRIVATELY + output: + # UC: the son is the head's non-dependant and already counted in the + # head's claim, so not the sharer's (Sch 4 para 9(2)(f)). The sharer is a + # specified renter: A. Head: 1 + son = 2: C. + lha_renter_has_non_dependant: [true, false] + is_lha_shared_accommodation_rate_specified_renter: [false, true] + LHA_category: [C, A] + # HB: housing_benefit_has_non_dependant counts a non-dependant within a + # joint occupier's own benefit unit for that occupier only; the + # non_dependant_normally_resides_with input covers other families' + # non-dependants, not his. So the sharer, a single claimant under 35, is + # a young individual with no non-dependant residing with them: 13D(2)(a)(i) + # gives A. Head: 2 bedrooms: C. + housing_benefit_has_non_dependant: [true, false] + is_housing_benefit_young_individual: [false, true] + housing_benefit_LHA_category: [C, A] + # The deduction formula instead treats him as every joint occupier's and + # apportions his deduction by the shares of the rent (reg 74(5)): half + # of 400 each. Reg 3(1) and (4) give one residence test for both, so + # this split is an open question (whether he normally resides with the + # sharer is a question of fact the model has no input for). + housing_benefit_non_dep_deductions: [200, 200] + +- name: A lodger's adult son is the householder's HB non-dependant but counts in the lodger's UC claim + period: 2026 + input: + people: + householder: + age: 30 + is_household_head: true + is_claimant_or_partner: true + lodger: + age: 35 + is_claimant_or_partner: true + rent_paid_as_lodger: 5_200 + lodger_son: + age: 22 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + benunits: + householder_family: + members: [householder] + lodger_family: + members: [lodger, lodger_son] + households: + home: + members: [householder, lodger, lodger_son] + rent: 9_000 + tenure_type: RENT_PRIVATELY + output: + # UC: the lodger is liable on a commercial basis (Sch 4 para 9(2)(d)); + # the son is a non-dependant in the lodger's claim, so not the + # householder's (para 9(2)(f)). The householder is a specified renter: A. + lha_renter_has_non_dependant: [false, true] + is_lha_shared_accommodation_rate_specified_renter: [true, false] + # HB: reg 3(2)(e)(i) excludes only the lodger, who pays the householder, + # so the son resides with the householder as a non-dependant (reg 3(1), + # (4)), and with the lodger as a member of their benefit unit outside + # their family. The householder is a young individual, but not one with + # no non-dependant (13D(2)(a)(i)). + housing_benefit_has_non_dependant: [true, true] + is_housing_benefit_young_individual: [true, false] + +- name: A looked-after 16-year-old school leaver stops a young single HB claimant's shared rate + period: 2026 + input: + people: + claimant: + age: 30 + is_household_head: true + is_claimant_or_partner: true + is_before_first_september_following_16th_birthday: false + placed: + age: 16 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + is_looked_after_by_local_authority: true + is_before_first_september_following_16th_birthday: false + benunits: + family: + members: [claimant, placed] + households: + home: + members: [claimant, placed] + rent: 10_400 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # HB: not a Child Benefit qualifying young person, so neither in the + # claimant's family nor placed under reg 21(3): a non-dependant (reg 3). + # The claimant is a young individual with a non-dependant, so not + # 13D(2)(a)(i); 2 bedrooms (13D(3)(b)): C. + is_child_or_young_person_placed_with_family: [false, false] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, true] + housing_benefit_has_non_dependant: true + is_housing_benefit_young_individual: true + housing_benefit_LHA_category: C + # UC: the renter's foster child (para 9(2)(c)), and the renter meets the + # foster parent condition (para 29(9A)): not a specified renter. + is_lha_foster_child: [false, true] + lha_renter_has_non_dependant: false + is_lha_shared_accommodation_rate_specified_renter: false diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml index 0e02c834d3..f66549fc1f 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml @@ -247,6 +247,7 @@ output: # UC Sch 4 para 28(4): no person is a non-dependant of the householder. lha_renter_has_non_dependant: [false, false] + housing_benefit_has_non_dependant: [false, false] is_lha_shared_accommodation_rate_specified_renter: [true, false] LHA_category: [A, B] # HB reg 13D(2)(a)(i): a young individual with no non-dependant: A. diff --git a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py new file mode 100644 index 0000000000..d02d75e9f7 --- /dev/null +++ b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py @@ -0,0 +1,383 @@ +"""Property-based tests for the shared accommodation rate's non-dependant +condition, which each scheme applies with its own definitions: + +- Universal Credit: UC Regs 2013 Sch 4 para 28(3)-(4), with para 9 and regs + 4-5 (lha_renter_has_non_dependant). +- Housing Benefit: HB Regs 2006 reg 13D(2)(a)(i), with regs 2(1), 3 and 19 + (housing_benefit_has_non_dependant). + +Invariants, for any generated population of households: + +1. UC: a member of the renter's benefit unit aged 16 or over, other than the + claimant or partner, who is not looked after by a local authority stops the + renter being a specified renter. They are either a qualifying young person + the renter is responsible for (para 28(3)) or a non-dependant (para + 28(4)), so the shared rate never depends on which. +2. HB: such a member who is not placed with the family stops the claimant + being a young individual with no non-dependant: they are either a young + person in the claimant's family, making the claimant a lone parent rather + than a single claimant (reg 2(1)), or a non-dependant (reg 3). +3. Deductions imply a non-dependant: a family charged a UC or HB + non-dependant deduction has a non-dependant under that scheme's test. + One exception, for HB: a joint occupier charged part of the deduction for + a non-dependant within another joint occupier's own benefit unit, such + as that occupier's adult son. housing_benefit_non_dep_deductions treats + him as every joint occupier's and apportions his deduction (reg 74(5)), + while housing_benefit_has_non_dependant counts him for his own family + only (see outside_joint_occupiers). HB regs 3(1) and (4) give one + residence test for both, so the split is an open question; + test_the_examples_decide_each_invariant pins it. +4. Agreement below 19: for a member under 19 who is not the claimant or + partner, the UC and HB person-level non-dependant definitions agree, + except for a person a local authority looks after. They differ from 19, + when UC's qualifying young person ends at the 1 September after the 19th + birthday (reg 5(1)(b)) and Child Benefit's does not (Child Benefit + (General) Regs 2006 reg 3(4)). A looked-after 16- or 17-year-old outside + the young person tests is the renter's foster child under UC, so not a + non-dependant (Sch 4 para 9(2)(c); is_lha_foster_child), but an HB + non-dependant, since HB reg 3(2)(c) with reg 21(3) covers only a child or + young person. + +The generator concentrates members' ages around 16 to 20, where the schemes' +definitions differ, draws whether a 16-year-old is before the 1 September +after their 16th birthday (UC reg 5(1)(a); Child Benefit (General) Regs 2006 +reg 4), and explicit examples pin the cases that decide each invariant. +""" + +import numpy as np +from hypothesis import HealthCheck, example, given, settings +from hypothesis import strategies as st + +from policyengine_uk import Simulation + +# Situation inputs without a period key are set for 2025. +YEAR = 2025 +PROPERTY_SETTINGS = settings( + max_examples=15, + deadline=None, + derandomize=True, + suppress_health_check=[HealthCheck.too_slow, HealthCheck.data_too_large], +) +EDUCATION = ["NOT_IN_EDUCATION", "UPPER_SECONDARY", "POST_SECONDARY", "TERTIARY"] +EARNINGS = [0.0, 15_000.0, 30_000.0] + + +@st.composite +def member(draw): + age = draw(st.one_of(st.integers(15, 20), st.integers(0, 40))) + return dict( + age=age, + education=draw(st.sampled_from(EDUCATION)), + looked_after=age < 18 and draw(st.booleans()), + placed_for_adoption=age < 18 and draw(st.booleans()), + # UC reg 5(1)(a) and Child Benefit reg 4: a 16-year-old may be in or + # past the route to the 1 September after their 16th birthday. + before_first_september=age == 16 and draw(st.booleans()), + # UC reg 5(1)(b): a 19-year-old may be before or past the 1 September + # after their 19th birthday. + before_uc_terminal_date=age != 19 or draw(st.booleans()), + started_education_at=draw(st.integers(14, 19)), + earnings=draw(st.sampled_from(EARNINGS)), + ) + + +@st.composite +def household(draw): + return dict( + # The renter's family holds the household's oldest member, so it is + # the household head's family. + renter_age=draw(st.one_of(st.integers(18, 34), st.integers(41, 60))), + partner=draw(st.sampled_from([False, False, True])), + members=draw(st.lists(member(), min_size=0, max_size=2)), + # Another family: none, a non-dependant family, a joint tenant (liable + # for a share of the rent) or a lodger. + other=draw(st.sampled_from([None, "non_dependant", "sharer", "lodger"])), + other_age=draw(st.integers(18, 39)), + other_earnings=draw(st.sampled_from(EARNINGS)), + other_members=draw(st.lists(member(), min_size=0, max_size=1)), + ) + + +population = st.lists(household(), min_size=1, max_size=6) + + +def _member( + age, + education="NOT_IN_EDUCATION", + started=14, + earnings=0.0, + before_uc_terminal_date=True, +): + return dict( + age=age, + education=education, + looked_after=False, + placed_for_adoption=False, + before_first_september=False, + before_uc_terminal_date=before_uc_terminal_date, + started_education_at=started, + earnings=earnings, + ) + + +def _house(renter_age, members, other=None, other_age=30, other_members=()): + return dict( + renter_age=renter_age, + partner=False, + members=members, + other=other, + other_age=other_age, + other_earnings=30_000.0, + other_members=list(other_members), + ) + + +# A young single renter with a 16-year-old who has left education: a +# non-dependant under both schemes (invariants 1 and 2). +SCHOOL_LEAVER = [_house(30, [_member(16)])] +# A young single renter with a 19-year-old in non-advanced education begun at +# 18, past the UC terminal date: a UC non-dependant, an HB young person +# (invariants 1, 2 and 4). +NINETEEN_IN_EDUCATION = [ + _house(30, [_member(19, "POST_SECONDARY", 18, before_uc_terminal_date=False)]) +] +# A non-dependant family with earnings, a joint tenant sharing the rent, and +# an earning adult son in the head's own family (invariant 3). +SHARED_HOUSE = [ + _house(45, [], other="non_dependant", other_age=30), + _house(50, [_member(25, earnings=30_000.0)], other="sharer", other_age=28), +] + + +def build(population): + people, benunits, homes = {}, {}, {} + rows = [] + for h, house in enumerate(population): + names = [] + renter_age = house["renter_age"] + families = [ + dict( + name=f"h{h}_renter", + adults=[renter_age] + ([renter_age] if house["partner"] else []), + earnings=0.0, + members=house["members"], + head=True, + role=None, + ) + ] + if house["other"] is not None: + # Younger than the renter, so not the household head. + families.append( + dict( + name=f"h{h}_other", + adults=[min(house["other_age"], renter_age - 1)], + earnings=house["other_earnings"], + members=house["other_members"], + head=False, + role=house["other"], + ) + ) + for fam in families: + ids = [] + for i, age in enumerate(fam["adults"]): + pid = f"{fam['name']}_adult_{i}" + people[pid] = { + "age": age, + "is_claimant_or_partner": True, + "is_household_head": fam["head"] and i == 0, + "current_education": "NOT_IN_EDUCATION", + "employment_income": fam["earnings"] if i == 0 else 0.0, + "is_before_first_september_following_16th_birthday": False, + "is_before_universal_credit_qualifying_young_person_terminal_date": True, + } + if fam["role"] == "lodger": + people[pid]["rent_paid_as_lodger"] = 4_000.0 if i == 0 else 0.0 + ids.append(pid) + for i, m in enumerate(fam["members"]): + pid = f"{fam['name']}_member_{i}" + people[pid] = { + "age": m["age"], + "is_claimant_or_partner": False, + "is_household_head": False, + "current_education": m["education"], + "is_looked_after_by_local_authority": m["looked_after"], + "is_placed_for_adoption": m["placed_for_adoption"] + and not m["looked_after"], + "age_started_or_accepted_current_education_or_training": m[ + "started_education_at" + ], + "employment_income": m["earnings"], + "is_before_first_september_following_16th_birthday": m[ + "before_first_september" + ], + "is_before_universal_credit_qualifying_young_person_terminal_date": m[ + "before_uc_terminal_date" + ], + } + ids.append(pid) + benunits[fam["name"]] = {"members": ids} + if fam["role"] == "sharer": + benunits[fam["name"]]["liable_for_share_of_household_rent"] = True + rows.append(dict(name=fam["name"], head=fam["head"], ids=ids)) + names += ids + homes[f"h{h}"] = { + "members": names, + "rent": 9_000.0, + "tenure_type": "RENT_PRIVATELY", + } + situation = {"people": people, "benunits": benunits, "households": homes} + return Simulation(situation=situation), people, rows + + +def calc(sim, variable): + return np.asarray(sim.calculate(variable, YEAR)) + + +@PROPERTY_SETTINGS +@given(population) +@example(SCHOOL_LEAVER) +@example(NINETEEN_IN_EDUCATION) +def test_shared_rate_never_depends_on_how_a_member_aged_16_or_over_is_classed(pop): + sim, people, rows = build(pop) + specified = calc(sim, "is_lha_shared_accommodation_rate_specified_renter") + hb_young_individual = calc(sim, "is_housing_benefit_young_individual") + hb_has_non_dependant = calc(sim, "housing_benefit_has_non_dependant") + placed = dict(zip(people, calc(sim, "is_child_or_young_person_placed_with_family"))) + for i, row in enumerate(rows): + others = [ + p + for p in row["ids"] + if not people[p]["is_claimant_or_partner"] and people[p]["age"] >= 16 + ] + # Invariant 1. + if any(not people[p]["is_looked_after_by_local_authority"] for p in others): + assert not specified[i], row["name"] + # Invariant 2. + if any(not placed[p] for p in others): + assert not (hb_young_individual[i] and not hb_has_non_dependant[i]), row[ + "name" + ] + + +def shares_another_joint_occupiers_own_non_dependant(sim, people, rows): + """For each family, whether it is a joint occupier in a household where + another joint occupier's benefit unit holds an HB non-dependant: the + exception to invariant 3 for HB.""" + share = calc(sim, "share_of_household_rent") + in_unit = dict( + zip(people, calc(sim, "is_benefit_unit_non_dependant_for_legacy_benefits")) + ) + house = [row["name"].split("_")[0] for row in rows] + return [ + share[i] > 0 + and any( + j != i + and house[j] == house[i] + and share[j] > 0 + and any(in_unit[p] for p in rows[j]["ids"]) + for j in range(len(rows)) + ) + for i in range(len(rows)) + ] + + +@PROPERTY_SETTINGS +@given(population) +@example(SHARED_HOUSE) +def test_a_non_dependant_deduction_implies_a_non_dependant(pop): + sim, people, rows = build(pop) + # Invariant 3. + uc = calc(sim, "uc_non_dep_deductions") + uc_has = calc(sim, "lha_renter_has_non_dependant") + hb = calc(sim, "housing_benefit_non_dep_deductions") + hb_has = calc(sim, "housing_benefit_has_non_dependant") + excepted = shares_another_joint_occupiers_own_non_dependant(sim, people, rows) + for i, row in enumerate(rows): + assert uc[i] <= 0 or uc_has[i], row["name"] + assert hb[i] <= 0 or hb_has[i] or excepted[i], row["name"] + + +@PROPERTY_SETTINGS +@given(population) +@example(NINETEEN_IN_EDUCATION) +def test_uc_and_hb_non_dependant_definitions_agree_below_19(pop): + sim, people, _ = build(pop) + # Invariant 4. + uc = calc(sim, "is_benefit_unit_non_dependant_for_universal_credit") + hb = calc(sim, "is_benefit_unit_non_dependant_for_legacy_benefits") + for j, (pid, p) in enumerate(people.items()): + if ( + not p["is_claimant_or_partner"] + and p["age"] < 19 + and not p.get("is_looked_after_by_local_authority", False) + ): + assert uc[j] == hb[j], pid + + +def test_the_examples_decide_each_invariant(): + """The explicit examples exercise what each invariant turns on, so a + regression in either scheme's definition cannot pass vacuously.""" + sim, people, rows = build(SCHOOL_LEAVER) + assert calc(sim, "lha_renter_has_non_dependant")[0] + assert calc(sim, "housing_benefit_has_non_dependant")[0] + assert calc(sim, "is_housing_benefit_young_individual")[0] + + sim, people, rows = build(NINETEEN_IN_EDUCATION) + assert calc(sim, "lha_renter_has_non_dependant")[0] + assert not calc( + sim, "is_responsible_for_child_or_qualifying_young_person_for_universal_credit" + )[0] + assert not calc(sim, "housing_benefit_has_non_dependant")[0] + + sim, people, rows = build(SHARED_HOUSE) + hb = calc(sim, "housing_benefit_non_dep_deductions") + uc = calc(sim, "uc_non_dep_deductions") + # Head of the first household: a non-dependant family with earnings. + assert hb[0] > 0 and uc[0] > 0 + # Head of the second household: an earning adult son in their own family. + assert hb[2] > 0 and uc[2] > 0 + # The joint tenant in that household bears part of the son's HB + # deduction but has no HB non-dependant: the exception to invariant 3, + # an open question under HB regs 3(1), (4) and 74(5). + has = calc(sim, "housing_benefit_has_non_dependant") + excepted = shares_another_joint_occupiers_own_non_dependant(sim, people, rows) + assert hb[3] > 0 and not has[3] and excepted[3] + # Only the head's claim counts him under UC (Sch 4 para 9(2)(f)). + assert uc[3] == 0 and not calc(sim, "lha_renter_has_non_dependant")[3] + + +def test_a_deduction_implies_a_non_dependant_when_a_family_has_no_claimant(): + """Invariant 3 holds for any input, including another family whose only + member is not flagged as a claimant or partner: both flags count the same + people the deduction formulas charge.""" + situation = { + "people": { + "head": { + "age": 45, + "is_claimant_or_partner": True, + "is_household_head": True, + }, + "other": { + "age": 30, + "is_claimant_or_partner": False, + "is_household_head": False, + "employment_income": 30_000.0, + }, + }, + "benunits": { + "head_family": {"members": ["head"]}, + "other": {"members": ["other"]}, + }, + "households": { + "home": { + "members": ["head", "other"], + "rent": 9_000.0, + "tenure_type": "RENT_PRIVATELY", + } + }, + } + sim = Simulation(situation=situation) + assert calc(sim, "uc_non_dep_deductions")[0] > 0 + assert calc(sim, "lha_renter_has_non_dependant")[0] + assert calc(sim, "housing_benefit_non_dep_deductions")[0] > 0 + assert calc(sim, "housing_benefit_has_non_dependant")[0] From 90c2e63ac9c2e7ded5b47977803a8208c825617c Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 09:49:26 -0500 Subject: [PATCH 13/22] Rename lha_renter_has_non_dependant to universal_credit_renter_has_non_dependant The flag has been Universal Credit's only since main gave Housing Benefit housing_benefit_has_non_dependant; the name now says so, as #2030 named it. Only the name, the label and the references change: the variable file moves with git mv, and every test and docstring that read the old name reads the new one, #2035's LHA_joint_tenants_shared_non_dependant.yaml and test_joint_tenant_shared_non_dependant_properties.py included, as does OUTPUTS in test_household_head_agreement_properties.py. This commit sits last so the hub can drop it and keep main's name. Co-Authored-By: Claude Opus 5.5 --- .../lha-sar-non-dep-per-scheme.fixed.md | 2 +- .../family/LHA_claimant_composition.yaml | 18 +++++++++--------- ...LHA_joint_tenants_shared_non_dependant.yaml | 2 +- ...ilies_children_and_additional_bedrooms.yaml | 4 ++-- ...HA_shared_accommodation_non_dependants.yaml | 18 +++++++++--------- .../family/LHA_young_person_bedroom.yaml | 2 +- .../rent_of_sharers_boarders_and_lodgers.yaml | 2 +- .../claims_as_single_person.yaml | 2 +- .../boarders_and_lodgers_non_dependants.yaml | 4 ++-- .../demographic/resolved_household_head.yaml | 4 ++-- ..._benefit_cap_lha_scheme_split_properties.py | 2 +- ...test_household_head_agreement_properties.py | 2 +- ...t_tenant_shared_non_dependant_properties.py | 2 +- ...test_lha_bedroom_young_people_properties.py | 2 +- ...lha_shared_rate_non_dependant_properties.py | 12 ++++++------ ...ared_accommodation_rate_specified_renter.py | 6 +++--- ...r_young_person_for_uc_or_housing_benefit.py | 9 +++++---- ...iversal_credit_renter_has_non_dependant.py} | 4 ++-- 18 files changed, 49 insertions(+), 48 deletions(-) rename policyengine_uk/variables/gov/dwp/{lha_renter_has_non_dependant.py => universal_credit_renter_has_non_dependant.py} (97%) diff --git a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md index 92c56e3857..32f89b9db8 100644 --- a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md +++ b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md @@ -1 +1 @@ -- The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`lha_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. +- The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`universal_credit_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. `universal_credit_renter_has_non_dependant` replaces `lha_renter_has_non_dependant`. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml index 16a52fa7a1..8bc5043acb 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_claimant_composition.yaml @@ -13,7 +13,7 @@ output: is_claimant_or_partner: true is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: true # Single; 17 < 35; no dependant or non-dependant: A (previously B). @@ -25,7 +25,7 @@ input: age: 30 output: - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: true # Single; 30 < 35; no other occupants: A. @@ -71,7 +71,7 @@ members: [renter, apprentice] output: is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false - lha_renter_has_non_dependant: true + universal_credit_renter_has_non_dependant: true housing_benefit_has_non_dependant: true is_lha_shared_accommodation_rate_specified_renter: false # No UC QYP (UC Regs 2013 reg 5(3): training under a contract of @@ -102,7 +102,7 @@ output: is_couple: false is_responsible_for_child_or_qualifying_young_person_for_universal_credit: true - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: false # Responsibility for a UC QYP blocks A. The QYP has a bedroom (Sch 4 @@ -132,7 +132,7 @@ is_couple: true is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false # The partner is not a non-dependant (UC Sch 4 para 9(2)(b)). - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: false # The partner is under 18 with no reg. 8 circumstance, so the renter # claims as a single person (UC Regs 2013 reg. 3(3)(a)) and is "a member @@ -192,7 +192,7 @@ home: members: [renter, apprentice] output: - lha_renter_has_non_dependant: [true, false] + universal_credit_renter_has_non_dependant: [true, false] housing_benefit_has_non_dependant: [true, false] is_lha_shared_accommodation_rate_specified_renter: [false, true] # The renter (the household head, the elder) has the apprentice as a @@ -220,7 +220,7 @@ home: members: [renter, student_claimant] output: - lha_renter_has_non_dependant: [true, false] + universal_credit_renter_has_non_dependant: [true, false] housing_benefit_has_non_dependant: [true, false] # The other family's claimant is the household head's non-dependant even # if their age and education meet the QYP test: 1 + 1 = 2: C. The @@ -247,7 +247,7 @@ members: [renter, other_renter] output: eldest_claimant_or_partner_age: [30, 40] - lha_renter_has_non_dependant: [false, false] + universal_credit_renter_has_non_dependant: [false, false] housing_benefit_has_non_dependant: [false, false] # A person liable on a commercial basis for their occupation is not a # non-dependant (UC Sch 4 para 9(2)(d)), so neither family adds a bedroom @@ -274,7 +274,7 @@ second_home: members: [other_renter] output: - lha_renter_has_non_dependant: [false, false] + universal_credit_renter_has_non_dependant: [false, false] housing_benefit_has_non_dependant: [false, false] # Single, 30 < 35, nobody else in this household: A. # Other renter 40 >= 35; 1 bedroom: B. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml index bbf50e0adc..051bdd3449 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml @@ -79,7 +79,7 @@ council_tax_reduction_non_dep_deductions: [150, 150, 0] # UC: Peter counts in John's claim only (Sch 4 para 9(2)(f)). LHA_allowed_bedrooms: [2, 1, 1] - lha_renter_has_non_dependant: [true, false, false] + universal_credit_renter_has_non_dependant: [true, false, false] - name: A joint tenant's sister counts only for that tenant (LHA Guidance Manual 2.093 example 2) period: 2026 diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml index ea49d91b3f..da7f183cdd 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_other_families_children_and_additional_bedrooms.yaml @@ -402,7 +402,7 @@ # non-dependant (para 9(2)(c)), but excepted as a renter who satisfies # the foster parent condition (para 29(9A)). is_responsible_for_child_or_young_person_for_uc_or_housing_benefit: false - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: false LHA_allowed_bedrooms: 2 @@ -1600,7 +1600,7 @@ # under 35, is not a specified renter (para 27): category C, not A. The # foster child is not a non-dependant of the sharer, their foster parent # (para 9(2)(c)); the sharer, aged 40, is no specified renter anyway. - lha_renter_has_non_dependant: [true, false] + universal_credit_renter_has_non_dependant: [true, false] is_lha_shared_accommodation_rate_specified_renter: [false, false] LHA_category: [C, C] # The head's £13,000 share of the rent exceeds Maidstone's two-bedroom diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml index 375ea5566f..7f9c8118ed 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -46,7 +46,7 @@ is_benefit_unit_non_dependant_for_legacy_benefits: [false, true] # UC: not a qualifying young person, so a non-dependant (para 9(2)). is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false - lha_renter_has_non_dependant: true + universal_credit_renter_has_non_dependant: true is_lha_shared_accommodation_rate_specified_renter: false LHA_category: C # HB: not a Child Benefit qualifying young person, so the parent is a @@ -80,7 +80,7 @@ is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] # UC: responsible for a qualifying young person (para 28(3)). is_responsible_for_child_or_qualifying_young_person_for_universal_credit: true - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: false LHA_category: C # HB: a lone parent, not a single claimant, so not a young individual. @@ -114,7 +114,7 @@ # after the 19th birthday, which has passed: a non-dependant. is_benefit_unit_non_dependant_for_universal_credit: [false, true] is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false - lha_renter_has_non_dependant: true + universal_credit_renter_has_non_dependant: true is_lha_shared_accommodation_rate_specified_renter: false LHA_category: C # Child Benefit (General) Regs 2006 reg 3(4): in non-advanced education @@ -152,7 +152,7 @@ is_child_or_young_person_placed_with_family: [false, true] is_benefit_unit_non_dependant_for_universal_credit: [false, false] is_responsible_for_child_or_qualifying_young_person_for_universal_credit: false - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false lha_renter_meets_foster_parent_condition: true is_lha_shared_accommodation_rate_specified_renter: false # HB: a young person placed by a local authority is not a member of the @@ -191,7 +191,7 @@ is_child_or_young_person_placed_with_family: [false, false] is_benefit_unit_non_dependant_for_universal_credit: [false, false] is_benefit_unit_non_dependant_for_legacy_benefits: [false, true] - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: true - name: A foster child under 16 is a non-dependant under neither scheme @@ -216,7 +216,7 @@ # UC Sch 4 para 9(2)(c); HB reg 3(2)(c) with reg 21(3)(a). is_benefit_unit_non_dependant_for_universal_credit: [false, false] is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false housing_benefit_has_non_dependant: false - name: A joint tenant's adult son counts for that tenant only in the HB shared rate test and in one UC claim @@ -251,7 +251,7 @@ # UC: the son is the head's non-dependant and already counted in the # head's claim, so not the sharer's (Sch 4 para 9(2)(f)). The sharer is a # specified renter: A. Head: 1 + son = 2: C. - lha_renter_has_non_dependant: [true, false] + universal_credit_renter_has_non_dependant: [true, false] is_lha_shared_accommodation_rate_specified_renter: [false, true] LHA_category: [C, A] # HB: housing_benefit_has_non_dependant counts a non-dependant within a @@ -300,7 +300,7 @@ # UC: the lodger is liable on a commercial basis (Sch 4 para 9(2)(d)); # the son is a non-dependant in the lodger's claim, so not the # householder's (para 9(2)(f)). The householder is a specified renter: A. - lha_renter_has_non_dependant: [false, true] + universal_credit_renter_has_non_dependant: [false, true] is_lha_shared_accommodation_rate_specified_renter: [true, false] # HB: reg 3(2)(e)(i) excludes only the lodger, who pays the householder, # so the son resides with the householder as a non-dependant (reg 3(1), @@ -347,5 +347,5 @@ # UC: the renter's foster child (para 9(2)(c)), and the renter meets the # foster parent condition (para 29(9A)): not a specified renter. is_lha_foster_child: [false, true] - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: false diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_young_person_bedroom.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_young_person_bedroom.yaml index bbf5526732..e47f0349ab 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_young_person_bedroom.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_young_person_bedroom.yaml @@ -575,7 +575,7 @@ LHA_allowed_bedrooms: [2, 2] # The third condition in para 28(4) fails, so the head, single and # under 35, is not a specified renter (para 27): category C, not A. - lha_renter_has_non_dependant: [true, true] + universal_credit_renter_has_non_dependant: [true, true] is_lha_shared_accommodation_rate_specified_renter: [false, false] LHA_category: [C, C] # 96.55 x 12 = 1,158.60. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml index f66549fc1f..ee56077f13 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/rent_of_sharers_boarders_and_lodgers.yaml @@ -246,7 +246,7 @@ tenure_type: RENT_PRIVATELY output: # UC Sch 4 para 28(4): no person is a non-dependant of the householder. - lha_renter_has_non_dependant: [false, false] + universal_credit_renter_has_non_dependant: [false, false] housing_benefit_has_non_dependant: [false, false] is_lha_shared_accommodation_rate_specified_renter: [true, false] LHA_category: [A, B] diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/claims_as_single_person.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/claims_as_single_person.yaml index 2905d77c7b..674b5205d9 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/claims_as_single_person.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/universal_credit/claims_as_single_person.yaml @@ -751,7 +751,7 @@ region: NORTH_EAST output: # The partner is not a non-dependant (para 9(2)(b)). - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: true LHA_category: A # HB: a claimant with a partner is not a young individual (HB reg 2(1)); diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/legacy_means_tests/boarders_and_lodgers_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/legacy_means_tests/boarders_and_lodgers_non_dependants.yaml index 9229550ecf..60b2d7c143 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/legacy_means_tests/boarders_and_lodgers_non_dependants.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/legacy_means_tests/boarders_and_lodgers_non_dependants.yaml @@ -659,7 +659,7 @@ is_uc_non_dependant_of_household_head: [false, false, true] benunits: householder_unit: - lha_renter_has_non_dependant: true + universal_credit_renter_has_non_dependant: true is_lha_shared_accommodation_rate_specified_renter: false LHA_allowed_bedrooms: 2 uc_non_dep_deductions: 1_158.60 @@ -712,7 +712,7 @@ is_uc_non_dependant_of_household_head: [false, false, false] benunits: householder_unit: - lha_renter_has_non_dependant: false + universal_credit_renter_has_non_dependant: false is_lha_shared_accommodation_rate_specified_renter: true LHA_allowed_bedrooms: 1 uc_housing_costs_element: 7_800 diff --git a/policyengine_uk/tests/policy/baseline/household/demographic/resolved_household_head.yaml b/policyengine_uk/tests/policy/baseline/household/demographic/resolved_household_head.yaml index 0b06e36f56..f93f4f3865 100644 --- a/policyengine_uk/tests/policy/baseline/household/demographic/resolved_household_head.yaml +++ b/policyengine_uk/tests/policy/baseline/household/demographic/resolved_household_head.yaml @@ -52,7 +52,7 @@ housing_benefit_non_dep_deductions: [0, 800] LHA_allowed_bedrooms: [1, 2] housing_benefit_LHA_allowed_bedrooms: [1, 2] - lha_renter_has_non_dependant: [false, true] + universal_credit_renter_has_non_dependant: [false, true] council_tax_reduction_claimant_benunit: [false, true] council_tax_reduction_individual_non_dep_deduction_eligible: [true, false] council_tax_reduction_non_dep_deductions: [0, 200] @@ -122,7 +122,7 @@ housing_benefit_non_dep_deductions: [0, 800] LHA_allowed_bedrooms: [1, 2] housing_benefit_LHA_allowed_bedrooms: [1, 2] - lha_renter_has_non_dependant: [false, true] + universal_credit_renter_has_non_dependant: [false, true] council_tax_reduction_claimant_benunit: [false, true] council_tax_reduction_individual_non_dep_deduction_eligible: [true, false] council_tax_reduction_non_dep_deductions: [0, 200] diff --git a/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py b/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py index 88bca73799..f49f18e7c6 100644 --- a/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py +++ b/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py @@ -306,7 +306,7 @@ def formula(benunit, period, parameters): "is_responsible_for_child_or_young_person_for_uc_or_housing_benefit", period, ) - & ~benunit("lha_renter_has_non_dependant", period) + & ~benunit("universal_credit_renter_has_non_dependant", period) & ~excepted_disabled_renter ) diff --git a/policyengine_uk/tests/test_household_head_agreement_properties.py b/policyengine_uk/tests/test_household_head_agreement_properties.py index a4f5318ef7..c09d5a9ca8 100644 --- a/policyengine_uk/tests/test_household_head_agreement_properties.py +++ b/policyengine_uk/tests/test_household_head_agreement_properties.py @@ -106,7 +106,7 @@ "housing_benefit_LHA_allowed_bedrooms", "LHA_additional_bedrooms", "housing_benefit_LHA_additional_bedrooms", - "lha_renter_has_non_dependant", + "universal_credit_renter_has_non_dependant", "council_tax_reduction_claimant_benunit", "council_tax_reduction_individual_non_dep_deduction_eligible", "pays_rent_to_householder", diff --git a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py index 581260fff5..a068f08b40 100644 --- a/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -481,7 +481,7 @@ def test_residence_is_a_no_op_without_sharers_and_for_universal_credit(populatio for variable in [ "LHA_allowed_bedrooms", "uc_non_dep_deductions", - "lha_renter_has_non_dependant", + "universal_credit_renter_has_non_dependant", ]: reference = calc(sims[0][0], variable) for sim, _ in sims[1:]: diff --git a/policyengine_uk/tests/test_lha_bedroom_young_people_properties.py b/policyengine_uk/tests/test_lha_bedroom_young_people_properties.py index d60dd9e63b..d396040ae0 100644 --- a/policyengine_uk/tests/test_lha_bedroom_young_people_properties.py +++ b/policyengine_uk/tests/test_lha_bedroom_young_people_properties.py @@ -645,7 +645,7 @@ def test_exact_effect_of_adding_a_person_aged_16_to_19(case): # non-dependant's, so that claim's renter is no specified renter (UC # Sch 4 para 28(4)). has_non_dependant = np.asarray( - sim.calculate("lha_renter_has_non_dependant", YEAR) + sim.calculate("universal_credit_renter_has_non_dependant", YEAR) ).astype(bool) gained = (uc_after > uc_before) & same_household & counted gained[t] = False diff --git a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py index d02d75e9f7..c92617c51e 100644 --- a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py +++ b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py @@ -2,7 +2,7 @@ condition, which each scheme applies with its own definitions: - Universal Credit: UC Regs 2013 Sch 4 para 28(3)-(4), with para 9 and regs - 4-5 (lha_renter_has_non_dependant). + 4-5 (universal_credit_renter_has_non_dependant). - Housing Benefit: HB Regs 2006 reg 13D(2)(a)(i), with regs 2(1), 3 and 19 (housing_benefit_has_non_dependant). @@ -288,7 +288,7 @@ def test_a_non_dependant_deduction_implies_a_non_dependant(pop): sim, people, rows = build(pop) # Invariant 3. uc = calc(sim, "uc_non_dep_deductions") - uc_has = calc(sim, "lha_renter_has_non_dependant") + uc_has = calc(sim, "universal_credit_renter_has_non_dependant") hb = calc(sim, "housing_benefit_non_dep_deductions") hb_has = calc(sim, "housing_benefit_has_non_dependant") excepted = shares_another_joint_occupiers_own_non_dependant(sim, people, rows) @@ -318,12 +318,12 @@ def test_the_examples_decide_each_invariant(): """The explicit examples exercise what each invariant turns on, so a regression in either scheme's definition cannot pass vacuously.""" sim, people, rows = build(SCHOOL_LEAVER) - assert calc(sim, "lha_renter_has_non_dependant")[0] + assert calc(sim, "universal_credit_renter_has_non_dependant")[0] assert calc(sim, "housing_benefit_has_non_dependant")[0] assert calc(sim, "is_housing_benefit_young_individual")[0] sim, people, rows = build(NINETEEN_IN_EDUCATION) - assert calc(sim, "lha_renter_has_non_dependant")[0] + assert calc(sim, "universal_credit_renter_has_non_dependant")[0] assert not calc( sim, "is_responsible_for_child_or_qualifying_young_person_for_universal_credit" )[0] @@ -343,7 +343,7 @@ def test_the_examples_decide_each_invariant(): excepted = shares_another_joint_occupiers_own_non_dependant(sim, people, rows) assert hb[3] > 0 and not has[3] and excepted[3] # Only the head's claim counts him under UC (Sch 4 para 9(2)(f)). - assert uc[3] == 0 and not calc(sim, "lha_renter_has_non_dependant")[3] + assert uc[3] == 0 and not calc(sim, "universal_credit_renter_has_non_dependant")[3] def test_a_deduction_implies_a_non_dependant_when_a_family_has_no_claimant(): @@ -378,6 +378,6 @@ def test_a_deduction_implies_a_non_dependant_when_a_family_has_no_claimant(): } sim = Simulation(situation=situation) assert calc(sim, "uc_non_dep_deductions")[0] > 0 - assert calc(sim, "lha_renter_has_non_dependant")[0] + assert calc(sim, "universal_credit_renter_has_non_dependant")[0] assert calc(sim, "housing_benefit_non_dep_deductions")[0] > 0 assert calc(sim, "housing_benefit_has_non_dependant")[0] diff --git a/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py b/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py index f530b6be8e..7c38da8bc2 100644 --- a/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py +++ b/policyengine_uk/variables/gov/dwp/is_lha_shared_accommodation_rate_specified_renter.py @@ -17,7 +17,7 @@ class is_lha_shared_accommodation_rate_specified_renter(Variable): "allowance, reg. 2) or as a foster parent or adopter (para 29(9A)); " "not responsible for a child or qualifying young person under UC " "regs 4 and 5; and with no non-dependant (see " - "lha_renter_has_non_dependant). The age and " + "universal_credit_renter_has_non_dependant). The age and " "the exceptions are the renter's own: the other member of a couple " "claiming as a single person is neither the renter nor a " "non-dependant (para 9(2)(b)). Other paragraph 29 exceptions are not " @@ -71,12 +71,12 @@ def formula(benunit, period, parameters): # person under UC regs 4 and 5, and the para 9 non-dependant. A # Housing Benefit young person who is not a Universal Credit # qualifying young person is a non-dependant (para 9(2)), which - # lha_renter_has_non_dependant counts. + # universal_credit_renter_has_non_dependant counts. & ~benunit( "is_responsible_for_child_or_qualifying_young_person_for_universal_credit", period, ) - & ~benunit("lha_renter_has_non_dependant", period) + & ~benunit("universal_credit_renter_has_non_dependant", period) & ~excepted_disabled_renter & ~excepted_foster_parent ) diff --git a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py index e34c6f8c48..881a283753 100644 --- a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py +++ b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py @@ -13,10 +13,11 @@ class is_responsible_for_child_or_young_person_for_uc_or_housing_benefit(Variabl is_responsible_for_child_or_qualifying_young_person_for_universal_credit (UC Sch 4 para 28(3)), and counts a Housing Benefit young person who is not a UC qualifying young person as a non-dependant - (lha_renter_has_non_dependant; para 28(4)). Housing Benefit's test, - housing_benefit_LHA_category, reads is_housing_benefit_young_individual - and housing_benefit_has_non_dependant (HB reg 13D(2)(a)(i)). The benefit - cap rates read each scheme's own responsibility test. + (universal_credit_renter_has_non_dependant; para 28(4)). Housing + Benefit's test, housing_benefit_LHA_category, reads + is_housing_benefit_young_individual and housing_benefit_has_non_dependant + (HB reg 13D(2)(a)(i)). The benefit cap rates read each scheme's own + responsibility test. The union also counts every 16-year-old in the benefit unit who is not a claimant or partner, for the year. diff --git a/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py similarity index 97% rename from policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py rename to policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py index 5f223417ee..3a5b7a87e2 100644 --- a/policyengine_uk/variables/gov/dwp/lha_renter_has_non_dependant.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py @@ -4,10 +4,10 @@ ) -class lha_renter_has_non_dependant(Variable): +class universal_credit_renter_has_non_dependant(Variable): value_type = bool entity = BenUnit - label = "LHA renter has a non-dependant (Universal Credit)" + label = "Universal Credit renter has a non-dependant" documentation = ( "Universal Credit: someone in this benefit unit who is a Universal " "Credit non-dependant (is_benefit_unit_non_dependant_for_universal_credit: " From 321dbf91fe6f1d4767bac3177e87cec8e28af026 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 11:44:27 -0500 Subject: [PATCH 14/22] Document the head and payer exclusions in the shared-rate non-dependant tests The in-unit terms of universal_credit_renter_has_non_dependant and housing_benefit_has_non_dependant now read the scheme's own person-level non-dependant definitions, which leave out the household head and a member who pays the head as a boarder or lodger (UC Sch 4 para 9(2)(d)-(e); HB reg 3(2)(d)-(e) and (4)). Say so in both docstrings and in the changelog fragment, and say which tests read the union responsibility variable that no formula reads. Documentation only: no formula changes. Co-Authored-By: Claude Opus 5.5 --- changelog.d/lha-sar-non-dep-per-scheme.fixed.md | 2 +- .../housing_benefit/housing_benefit_has_non_dependant.py | 6 ++++-- ...e_for_child_or_young_person_for_uc_or_housing_benefit.py | 4 +++- .../gov/dwp/universal_credit_renter_has_non_dependant.py | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md index 32f89b9db8..adf3ce7780 100644 --- a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md +++ b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md @@ -1 +1 @@ -- The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`universal_credit_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. `universal_credit_renter_has_non_dependant` replaces `lha_renter_has_non_dependant`. +- The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`universal_credit_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. Within the benefit unit, both tests now leave out the household head and a member who pays the household head as a boarder or lodger, as the non-dependant deductions already did (UC Sch 4 para 9(2)(d)-(e); HB reg 3(2)(d)-(e) and (4)), so such a member no longer stops a family getting the shared accommodation rate. `universal_credit_renter_has_non_dependant` replaces `lha_renter_has_non_dependant`. diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py index 982cdf9379..7ad3fd5250 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py @@ -12,8 +12,10 @@ class housing_benefit_has_non_dependant(Variable): "Someone in this benefit unit who is a Housing Benefit non-dependant " "(is_benefit_unit_non_dependant_for_legacy_benefits: neither a " "claimant or partner nor a child or young person, including one " - "placed with the family as a foster child or for adoption; a " - "16-year-old outside the Child Benefit young person test is one), " + "placed with the family as a foster child or for adoption, the " + "household head or a member who pays the household head as a " + "boarder or lodger, reg 3(2)(d)-(e) and (4); a 16-year-old outside " + "the Child Benefit young person test is one), " "or, for a family liable for the " "household's rent (the household head's or a sharer's), anyone in " "the household who is a non-dependant (see " diff --git a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py index 881a283753..af63f7e7b3 100644 --- a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py +++ b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py @@ -4,7 +4,9 @@ class is_responsible_for_child_or_young_person_for_uc_or_housing_benefit(Variable): """Responsible for a child or young person under UC or Housing Benefit rules. - A union of the two schemes' tests that no formula reads. UC counts a + A union of the two schemes' tests that no formula reads; the reference + formulas in test_benefit_cap_lha_scheme_split_properties.py read it as + the rule before the schemes were split. UC counts a child or qualifying young person (UC Regs 2013 regs 4-5); Housing Benefit counts a child or young person, whose young-person test follows Child Benefit (HB Regs 2006 regs 2, 19). Each scheme's rules read its own test: diff --git a/policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py index 3a5b7a87e2..4592198f2c 100644 --- a/policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py +++ b/policyengine_uk/variables/gov/dwp/universal_credit_renter_has_non_dependant.py @@ -12,7 +12,10 @@ class universal_credit_renter_has_non_dependant(Variable): "Universal Credit: someone in this benefit unit who is a Universal " "Credit non-dependant (is_benefit_unit_non_dependant_for_universal_credit: " "aged 16 or over and neither the claimant or partner, a qualifying " - "young person nor the renter's foster child), or, for the claim " + "young person, the renter's foster child, the household head nor a " + "member who pays the household head as a boarder or lodger; the " + "last two are liable for their own occupation, para 9(2)(d)), or, " + "for the claim " "that counts the household's non-dependants (see " "uc_non_dependants_counted), anyone that claim treats as a " "non-dependant from another family (see other_family_non_dependants). " From 330962ca7c5340cf7515fd27b5faec92e4f5362d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 11:44:40 -0500 Subject: [PATCH 15/22] Pin the head and payer exclusions and the S1 split in the shared-rate tests LHA_shared_accommodation_non_dependants.yaml: - A lodger's adult son who pays the householder himself is neither family's non-dependant under either scheme (UC Sch 4 para 9(2)(d); HB reg 3(2)(e)(i) and (4)), so both families get A and neither bears a deduction. - A household head in the claimant's benefit unit is not the claimant's non-dependant (UC para 9(2)(d)-(e); HB reg 3(2)(d), (e)(ii)). - The joint-tenant case now pins housing_benefit_shares_accommodation and the bedrooms, and says that 13D(2)(a)(ii) gives the sharer A as well as (a)(i). A new variant rebuts the exclusive-use presumption, so that (a)(i) alone decides and the case turns on whether the other tenant's adult son is the sharer's non-dependant. test_lha_shared_rate_non_dependant_properties.py: invariants 1 and 2 leave out the household head and a member who pays the head, the generator draws payers among a lodger's members aged 16 or over, and explicit payer and member-head examples check the narrowing from the other side. Co-Authored-By: Claude Opus 5.5 --- ...A_shared_accommodation_non_dependants.yaml | 158 +++++++++++++++++- ...ha_shared_rate_non_dependant_properties.py | 88 +++++++++- 2 files changed, 236 insertions(+), 10 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml index 7f9c8118ed..fa07575145 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -257,9 +257,16 @@ # HB: housing_benefit_has_non_dependant counts a non-dependant within a # joint occupier's own benefit unit for that occupier only; the # non_dependant_normally_resides_with input covers other families' - # non-dependants, not his. So the sharer, a single claimant under 35, is - # a young individual with no non-dependant residing with them: 13D(2)(a)(i) - # gives A. Head: 2 bedrooms: C. + # non-dependants, not his. The size criteria agree: 2 bedrooms for the + # head (C), 1 for the sharer. The model presumes that a family liable for + # a share of the rent lacks exclusive use of self-contained accommodation + # (housing_benefit_shares_accommodation), so with 1 bedroom the sharer + # gets A under 13D(2)(a)(ii) whether or not the son resides with them. + # 13D(2)(a)(i) gives A too: the sharer, a single claimant under 35, is a + # young individual with no non-dependant residing with them. The next + # case rebuts the presumption, so that (a)(i) alone decides. + housing_benefit_shares_accommodation: [true, true] + housing_benefit_LHA_allowed_bedrooms: [2, 1] housing_benefit_has_non_dependant: [true, false] is_housing_benefit_young_individual: [false, true] housing_benefit_LHA_category: [C, A] @@ -270,6 +277,51 @@ # sharer is a question of fact the model has no input for). housing_benefit_non_dep_deductions: [200, 200] +- name: A joint tenant with exclusive use gets the HB shared rate only because the other tenant's adult son is not their non-dependant + period: 2026 + input: + people: + head: + age: 45 + is_household_head: true + is_claimant_or_partner: true + son: + age: 22 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + sharer: + age: 28 + is_claimant_or_partner: true + benunits: + head_family: + members: [head, son] + # As the presumption gives: an input for one family replaces the + # formula for every family. + housing_benefit_shares_accommodation: true + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + # The presumption rebutted: the sharer has, for example, an + # exclusive bedroom and sitting room (13D(2)(b)(i)). + housing_benefit_shares_accommodation: false + households: + home: + members: [head, son, sharer] + rent: 18_000 + tenure_type: RENT_PRIVATELY + output: + # 13D(2)(a)(ii) cannot apply, since (b)(i) is met. The sharer gets A only + # under (a)(i): a young individual with no non-dependant residing with + # them, which holds because the model counts the son for his own family + # only (as the previous case). Were he the sharer's non-dependant too, + # (a)(i) would fail and the sharer would get the one-bedroom rate (B) + # under (b), or C if the size criteria counted him. + housing_benefit_shares_accommodation: [true, false] + housing_benefit_LHA_allowed_bedrooms: [2, 1] + housing_benefit_has_non_dependant: [true, false] + is_housing_benefit_young_individual: [false, true] + housing_benefit_LHA_category: [C, A] + - name: A lodger's adult son is the householder's HB non-dependant but counts in the lodger's UC claim period: 2026 input: @@ -310,6 +362,106 @@ housing_benefit_has_non_dependant: [true, true] is_housing_benefit_young_individual: [true, false] +- name: A lodger's adult son who pays the householder himself is no one's non-dependant + period: 2026 + absolute_error_margin: 0.01 + input: + people: + householder: + age: 30 + is_household_head: true + is_claimant_or_partner: true + lodger: + age: 25 + is_claimant_or_partner: true + rent_paid_as_lodger: 4_000 + lodger_son: + age: 22 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + rent_paid_as_lodger: 2_000 + employment_income: 20_000 + benunits: + householder_family: + members: [householder] + lodger_family: + members: [lodger, lodger_son] + households: + home: + members: [householder, lodger, lodger_son] + rent: 9_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Unlike the previous case, the son pays the householder for his own + # room. The model takes the payment to be commercial + # (pays_rent_to_householder); a non-commercial one would keep him a + # non-dependant (HB reg 3(3) with reg 9). + pays_rent_to_householder: [false, true, true] + is_benefit_unit_non_dependant_for_universal_credit: [false, false, false] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, false, false] + # UC: he is liable on a commercial basis for his occupation, "whether to + # the renter, joint renters or another person" (Sch 4 para 9(2)(d)), so + # he is neither the lodger's nor the householder's non-dependant. Both + # are specified renters: A. + universal_credit_renter_has_non_dependant: [false, false] + is_lha_shared_accommodation_rate_specified_renter: [true, true] + LHA_category: [A, A] + # HB: he pays the householder (reg 3(2)(e)(i)), and he and the lodger are + # each separately liable to the landlord, so he does not reside with the + # lodger (reg 3(4)). Both are young individuals with no non-dependant: + # A (13D(2)(a)(i)). + housing_benefit_has_non_dependant: [false, false] + is_housing_benefit_young_individual: [true, true] + housing_benefit_LHA_category: [A, A] + # The deductions already left him out. + uc_non_dep_deductions: [0, 0] + housing_benefit_non_dep_deductions: [0, 0] + +- name: A household head in the claimant's benefit unit is not the claimant's non-dependant + period: 2026 + absolute_error_margin: 0.01 + input: + people: + claimant: + age: 25 + is_claimant_or_partner: true + head: + age: 40 + is_household_head: true + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + employment_income: 20_000 + benunits: + family: + members: [claimant, head] + households: + home: + members: [claimant, head] + rent: 9_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # The inputs can put the household head, the householder in whose name + # the home is rented, in a benefit unit whose claimant is someone else. + # The model takes the head to be liable for the dwelling. UC: liable for + # their own occupation (Sch 4 para 9(2)(d)), and the person the + # claimant's liability is owed to where the claimant pays them (para + # 9(2)(e)). HB: liable with the claimant (reg 3(2)(d)) or the person the + # claimant pays (reg 3(2)(e)(ii)). Either way not a non-dependant, so the + # claimant, single and under 35, gets A under both schemes. + is_resolved_household_head: [false, true] + is_benefit_unit_non_dependant_for_universal_credit: [false, false] + is_benefit_unit_non_dependant_for_legacy_benefits: [false, false] + universal_credit_renter_has_non_dependant: false + is_lha_shared_accommodation_rate_specified_renter: true + LHA_category: A + housing_benefit_has_non_dependant: false + is_housing_benefit_young_individual: true + housing_benefit_LHA_category: A + uc_non_dep_deductions: 0 + housing_benefit_non_dep_deductions: 0 + - name: A looked-after 16-year-old school leaver stops a young single HB claimant's shared rate period: 2026 input: diff --git a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py index c92617c51e..2b65f9250c 100644 --- a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py +++ b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py @@ -12,11 +12,16 @@ claimant or partner, who is not looked after by a local authority stops the renter being a specified renter. They are either a qualifying young person the renter is responsible for (para 28(3)) or a non-dependant (para - 28(4)), so the shared rate never depends on which. + 28(4)), so the shared rate never depends on which. The household head and + a member who pays the household head as a boarder or lodger are left out: + each is liable for their own occupation, so is not a non-dependant (para + 9(2)(d)); one who is not a qualifying young person leaves the renter's + shared rate alone. 2. HB: such a member who is not placed with the family stops the claimant being a young individual with no non-dependant: they are either a young person in the claimant's family, making the claimant a lone parent rather - than a single claimant (reg 2(1)), or a non-dependant (reg 3). + than a single claimant (reg 2(1)), or a non-dependant (reg 3). The same + two are left out (reg 3(2)(d)-(e) and (4)). 3. Deductions imply a non-dependant: a family charged a UC or HB non-dependant deduction has a non-dependant under that scheme's test. One exception, for HB: a joint occupier charged part of the deduction for @@ -41,7 +46,10 @@ The generator concentrates members' ages around 16 to 20, where the schemes' definitions differ, draws whether a 16-year-old is before the 1 September after their 16th birthday (UC reg 5(1)(a); Child Benefit (General) Regs 2006 -reg 4), and explicit examples pin the cases that decide each invariant. +reg 4) and whether a lodger's member aged 16 or over pays the householder +too, and explicit examples pin the cases that decide each invariant, +including a member who is the household head, which the generator never +draws. """ import numpy as np @@ -78,6 +86,9 @@ def member(draw): before_uc_terminal_date=age != 19 or draw(st.booleans()), started_education_at=draw(st.integers(14, 19)), earnings=draw(st.sampled_from(EARNINGS)), + # In a lodger's family, a member aged 16 or over may pay the + # householder for their own room (pays_rent_to_householder). + pays_householder=age >= 16 and draw(st.booleans()), ) @@ -107,6 +118,7 @@ def _member( started=14, earnings=0.0, before_uc_terminal_date=True, + pays_householder=False, ): return dict( age=age, @@ -117,10 +129,18 @@ def _member( before_uc_terminal_date=before_uc_terminal_date, started_education_at=started, earnings=earnings, + pays_householder=pays_householder, ) -def _house(renter_age, members, other=None, other_age=30, other_members=()): +def _house( + renter_age, + members, + other=None, + other_age=30, + other_members=(), + member_is_head=False, +): return dict( renter_age=renter_age, partner=False, @@ -129,6 +149,9 @@ def _house(renter_age, members, other=None, other_age=30, other_members=()): other_age=other_age, other_earnings=30_000.0, other_members=list(other_members), + # The inputs flag the renter's first member, not the renter, as the + # household head. + member_is_head=member_is_head, ) @@ -147,6 +170,22 @@ def _house(renter_age, members, other=None, other_age=30, other_members=()): _house(45, [], other="non_dependant", other_age=30), _house(50, [_member(25, earnings=30_000.0)], other="sharer", other_age=28), ] +# A young single householder with a lodger whose adult son pays the +# householder for his own room, so is no one's non-dependant (invariants 1 +# and 2 leave him out). +PAYER = [ + _house( + 30, + [], + other="lodger", + other_age=25, + other_members=[_member(22, earnings=20_000.0, pays_householder=True)], + ) +] +# A young single renter whose benefit unit holds the household head, a +# 40-year-old who is not the claimant or partner (invariants 1 and 2 leave +# them out). +MEMBER_HEAD = [_house(25, [_member(40, earnings=20_000.0)], member_is_head=True)] def build(population): @@ -155,6 +194,7 @@ def build(population): for h, house in enumerate(population): names = [] renter_age = house["renter_age"] + member_is_head = house.get("member_is_head", False) families = [ dict( name=f"h{h}_renter", @@ -184,7 +224,7 @@ def build(population): people[pid] = { "age": age, "is_claimant_or_partner": True, - "is_household_head": fam["head"] and i == 0, + "is_household_head": fam["head"] and i == 0 and not member_is_head, "current_education": "NOT_IN_EDUCATION", "employment_income": fam["earnings"] if i == 0 else 0.0, "is_before_first_september_following_16th_birthday": False, @@ -198,7 +238,7 @@ def build(population): people[pid] = { "age": m["age"], "is_claimant_or_partner": False, - "is_household_head": False, + "is_household_head": fam["head"] and i == 0 and member_is_head, "current_education": m["education"], "is_looked_after_by_local_authority": m["looked_after"], "is_placed_for_adoption": m["placed_for_adoption"] @@ -214,6 +254,8 @@ def build(population): "before_uc_terminal_date" ], } + if fam["role"] == "lodger" and m["pays_householder"]: + people[pid]["rent_paid_as_lodger"] = 2_000.0 ids.append(pid) benunits[fam["name"]] = {"members": ids} if fam["role"] == "sharer": @@ -233,21 +275,35 @@ def calc(sim, variable): return np.asarray(sim.calculate(variable, YEAR)) +def liable_for_own_occupation(sim, people): + """For each person, whether they are the household head or pay the head + as a boarder or lodger: liable for their own occupation, so no one's + non-dependant (UC Sch 4 para 9(2)(d); HB reg 3(2)(d)-(e), (4)).""" + head = calc(sim, "is_resolved_household_head") + payer = calc(sim, "pays_rent_to_householder") + return dict(zip(people, head | payer)) + + @PROPERTY_SETTINGS @given(population) @example(SCHOOL_LEAVER) @example(NINETEEN_IN_EDUCATION) +@example(PAYER) +@example(MEMBER_HEAD) def test_shared_rate_never_depends_on_how_a_member_aged_16_or_over_is_classed(pop): sim, people, rows = build(pop) specified = calc(sim, "is_lha_shared_accommodation_rate_specified_renter") hb_young_individual = calc(sim, "is_housing_benefit_young_individual") hb_has_non_dependant = calc(sim, "housing_benefit_has_non_dependant") placed = dict(zip(people, calc(sim, "is_child_or_young_person_placed_with_family"))) + liable = liable_for_own_occupation(sim, people) for i, row in enumerate(rows): others = [ p for p in row["ids"] - if not people[p]["is_claimant_or_partner"] and people[p]["age"] >= 16 + if not people[p]["is_claimant_or_partner"] + and people[p]["age"] >= 16 + and not liable[p] ] # Invariant 1. if any(not people[p]["is_looked_after_by_local_authority"] for p in others): @@ -284,6 +340,7 @@ def shares_another_joint_occupiers_own_non_dependant(sim, people, rows): @PROPERTY_SETTINGS @given(population) @example(SHARED_HOUSE) +@example(PAYER) def test_a_non_dependant_deduction_implies_a_non_dependant(pop): sim, people, rows = build(pop) # Invariant 3. @@ -345,6 +402,23 @@ def test_the_examples_decide_each_invariant(): # Only the head's claim counts him under UC (Sch 4 para 9(2)(f)). assert uc[3] == 0 and not calc(sim, "universal_credit_renter_has_non_dependant")[3] + # Invariants 1 and 2 leave out a member liable for their own occupation: + # with one, the renter keeps the shared rate under both schemes. + for population, row, member in [ + # The lodger's adult son, who pays the householder himself. + (PAYER, 1, "h0_other_member_0"), + # The household head, in the young renter's benefit unit. + (MEMBER_HEAD, 0, "h0_renter_member_0"), + ]: + sim, people, rows = build(population) + assert member in rows[row]["ids"] + assert liable_for_own_occupation(sim, people)[member] + assert calc(sim, "is_lha_shared_accommodation_rate_specified_renter")[row] + assert calc(sim, "is_housing_benefit_young_individual")[row] + assert not calc(sim, "housing_benefit_has_non_dependant")[row] + assert calc(sim, "uc_non_dep_deductions")[row] == 0 + assert calc(sim, "housing_benefit_non_dep_deductions")[row] == 0 + def test_a_deduction_implies_a_non_dependant_when_a_family_has_no_claimant(): """Invariant 3 holds for any input, including another family whose only From f04c1115c5510fc6d8cdb636c51e9200d3e9468b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 12:31:02 -0500 Subject: [PATCH 16/22] Read UC responsibility in the benefit-cap test's reference specified renter The production UC specified-renter test now reads is_responsible_for_child_or_qualifying_young_person_for_universal_credit (UC Sch 4 para 28(3)) and this PR's UC non-dependant flag. The reference in test_benefit_cap_lha_scheme_split_properties.py already read the new flag but still read the union of both schemes' responsibility tests, so the two could differ outside the benefit-cap split the file compares (inferred, not run: for example a 16-year-old past the UC reg 5(1)(a) date who has left education and pays the householder, or one looked after by a local authority). Read the UC test there too, and say so in the file's header. The reference cap rate keeps the union: invariant 1 relies on the old cap rate taking responsibility under either scheme. The union variable's docstring now names that one reader. Co-Authored-By: Claude Opus 5.5 --- ...test_benefit_cap_lha_scheme_split_properties.py | 14 +++++++++++--- ...ld_or_young_person_for_uc_or_housing_benefit.py | 5 +++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py b/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py index f49f18e7c6..6feaf8b90e 100644 --- a/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py +++ b/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py @@ -12,7 +12,10 @@ under ``reference_`` names, so one simulation computes the old and the new values for the same families. They are verbatim except for the names they read, the inlined stopgap helpers, the earnings exception's dead code and its -threshold, which now follows the national living wage (#2523). +threshold, which now follows the national living wage (#2523), and the +specified renter test, which reads the Universal Credit responsibility and +non-dependant tests in place of the union of both schemes', as the +production test now does (UC Sch 4 para 28(3)-(4)). The reference awards read the current ``uc_deductions``, which these single-household simulations leave at nil. @@ -86,7 +89,8 @@ # --------------------------------------------------------------------------- # The shared rules before the split (parent commit 17b9b8a16), verbatim but -# for the names and the inlined stopgap helpers. +# for the names, the inlined stopgap helpers and the specified renter's +# Universal Credit responsibility and non-dependant tests. def _single_claim_in_shared_rules(benunit, period): @@ -302,8 +306,12 @@ def formula(benunit, period, parameters): return ( (~benunit("is_couple", period) | claims_as_single_person) & (renter_age < p.shared_accommodation_age_threshold) + # The Universal Credit responsibility and non-dependant tests + # that the production test now reads (UC Sch 4 para 28(3)-(4)), + # not the union of both schemes': that change is not the split + # these tests compare. & ~benunit( - "is_responsible_for_child_or_young_person_for_uc_or_housing_benefit", + "is_responsible_for_child_or_qualifying_young_person_for_universal_credit", period, ) & ~benunit("universal_credit_renter_has_non_dependant", period) diff --git a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py index af63f7e7b3..6bf966afd8 100644 --- a/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py +++ b/policyengine_uk/variables/gov/dwp/is_responsible_for_child_or_young_person_for_uc_or_housing_benefit.py @@ -5,8 +5,9 @@ class is_responsible_for_child_or_young_person_for_uc_or_housing_benefit(Variabl """Responsible for a child or young person under UC or Housing Benefit rules. A union of the two schemes' tests that no formula reads; the reference - formulas in test_benefit_cap_lha_scheme_split_properties.py read it as - the rule before the schemes were split. UC counts a + cap rate in test_benefit_cap_lha_scheme_split_properties.py reads it as + the shared cap rate's rule before the benefit cap was split by scheme. + UC counts a child or qualifying young person (UC Regs 2013 regs 4-5); Housing Benefit counts a child or young person, whose young-person test follows Child Benefit (HB Regs 2006 regs 2, 19). Each scheme's rules read its own test: From 5380030737e63cf204b87c42c42d7ac50c9559a7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 13:32:26 -0500 Subject: [PATCH 17/22] Leave the household head and a member who pays them out of HB's severe disability premium test The premium's within-family term counted any adult outside the claimant's couple, so a household head in the claimant's benefit unit, or a lodger's son who pays the householder, stopped the premium and with it the shared rate exception (HB reg 13D(2)(a), Sch 3 para 14). It now reads is_benefit_unit_non_dependant_for_legacy_benefits, as housing_benefit_has_non_dependant does (reg 3(2)(a), (c)-(e) and (4)). Two shared-rate cases pin both exclusions with a qualifying benefit. Co-Authored-By: Claude Opus 5.5 --- ...A_shared_accommodation_non_dependants.yaml | 82 +++++++++++++++++++ ...nefit_severe_disability_premium_applies.py | 19 +++-- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml index fa07575145..2824f1b911 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -462,6 +462,88 @@ uc_non_dep_deductions: 0 housing_benefit_non_dep_deductions: 0 +- name: A lodger on attendance allowance whose adult son pays the householder keeps the severe disability premium + period: 2026 + input: + people: + householder: + age: 30 + is_household_head: true + is_claimant_or_partner: true + lodger: + age: 25 + is_claimant_or_partner: true + rent_paid_as_lodger: 4_000 + attendance_allowance: 5_000 + lodger_son: + age: 22 + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + rent_paid_as_lodger: 2_000 + employment_income: 20_000 + benunits: + householder_family: + members: [householder] + lodger_family: + members: [lodger, lodger_son] + households: + home: + members: [householder, lodger, lodger_son] + rent: 9_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # As the case of the lodger's son who pays the householder, but the + # lodger receives attendance allowance. The son pays the householder + # (HB reg 3(2)(e)(i), 3(4)), so he is not a non-dependant aged 18 or + # over for the severe disability premium either (Sch 3 para + # 14(2)(a)(ii)). The premium applies, so the shared rate does not + # (13D(2)(a)): the lodger's category follows the size criteria, C. UC's + # own exception for attendance allowance (Sch 4 para 29(5)) makes the + # lodger's UC category B. + housing_benefit_has_non_dependant: [false, false] + housing_benefit_severe_disability_premium_applies: [false, true] + housing_benefit_LHA_category: [A, C] + is_lha_shared_accommodation_rate_specified_renter: [true, false] + LHA_category: [A, B] + +- name: A claimant on PIP daily living with the household head in their benefit unit keeps the severe disability premium + period: 2026 + input: + people: + claimant: + age: 25 + is_claimant_or_partner: true + pip_dl: 5_000 + head: + age: 40 + is_household_head: true + is_claimant_or_partner: false + current_education: NOT_IN_EDUCATION + employment_income: 20_000 + benunits: + family: + members: [claimant, head] + households: + home: + members: [claimant, head] + rent: 9_000 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # As the case of the household head in the claimant's benefit unit, but + # the claimant receives the PIP daily living component. The head is not + # the claimant's non-dependant (HB reg 3(2)(d) or (e)(ii)), so no + # non-dependant aged 18 or over resides with the claimant and the + # severe disability premium applies (Sch 3 para 14). The shared rate + # does not (13D(2)(a)): HB category C. UC's own exception for the PIP + # daily living component (Sch 4 para 29(5)) makes the UC category B. + housing_benefit_has_non_dependant: false + housing_benefit_severe_disability_premium_applies: true + housing_benefit_LHA_category: C + is_lha_shared_accommodation_rate_specified_renter: false + LHA_category: B + - name: A looked-after 16-year-old school leaver stops a young single HB claimant's shared rate period: 2026 input: diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py index cd3c5bfedf..008245b057 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py @@ -13,7 +13,10 @@ class housing_benefit_severe_disability_premium_applies(Variable): "Benefit severe disability premium: the claimant (and any partner) " "receives a qualifying disability benefit, and no non-dependant aged " "18 or over normally resides with them, other than one who receives " - "a qualifying benefit or is blind. Where the rent is shared, another " + "a qualifying benefit or is blind. The household head, and a member " + "who pays the household head for their own occupation, are not " + "non-dependants (HB reg 3(2)(d), (e) and (4)), as for " + "housing_benefit_has_non_dependant. Where the rent is shared, another " "family's non-dependant resides with each joint occupier that " "non_dependant_normally_resides_with gives, by default every one, " "and a joint occupier's own family is never another's " @@ -55,13 +58,13 @@ def formula(benunit, period, parameters): # housing_benefit_has_non_dependant. age = person("age", period) adult_non_dependant = (age >= 18) & ~qualifying & ~blind - # A child or young person placed with the family as a foster child or - # for adoption is not a non-dependant either (reg 3(2)(c) with reg - # 21(3)). - young_person = person( - "is_child_or_young_person_for_legacy_benefits", period - ) | person("is_child_or_young_person_placed_with_family", period) - within = benunit.any(adult_non_dependant & ~claimant_or_partner & ~young_person) + # Reg 3(2)(a), (c)-(e) and (4), as housing_benefit_has_non_dependant: + # the household head and a member who pays the household head are not + # non-dependants. + within = benunit.any( + adult_non_dependant + & person("is_benefit_unit_non_dependant_for_legacy_benefits", period) + ) liable_family = benunit.any(person("is_liable_for_household_rent", period)) # Outside the family, reg 3(1), (2)(d) and (4): the non-dependants # who normally reside with this joint occupier From b2157f53fb5a9bdde2d0d22175beee7149c9cec7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 14:11:39 -0500 Subject: [PATCH 18/22] Test that the benefit-cap reference specified renter reads UC responsibility f04c1115c changed the reference specified renter to read Universal Credit responsibility (UC Regs 2013 Sch 4 para 28(3)) instead of the union of both schemes' tests, but no test told the two apart: the generated children cannot be past the 1 September after their 16th birthday or pay the householder. A lodger aged 25 whose son, 16, has left education, is past that date (reg 5(1)) and pays the householder (para 9(2)(d)) does: the union counts him, UC responsibility and the UC non-dependant test do not, so the lodger is a specified renter under the production test and the reference, and would not be under the union. Co-Authored-By: Claude Opus 5.5 --- ...benefit_cap_lha_scheme_split_properties.py | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py b/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py index 6feaf8b90e..ee54cba39e 100644 --- a/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py +++ b/policyengine_uk/tests/test_benefit_cap_lha_scheme_split_properties.py @@ -941,3 +941,82 @@ def test_examples_reach_the_cases(): # the reference reads the same threshold, so neither is exempt. assert not v["is_uc_benefit_cap_exempt"][earner_in_gap] assert not v["reference_is_benefit_cap_exempt"][earner_in_gap] + + +def test_the_reference_specified_renter_reads_universal_credit_responsibility(): + """The reference specified renter reads Universal Credit responsibility + (UC Sch 4 para 28(3)), not the union of both schemes' tests, which also + counts every member aged 16 who is not the claimant or partner. + + A lodger aged 25 lives with her son aged 16, who has left education, is + past the 1 September after his 16th birthday and pays the householder for + his own room. He is not a Universal Credit qualifying young person (reg + 5(1)) or a Child Benefit young person, so the lodger is responsible for + him under neither scheme, but the union counts him as a 16-year-old. He is + liable on a commercial basis for his own occupation, so he is not her + non-dependant (Sch 4 para 9(2)(d)). She is a specified renter under the + production test and the reference alike; the union would make the + reference say she is not. + """ + year = PERIOD + past_first_september = { + "is_before_first_september_following_16th_birthday": {year: False} + } + situation = { + "people": { + "householder": { + "age": {year: 30}, + "is_household_head": {year: True}, + "is_claimant_or_partner": {year: True}, + **past_first_september, + }, + "lodger": { + "age": {year: 25}, + "is_claimant_or_partner": {year: True}, + "rent_paid_as_lodger": {year: 4_000.0}, + **past_first_september, + }, + "son": { + "age": {year: 16}, + "is_claimant_or_partner": {year: False}, + "current_education": {year: "NOT_IN_EDUCATION"}, + "rent_paid_as_lodger": {year: 2_000.0}, + **past_first_september, + }, + }, + "benunits": { + "householder_family": {"members": ["householder"]}, + "lodger_family": {"members": ["lodger", "son"]}, + }, + "households": { + "home": { + "members": ["householder", "lodger", "son"], + "rent": {year: 9_000.0}, + "tenure_type": {year: "RENT_PRIVATELY"}, + } + }, + } + sim = Simulation(situation=situation, reform=REFERENCE) + son, lodger_family = 2, 1 + + def value(variable, index): + return bool(np.asarray(sim.calculate(variable, PERIOD))[index]) + + assert value("pays_rent_to_householder", son) + assert value( + "is_responsible_for_child_or_young_person_for_uc_or_housing_benefit", + lodger_family, + ) + assert not value( + "is_responsible_for_child_or_qualifying_young_person_for_universal_credit", + lodger_family, + ) + assert not value( + "is_responsible_for_child_or_young_person_for_legacy_benefits", + lodger_family, + ) + assert not value("universal_credit_renter_has_non_dependant", lodger_family) + assert value("is_lha_shared_accommodation_rate_specified_renter", lodger_family) + assert value( + "reference_is_lha_shared_accommodation_rate_specified_renter", lodger_family + ) From 2d9dbf5da7b2ef886486020ad4067d66d4eff36d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 14:11:47 -0500 Subject: [PATCH 19/22] Test the education route alone in the 16-year-old in education case The case "A 16-year-old in full-time education is a dependant under both schemes" left the September flag to its formula, so the son was a young person before the 1 September after his 16th birthday (UC Regs 2013 reg 5(1)(a)) whatever his education. Set it false for him and the parent, as the school-leaver case does, so the case differs from that one only in education. No expected value changes. Co-Authored-By: Claude Opus 5.5 --- .../family/LHA_shared_accommodation_non_dependants.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml index 2824f1b911..8b30899a2d 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -13,10 +13,10 @@ # # A 16-year-old is a dependant only within each scheme's young person test. # Outside it, they are a non-dependant. Either way the renter misses the shared -# rate. The cases with a 16-year-old outside both tests set +# rate. The cases with a 16-year-old set # is_before_first_september_following_16th_birthday to false for every person, # so that neither UC reg 5(1)(a) nor Child Benefit (General) Regs 2006 reg 4 -# holds. +# holds: a 16-year-old in education is a young person through education alone. # # Bedrooms: everyone aged 16 or over other than the claimant or partner has a # bedroom (UC Sch 4 para 10(1)(b)-(c); HB reg 13D(3)(b)), so 1 + 1 = 2: C. @@ -65,10 +65,14 @@ age: 33 is_household_head: true is_claimant_or_partner: true + is_before_first_september_following_16th_birthday: false son: age: 16 is_claimant_or_partner: false current_education: UPPER_SECONDARY + # As the previous case but in education: that alone makes him a + # young person. + is_before_first_september_following_16th_birthday: false benunits: family: members: [parent, son] From 75892aef975a63771d1c573eb426f4bbb3c461fc Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 14:11:47 -0500 Subject: [PATCH 20/22] Drop the changelog fragment's bullet and name the severe disability premium change Towncrier supplies the bullet. Add a sentence for 538003073: the Housing Benefit severe disability premium's non-dependant test also leaves out the household head and a member who pays them (HB Regs 2006 reg 3(2)(d)-(e) and (4); Sch 3 para 14(2)(a)(ii)). Co-Authored-By: Claude Opus 5.5 --- changelog.d/lha-sar-non-dep-per-scheme.fixed.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md index adf3ce7780..43f4a628e8 100644 --- a/changelog.d/lha-sar-non-dep-per-scheme.fixed.md +++ b/changelog.d/lha-sar-non-dep-per-scheme.fixed.md @@ -1 +1 @@ -- The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`universal_credit_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. Within the benefit unit, both tests now leave out the household head and a member who pays the household head as a boarder or lodger, as the non-dependant deductions already did (UC Sch 4 para 9(2)(d)-(e); HB reg 3(2)(d)-(e) and (4)), so such a member no longer stops a family getting the shared accommodation rate. `universal_credit_renter_has_non_dependant` replaces `lha_renter_has_non_dependant`. +The LHA shared accommodation rate's non-dependant tests use each scheme's own definitions within the benefit unit. Universal Credit's (`universal_credit_renter_has_non_dependant`; UC Regs 2013 Sch 4 paras 9 and 28) uses the UC non-dependant and qualifying young person instead of a blend of both schemes' young person tests, and the UC specified-renter test reads UC responsibility only (para 28(3)). Housing Benefit's (`housing_benefit_has_non_dependant`; HB Regs 2006 regs 3 and 13D(2)(a)(i)) uses the Child Benefit young person. Neither treats every 16-year-old as a dependant. Within the benefit unit, both tests now leave out the household head and a member who pays the household head as a boarder or lodger, as the non-dependant deductions already did (UC Sch 4 para 9(2)(d)-(e); HB reg 3(2)(d)-(e) and (4)), so such a member no longer stops a family getting the shared accommodation rate. The Housing Benefit severe disability premium's non-dependant test leaves out the household head and a member who pays them too (HB reg 3(2)(d)-(e) and (4); Sch 3 para 14). `universal_credit_renter_has_non_dependant` replaces `lha_renter_has_non_dependant`. From db8f457a817cb8ac5acba79969cc041920ea6c99 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 14:11:47 -0500 Subject: [PATCH 21/22] Add the school leaver to the below-19 agreement property's examples Its one explicit example, the 19-year-old in education, is outside the property's under-19 predicate, so it checked nothing. The 16-year-old school leaver is a non-dependant under both schemes, so the property now compares the two definitions on at least one fixed member. Co-Authored-By: Claude Opus 5.5 --- .../tests/test_lha_shared_rate_non_dependant_properties.py | 1 + 1 file changed, 1 insertion(+) diff --git a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py index 2b65f9250c..e0bd6ad3c4 100644 --- a/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py +++ b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py @@ -356,6 +356,7 @@ def test_a_non_dependant_deduction_implies_a_non_dependant(pop): @PROPERTY_SETTINGS @given(population) +@example(SCHOOL_LEAVER) @example(NINETEEN_IN_EDUCATION) def test_uc_and_hb_non_dependant_definitions_agree_below_19(pop): sim, people, _ = build(pop) From c39a1ffe77610e0a766a6cb9e084fe047ad96c3d Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Mon, 16 Nov 2026 19:17:42 -0500 Subject: [PATCH 22/22] Scope the shared-rate YAML introduction to its parent-and-child cases The introduction said every 16-year-old outside the young person tests is a non-dependant and everyone aged 16 or over has a bedroom. Both hold only for the first three cases; later cases cover the exclusions. Co-Authored-By: Claude Opus 5.5 --- .../LHA_shared_accommodation_non_dependants.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml index 8b30899a2d..1693328881 100644 --- a/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -11,15 +11,17 @@ # claimant, so not a lone parent responsible for a child or young person # (reg 2(1)). # -# A 16-year-old is a dependant only within each scheme's young person test. +# In the first three cases, ordinary parent-and-child households, a child aged +# 16 or over is a dependant only within each scheme's young person test. # Outside it, they are a non-dependant. Either way the renter misses the shared -# rate. The cases with a 16-year-old set +# rate. Later cases cover looked-after and foster children, joint tenants, +# lodgers, a payer and the household head. The cases with a 16-year-old set # is_before_first_september_following_16th_birthday to false for every person, # so that neither UC reg 5(1)(a) nor Child Benefit (General) Regs 2006 reg 4 # holds: a 16-year-old in education is a young person through education alone. # -# Bedrooms: everyone aged 16 or over other than the claimant or partner has a -# bedroom (UC Sch 4 para 10(1)(b)-(c); HB reg 13D(3)(b)), so 1 + 1 = 2: C. +# Bedrooms: in those three cases the child aged 16 or over has a bedroom of +# their own (UC Sch 4 para 10(1)(b)-(c); HB reg 13D(3)(b)), so 1 + 1 = 2: C. - name: A 16-year-old who has left education is a non-dependant under both schemes period: 2026