diff --git a/changelog.d/2029.fixed.md b/changelog.d/2029.fixed.md new file mode 100644 index 0000000000..be7a1fdac0 --- /dev/null +++ b/changelog.d/2029.fixed.md @@ -0,0 +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 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/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..43f4a628e8 --- /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 (`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`. 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..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,8 @@ 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). LHA_category: A @@ -24,7 +25,8 @@ 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. LHA_category: A @@ -69,7 +71,8 @@ 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 # employment does not count), but a non-dependant blocks A. The @@ -99,7 +102,8 @@ 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 # para 10(1)(b)): 1 + 1 = 2: C. @@ -128,7 +132,8 @@ 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 # of a couple claiming as a single person" under 35 (Sch 4 para 28(2); @@ -187,7 +192,8 @@ 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 # non-dependant: 1 + 1 non-dependant aged 16+ = 2: C. Only the household @@ -214,7 +220,8 @@ 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 # student's own family has no non-dependant: A. @@ -240,7 +247,8 @@ 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 # to the other. Renter: single, 30 < 35, no non-dependant: A. Household @@ -266,7 +274,8 @@ 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. LHA_category: [A, 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 new file mode 100644 index 0000000000..051bdd3449 --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_joint_tenants_shared_non_dependant.yaml @@ -0,0 +1,947 @@ +# 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 (uc_non_dependants_counted), in +# these cases the household head's family's. +# +# 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_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] + 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 + 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_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_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_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_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 is an occupier for each joint tenant and no one's non-dependant + 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)), so non_dependant_normally_resides_with does not reach them. + # They occupy the dwelling as their home and are not a joint tenant, so + # they are an occupier in each claim by a family liable for the rent + # (reg 13D(12)), as before. + housing_benefit_LHA_allowed_bedrooms: [2, 2, 1] + housing_benefit_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] + +- 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_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: + # The household head's family, the only one that claims + # (council_tax_reduction_claimant_benunit), has every other family's + # deductions: 300 + 200. A family that does not claim bears none under + # the national schemes. The local scheme's variable gives every family + # every other family's deductions (only the claimant's value is used): + # 300 + 200, 200 and 300. + council_tax_reduction_non_dep_deductions: [500, 0, 0] + 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] + +- 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, 0, 0] + 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] + +- name: A sharer's own adult son is every joint tenant's non-dependant while the head's friend is the head's alone + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + sharer: + age: 45 + son: + age: 20 + household_benefits_individual_non_dep_deduction: 400 + council_tax_reduction_individual_non_dep_deduction: 200 + friend: + age: 38 + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + head_family: + members: [head] + sharer_family: + members: [sharer, son] + liable_for_share_of_household_rent: true + friend_family: + members: [friend] + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [head, sharer, son, friend] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + is_claimant_or_partner: [true, true, false, true] + # The son is a non-dependant within the sharer's own benefit unit. The + # input is on a non-dependant's family, not a joint occupier's, so the + # deduction formulas keep him as every joint occupier's: half of 400 each + # (reg 74(5)) and half of 200 each (CTR Sch 1 para 8(5)). The friend + # resides with the head only, who bears all of 1,000 and of 300 (HBGM A5 + # para 5.622). + housing_benefit_non_dep_deductions: [1_200, 200, 0] + council_tax_reduction_non_dep_deductions: [400, 100, 0] + # Size criteria: the head counts the friend; the sharer counts the son, + # a member of the sharer's own family, and not the friend. + housing_benefit_LHA_allowed_bedrooms: [2, 2, 1] + housing_benefit_has_non_dependant: [true, true, false] + +- name: A lodger's adult son who pays nothing follows the input while the lodger stays an occupier for each joint tenant + period: 2026 + absolute_error_margin: 0.01 + input: + people: + head: + age: 40 + is_household_head: true + sharer: + age: 45 + lodger: + age: 50 + rent_paid_as_lodger: 5_200 + lodger_son: + age: 22 + household_benefits_individual_non_dep_deduction: 600 + benunits: + head_family: + members: [head] + sharer_family: + members: [sharer] + liable_for_share_of_household_rent: true + lodger_family: + members: [lodger, lodger_son] + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [head, sharer, lodger, lodger_son] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Reg 3(2)(e) takes out only the person liable to pay the householder, + # so the son is a non-dependant and the lodger is not. + pays_rent_to_householder: [false, false, true, false] + is_non_dependant_of_household_head: [false, false, false, true] + # The lodger is an occupier in each joint tenant's claim (reg 13D(12)); + # the son resides with the head only. The lodger's own claim counts the + # lodger's own family. + 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/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..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,8 @@ # 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 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. + 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 new file mode 100644 index 0000000000..1693328881 --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/LHA_shared_accommodation_non_dependants.yaml @@ -0,0 +1,591 @@ +# 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)). +# +# 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. 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: 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 + 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 + 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 + # 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 + 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] + 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 + 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. + 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 + 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 + # 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 + 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 + # 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] + 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 + 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] + 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 + 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. + 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 + # joint occupier's own benefit unit for that occupier only; the + # non_dependant_normally_resides_with input covers other families' + # 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] + # 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 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: + 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. + 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), + # (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 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 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: + 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] + 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 0e02c834d3..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,8 @@ 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] # HB reg 13D(2)(a)(i): a young individual with no non-dependant: A. 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..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 @@ -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,11 +306,15 @@ 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("lha_renter_has_non_dependant", period) + & ~benunit("universal_credit_renter_has_non_dependant", period) & ~excepted_disabled_renter ) @@ -933,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 + ) 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 new file mode 100644 index 0000000000..a068f08b40 --- /dev/null +++ b/policyengine_uk/tests/test_joint_tenant_shared_non_dependant_properties.py @@ -0,0 +1,513 @@ +"""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 deductions for + its non-dependants (one for each non-dependant couple, the higher of the + 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 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 + Council Tax Reduction deductions equal the previous formula (the + deductions outside the family times + 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 rent-based non-dependant + flag counts a joint occupier with no rent of its own (no household rent, + or a supplied zero share) as a non-dependant; leaving it out is the + intended correction. The Council Tax Reduction comparison covers the + applicants under the household head's scheme, whose amounts the + person-level deduction reports. +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. +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 +from hypothesis import HealthCheck, assume, 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) +# 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 +def family(draw, max_adults=2): + return dict( + 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), + ) + + +@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.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.one_of(st.just(0.0), st.floats(0.05, 1)), + min_size=3, + max_size=3, + ), + ) + ), + ) + + +population = st.lists(households(), min_size=1, max_size=5) + + +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. ``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): + 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}, + } + 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" + 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} + 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 + + weights = house["share_weights"] + shares = [None] * (1 + len(house["sharers"])) + 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: + # 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}, + **share_input(f + 1), + }, + ) + 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 + }, + **({"share_of_household_rent": {YEAR: 0.0}} if supplied else {}), + }, + ) + if house["lodger"]: + ids = add_family( + 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}"] = { + "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 per_family_deduction(sim, person_values): + """Each family's deduction for its members' amounts: one for the claimant + or couple, the higher of the two members' (HB Regs 2006 reg 74(3); SI + 2012/2885 Sch 1 para 8(3)), and one for each other member.""" + person_benunit = sim.populations["benunit"].members_entity_id + count = sim.populations["benunit"].count + couple = calc(sim, "is_claimant_or_partner").astype(bool) + higher = np.zeros(count) + np.maximum.at(higher, person_benunit[couple], person_values[couple]) + others = np.bincount( + person_benunit, weights=person_values * ~couple, minlength=count + ) + return higher + others + + +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 under_head_scheme(sim, roles): + """Whether each family's Council Tax Reduction scheme (pensioner or + working-age) is the household head's family's. + council_tax_reduction_individual_non_dep_deduction is each person's + deduction under that scheme; an applicant under the other scheme has its + deductions recomputed, as each claim is assessed under its own family's + scheme.""" + pensioner = calc(sim, "council_tax_reduction_pensioner") + head_scheme = per_household(sim, pensioner * (roles == "head")) + 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)] + > 0 + ) + + +@PROPERTY_SETTINGS +@given(population) +def test_housing_benefit_deductions_are_conserved(population): + sim, roles = build(population) + # 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)). + individual = ( + calc(sim, "household_benefits_individual_non_dep_deduction") + * calc(sim, "is_non_dependant_of_household_head") + * ~in_joint_occupier_family(sim, roles) + ) + # One deduction for each non-dependant couple (reg 74(3)). + deductions = per_family_deduction(sim, individual) + families = calc(sim, "housing_benefit_non_dep_deductions") + np.testing.assert_allclose( + per_household(sim, families), + 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) + + +@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 >= -MONEY_TOLERANCE) + # 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) + 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") + 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) + + +@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 household + head's family, the only one that claims, has the deductions of every + other family (one for each couple, Sch 1 para 8(3)), and a family that + does not claim has none.""" + sim, roles = build(population) + deductions = calc(sim, "council_tax_reduction_individual_non_dep_deduction") + own = per_family_deduction(sim, deductions) + previous = (roles == "head") * ( + per_household(sim, own)[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=MONEY_TOLERANCE, + ) + + +@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") + # One deduction for each non-dependant couple (HB reg 74(3); CTR Sch 1 + # para 8(3)). + previous_hb = ( + share * per_household(sim, per_family_deduction(sim, hb_individual))[household] + ) + ctr_individual = calc(sim, "council_tax_reduction_individual_non_dep_deduction") + own = per_family_deduction(sim, ctr_individual) + previous = (per_household(sim, own)[household] - own) * calc( + sim, "council_tax_reduction_joint_liability_share" + ) + joint_occupier = (roles == "head") | (roles == "sharer") + # The rent-based non-dependant flag counts 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 + ) + # The person-level deductions are under the household head's family's + # scheme, so compare the applicants under that scheme. + compared = joint_occupier & positive_rent & under_head_scheme(sim, roles) + np.testing.assert_allclose( + calc(sim, "council_tax_reduction_non_dep_deductions")[compared], + previous[compared], + atol=MONEY_TOLERANCE, + ) + + +@PROPERTY_SETTINGS +@given(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") + 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] + MONEY_TOLERANCE + ) + 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] + MONEY_TOLERANCE + ) + + +@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_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=MONEY_TOLERANCE + ) + for variable in [ + "LHA_allowed_bedrooms", + "uc_non_dep_deductions", + "universal_credit_renter_has_non_dependant", + ]: + reference = calc(sims[0][0], variable) + for sim, _ in sims[1:]: + 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/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 new file mode 100644 index 0000000000..e0bd6ad3c4 --- /dev/null +++ b/policyengine_uk/tests/test_lha_shared_rate_non_dependant_properties.py @@ -0,0 +1,458 @@ +"""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 (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). + +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. 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). 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 + 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 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 +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)), + # 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()), + ) + + +@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, + pays_householder=False, +): + 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, + pays_householder=pays_householder, + ) + + +def _house( + renter_age, + members, + other=None, + other_age=30, + other_members=(), + member_is_head=False, +): + 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), + # The inputs flag the renter's first member, not the renter, as the + # household head. + member_is_head=member_is_head, + ) + + +# 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), +] +# 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): + people, benunits, homes = {}, {}, {} + rows = [] + 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", + 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 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, + "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": 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"] + 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" + ], + } + 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": + 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)) + + +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 + and not liable[p] + ] + # 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) +@example(PAYER) +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, "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) + 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(SCHOOL_LEAVER) +@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, "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, "universal_credit_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, "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 + 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, "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/housing_benefit/housing_benefit_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py index 9880fa79f2..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 @@ -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_has_non_dependant(Variable): @@ -6,40 +9,55 @@ 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, 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 " - "is_non_dependant_of_household_head). A non-dependant normally " - "residing in the dwelling resides with each joint occupier. A " - "boarder's or lodger's family has none from the householder's " - "household." + "is_non_dependant_of_household_head) and normally resides with it. " + "Where the rent is shared, a non-dependant resides with each joint " + "occupier that non_dependant_normally_resides_with gives, by default " + "every one; a joint occupier's own family is never another's " + "non-dependant, whatever its rent. A boarder's or lodger's family " + "has none from the householder's household." ) 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://www.legislation.gov.uk/uksi/2006/213/regulation/74", + "https://assets.publishing.service.gov.uk/media/5a758238ed915d6faf2b38a2/lha-guidance-manual.pdf#page=33", ) 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)) - non_dependants = benunit.max( - person.household.sum(person("is_non_dependant_of_household_head", period)) + # Reg 3(1), (2)(d) 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). A member of a joint + # occupier's family is no one's non-dependant, even where the family + # has no rent of its own. + non_dependants = non_dependants_residing_with( + benunit, period, person("is_non_dependant_of_household_head", period) ) return within_benefit_unit | (liable_family & (non_dependants > 0)) 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..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 @@ -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,15 @@ 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. 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 " + "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 +33,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): @@ -45,18 +58,22 @@ 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 = 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)) 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 b8e5ec94a1..630da44f02 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 @@ -2,6 +2,11 @@ from policyengine_uk.variables.gov.dwp.housing_benefit.non_dep_deduction._non_dependants import ( deduction_per_family, ) +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + apportioned_non_dependant_deductions, + outside_joint_occupiers, + resides_with_every_joint_occupier, +) class housing_benefit_non_dep_deductions(Variable): @@ -15,8 +20,13 @@ class housing_benefit_non_dep_deductions(Variable): "claimant, partner or a child or young person. One deduction for " "each non-dependant couple, the higher of the two members' amounts, " "and one for each other non-dependant. The council apportions each " - "between the joint occupiers by their shares of the rent, whichever " - "family the non-dependant is in. None if the claimant or partner is " + "between the joint occupiers the non-dependant normally resides with " + "by their shares of the rent: every joint occupier for a " + "non-dependant within a joint occupier's own benefit unit, and those " + "that non_dependant_normally_resides_with gives for another family's, " + "by default every one. One who resides with only one joint occupier " + "is deducted in full from that occupier. None if the claimant or " + "partner is " "exempt. A boarder or lodger bears none, even for a non-dependant in " "its own benefit unit, such as an adult son who pays nothing. He " "normally resides with the lodger as well as the householder, and we " @@ -52,15 +62,22 @@ def formula(benunit, period, parameters): # occupier, the council apportions the deduction 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 it. + # For one who resides with only one joint occupier, the council takes + # the whole deduction from that occupier (HB Guidance Manual A5 para + # 5.622). Which joint occupiers another family's non-dependant resides + # with is non_dependant_normally_resides_with. # A family bearing a share is a joint occupier, never another family's # non-dependant, even where the rent is nil and so the family is not - # benunit_is_rent_liable. + # benunit_is_rent_liable; nor is the household head's family or a + # sharer's, whatever share it has or is given (reg 3(2)(a), (d)). person = benunit.members deductions = person("household_benefits_individual_non_dep_deduction", period) in_joint_occupier_family = person.benunit("share_of_household_rent", period) > 0 + outside = outside_joint_occupiers(benunit, period) other_family = ( person("is_non_dependant_of_household_head", period) & ~in_joint_occupier_family + & outside ) # A member of a rent-liable family who is not in its claimant's # family under reg 3(2)(a) and (c) is a non-dependant too. That takes @@ -83,7 +100,20 @@ def formula(benunit, period, parameters): ) counted = person("is_benunit_head", period) * benunit.project(family_amount) share = benunit("share_of_household_rent", period) - from_joint_occupiers = share * benunit.max(person.household.sum(counted)) + # A non-dependant of every joint occupier: by their shares of the + # rent. That is one within a joint occupier's own benefit unit, and + # another family's unless non_dependant_normally_resides_with says + # otherwise. + every = resides_with_every_joint_occupier(benunit, period) + of_every_joint_occupier = share * benunit.max( + person.household.sum(counted * every) + ) + # One who resides with only some of the joint occupiers: between + # those, by their shares of the rent among themselves. + of_some_joint_occupiers = apportioned_non_dependant_deductions( + benunit, period, counted * ~every, equally=False + ) + from_joint_occupiers = of_every_joint_occupier + of_some_joint_occupiers # A boarder or lodger, with no share of the rent, bears none, even # for a non-dependant in its own benefit unit (see the documentation). claimant_exempt = benunit( 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 6d0b7bce5e..c3704f0d35 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): @@ -14,7 +17,10 @@ class housing_benefit_LHA_additional_bedrooms(Variable): "Occupiers outside the family count for a family liable for the " "rent: non-dependants, boarders and lodgers and their children, " "including a child placed with one of them as a foster child or for " - "adoption, but not a sharer of the rent. A child placed with the " + "adoption, but not a sharer of the rent. Where the rent is shared, a " + "non-dependant and their children count for each joint occupier they " + "normally reside with, as in housing_benefit_LHA_allowed_bedrooms. A " + "child placed with the " "claimant or partner counts as one for whom they are a qualifying " "parent or carer. Before 1 April 2017 only the claimant and partner " "counted for overnight care. The definitions require a bedroom in " @@ -51,7 +57,11 @@ def formula(benunit, period, parameters): ) other = overnight_care & ~liable_family is_liable_claim = benunit.any(person("is_liable_for_household_rent", period)) - others = where(is_liable_claim, benunit.max(person.household.sum(other)), 0) + # A non-dependant counts for each joint occupier they normally reside + # with (see housing_benefit_other_occupiers). + others = where( + is_liable_claim, housing_benefit_other_occupiers(benunit, period, other), 0 + ) # 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. Before 1 April 2017 (SI 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 baa3b8e976..11ddaa3249 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,30 @@ from policyengine_uk.variables.gov.dwp.LHA_allowed_bedrooms import ( child_bedrooms, ) +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 sum of ``other_occupier`` (a count or weight for + each occupier outside every family liable for the household's rent, zero + for anyone else) over the people who occupy its dwelling (HB Regs 2006 + reg 13D(12)), before the caller limits it to claims by families liable + for the rent. A boarder or lodger who pays the householder occupies the + dwelling of every such claim. A non-dependant, and anyone else who pays + nothing, counts for each joint occupier they normally reside with (LHA + Guidance Manual paras 2.093 and 2.110; see + non_dependant_normally_resides_with), by default every one.""" + person = benunit.members + boarder_or_lodger = person("pays_rent_to_householder", period) + of_every_claim = 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_every_claim + non_dependants class housing_benefit_LHA_allowed_bedrooms(Variable): @@ -19,7 +43,10 @@ class housing_benefit_LHA_allowed_bedrooms(Variable): "outside the claimant's household. For the household head's family " "or a sharer's, that is its own family, the household's " "non-dependants and anyone paying the householder rent, with their " - "children (but not the other families liable for the rent). A " + "children (but not the other families liable for the rent). 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). A " "boarder's or lodger's own claim counts only their own family. A " "child or young person placed with the claimant or partner as a " "foster child or for adoption does not occupy the claimant's " @@ -60,9 +87,13 @@ def formula(benunit, period, parameters): # out. placed = person("is_child_or_young_person_placed_with_family", period) + # A non-dependant shared by joint tenants counts in each one's size + # criteria (LHA Guidance Manual para 2.110); one who lives with one + # joint tenant only counts for that tenant alone (para 2.093, example + # 2). See housing_benefit_other_occupiers. def occupiers_total(values): own = benunit.sum(values & ~placed) - others = benunit.max(person.household.sum(values & other)) + others = housing_benefit_other_occupiers(benunit, period, values & other) return own + where(is_liable_claim, others, 0) # 13D(3)(zb), (a): one bedroom for each couple or single claimant. A 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 4711d7db9a..684156a280 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_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 " 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..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 @@ -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 " + "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 " @@ -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,15 +67,16 @@ 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 + # universal_credit_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) + & ~benunit("universal_credit_renter_has_non_dependant", period) & ~excepted_disabled_renter & ~excepted_foster_parent ) 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 76af907354..1301b27140 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 @@ -20,9 +20,12 @@ class is_non_dependant_of_household_head(Variable): "person (UC Regs 2013 Sch 4 para 9(2)(g)) and an adult their own " "family's claim counts (para 9(2)(f)). Universal Credit counts a " "non-dependant in one claim only " - "(uc_non_dependants_counted); Housing Benefit and Council Tax " - "Reduction apportion a non-dependant of several joint occupiers " - "between them. Apart from a boarder's or lodger's payer and partner, " + "(uc_non_dependants_counted). 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. Apart " + "from a boarder's or lodger's payer and partner, " "the flag covers every member of a family outside those liable for " "the rent, children included. A non-dependant's own children are " "non-dependants too, but a child or qualifying young person looked " 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..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 @@ -4,28 +4,26 @@ 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; the reference + 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: 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 + (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 + (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 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/universal_credit_renter_has_non_dependant.py similarity index 57% 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 d792dfa077..4592198f2c 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,13 +4,18 @@ ) -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 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, 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). " @@ -27,35 +32,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 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 3488834bbe..e5b8ed3e9d 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,8 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + apportioned_non_dependant_deductions, + resides_with_every_joint_occupier, +) from policyengine_uk.variables.household.demographic.highest_education import ( EducationType, ) @@ -25,6 +29,45 @@ def is_full_time_student_non_dep(person, period): ) +def council_tax_reduction_joint_liability_non_dep_deductions( + benunit, period, family_amount, own_in_unit=0 +): + """Each family's deductions for the household's non-dependants, before + the applicant's exemption (``family_amount``, each family's deduction + for its own non-dependant members; ``own_in_unit``, the part of it for + the non-dependants within the family's own benefit unit). + + A non-dependant of every joint occupier is apportioned equally between + the 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): each family has + every other family's deductions and its own in-unit ones, times that + share. Where no family other than the household head's shares the rent, + that is every non-dependant, as before. + + Where one does, another family's non-dependant can instead reside with + only some of the joint occupiers (non_dependant_normally_resides_with). + That one is apportioned equally between the liable people among those + joint occupiers, and 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). + """ + person = benunit.members + counted = person("is_benunit_head", period) * benunit.project(family_amount) + every = resides_with_every_joint_occupier(benunit, period) + in_household = benunit.max(person.household.sum(counted * every)) + own = where(benunit.any(every), family_amount, 0) + share = benunit("council_tax_reduction_joint_liability_share", period) + of_every_joint_occupier = (in_household - own + own_in_unit) * share + of_some_joint_occupiers = apportioned_non_dependant_deductions( + benunit, period, counted * ~every, equally=True + ) + return of_every_joint_occupier + of_some_joint_occupiers + + def applicant_has_universal_credit(benunit, period): """Whether the Council Tax Reduction applicant has the benefit unit's Universal Credit award (council_tax_reduction_universal_credit_award), @@ -147,23 +190,19 @@ def local_non_dep_deductions( benunit.sum(deductions), deduction_for_benunit, ) - 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) + # equally between them (SI 2012/2885 Sch 1 para 8(5)); see + # council_tax_reduction_joint_liability_non_dep_deductions. + non_dependants = council_tax_reduction_joint_liability_non_dep_deductions( + benunit, period, deduction_for_benunit + ) # No deduction from an applicant who, or whose partner, is blind or gets a # qualifying disability benefit, whatever other claimants in the household # get (the councils' schemes follow SI 2012/2886 Sch para 30(6)). applicant_exempt = benunit( "council_tax_reduction_applicant_has_non_dep_exemption", period ) - return where( - applicant_exempt, 0, (deductions_in_household - deduction_for_benunit) * share - ) + return where(applicant_exempt, 0, non_dependants) 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 ccfa21cb6c..197afb543c 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 @@ -2,6 +2,9 @@ from policyengine_uk.variables.gov.dwp.housing_benefit.non_dep_deduction._non_dependants import ( deduction_per_family, ) +from policyengine_uk.variables.gov.local_authorities.council_tax_reduction._legacy import ( + council_tax_reduction_joint_liability_non_dep_deductions, +) from policyengine_uk.variables.gov.local_authorities.council_tax_reduction._national_non_dependants import ( household_head_family_is_pensioner, individual_non_dep_deduction, @@ -22,7 +25,9 @@ class council_tax_reduction_non_dep_deductions(Variable): "are not pensioners, when the couple's own Universal Credit award " "assesses either member), one for each other non-dependant, each " "under the applicant family's own scheme and apportioned between " - "jointly liable applicants; none if the applicant or partner is exempt." + "the jointly liable applicants the non-dependant normally resides " + "with (see non_dependant_normally_resides_with), by default every " + "one; none if the applicant or partner is exempt." ) definition_period = YEAR unit = GBP @@ -81,17 +86,20 @@ def formula(benunit, period, parameters): pensioner = head_family_pensioner ^ (scheme == "other") both = universal_credit_couple & ~pensioner family_amount = deduction_per_family(benunit, period, amounts, both) - # Each family's amount counted once. - counted = person("is_benunit_head", period) * benunit.project(family_amount) - in_household = benunit.max(person.household.sum(counted)) own_in_unit = deduction_per_family(benunit, period, amounts * in_unit, both) - non_dependants[scheme] = in_household - family_amount + own_in_unit + # A non-dependant of two or more jointly liable people is + # apportioned equally between them (Sch 1 para 8(5)), and one who + # resides with only one of them is that one's alone: each + # family's amount counted once, between the applicants the + # non-dependant normally resides with. + non_dependants[scheme] = ( + council_tax_reduction_joint_liability_non_dep_deductions( + benunit, period, family_amount, own_in_unit + ) + ) own_scheme_is_heads = ( benunit("council_tax_reduction_pensioner", period) == head_family_pensioner ) - # A non-dependant of two or more jointly liable people is apportioned - # equally between them (Sch 1 para 8(5)). - share = benunit("council_tax_reduction_joint_liability_share", period) # Only a family that claims bears deductions; a non-dependant's own # family does not. claims = benunit("council_tax_reduction_claimant_benunit", period) @@ -104,6 +112,5 @@ def formula(benunit, period, parameters): claims * where( own_scheme_is_heads, non_dependants["head"], non_dependants["other"] - ) - * 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 new file mode 100644 index 0000000000..1311695778 --- /dev/null +++ b/policyengine_uk/variables/household/consumption/rent/non_dependant_normally_resides_with.py @@ -0,0 +1,205 @@ +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. A boarder " + "or lodger who pays the householder is not a non-dependant, so the " + "input does not move them; it does move the members of their family " + "who pay nothing. Universal Credit does not use this input: a " + "non-dependant counts in one Universal Credit claim only (see " + "uc_non_dependants_counted)." + ) + 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 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("benunit_contains_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).""" + values = NonDependantResidence + head_family = benunit("benunit_contains_household_head", period) + sharer = benunit("liable_for_share_of_household_rent", period) & ~head_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), + (values.OTHER_JOINT_OCCUPIERS, where(rent_is_shared, sharer, head_family)), + ) + + +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. A non-dependant within a joint occupier's own benefit unit, such as + an adult son, is not outside: the deduction formulas count him for every + joint occupier, and the size criteria in his own family.""" + person = benunit.members + head_family = person.benunit("benunit_contains_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. 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(source * (residence == value))) + count = count + joint_occupier * in_household + return count + + +def resides_with_every_joint_occupier(benunit, period): + """Whether each person, if a non-dependant, is every joint occupier's: + a member of a joint occupier's own family (such as an adult son in its + benefit unit), a member of another family that normally resides with + every joint occupier (non_dependant_normally_resides_with, the default), + or anyone where no family other than the household head's shares the + rent, when every value means the head's family. The deduction formulas + apportion such a non-dependant as they did before the input existed: by + the family's 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).""" + person = benunit.members + residence = person.benunit("non_dependant_normally_resides_with", period) + rent_is_shared = rent_shared_with_another_family(benunit, period) + return ( + ~outside_joint_occupiers(benunit, period) + | (residence == NonDependantResidence.EVERY_JOINT_OCCUPIER) + | ~benunit.project(rent_is_shared) + ) + + +def apportioned_non_dependant_deductions(benunit, period, deductions, equally): + """For each family, its part of the deductions for the household's + non-dependants who normally reside with only some of the joint occupiers + (``deductions``, one amount per person and zero for anyone who is not a + non-dependant; amounts on people for whom + resides_with_every_joint_occupier holds are left out, as the callers + apportion those themselves), 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 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 for the + council tax among them, counted as + council_tax_reduction_joint_liability_share counts them (see + council_tax_reduction_liable_person; students excluded from the scheme + are left out), and the whole where only the family is liable. A family + that is a non-dependant's only host, a couple included, bears the whole + deduction (HB Guidance Manual A5 para 5.622): 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). + """ + person = benunit.members + residence = person.benunit("non_dependant_normally_resides_with", period) + source = deductions * ~resides_with_every_joint_occupier(benunit, period) + if equally: + # The people council_tax_reduction_joint_liability_share divides by: + # those liable for the council tax, less students excluded from the + # scheme (SI 2012/2885 Sch 1 para 7(5)), the applicant always counted. + liable = person("council_tax_reduction_liable_person", period) + counted = liable & ~person("in_HE", period) + applicant_is_student = benunit.sum(counted) == 0 + else: + 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): + if value == values.EVERY_JOINT_OCCUPIER: + continue + liable_in_joint_occupiers = benunit.max( + person.household.sum(liable & benunit.project(joint_occupier)) + ) + if equally: + counted_in_joint_occupiers = benunit.max( + person.household.sum(counted & benunit.project(joint_occupier)) + ) + part = where( + (liable_in_family > 0) & (liable_in_joint_occupiers > liable_in_family), + 1 / max_(counted_in_joint_occupiers + applicant_is_student, 1), + 1, + ) + else: + 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