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/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..bbf50e0adc --- /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] + lha_renter_has_non_dependant: [true, false, false] + +- name: A joint tenant's sister counts only for that tenant (LHA Guidance Manual 2.093 example 2) + period: 2026 + absolute_error_margin: 0.01 + input: + people: + sarah: + age: 30 + is_household_head: true + is_male: false + rachel: + age: 30 + is_male: false + susan: + age: 28 + is_male: false + household_benefits_individual_non_dep_deduction: 1_000 + council_tax_reduction_individual_non_dep_deduction: 300 + benunits: + sarah_family: + members: [sarah] + rachel_family: + members: [rachel] + liable_for_share_of_household_rent: true + susan_family: + members: [susan] + non_dependant_normally_resides_with: HOUSEHOLD_HEAD_FAMILY + households: + home: + members: [sarah, rachel, susan] + rent: 20_800 + tenure_type: RENT_PRIVATELY + brma: MAIDSTONE + output: + # Sarah: herself and Susan, 2 bedrooms, the two-bedroom rate. Rachel: + # 1 bedroom, a young individual with no non-dependant (13D(2)(a)(i)), and + # she shares the dwelling's rooms in any case (13D(2)(a)(ii)): the shared + # accommodation rate. + housing_benefit_LHA_allowed_bedrooms: [2, 1, 1] + housing_benefit_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/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..581260fff5 --- /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", + "lha_renter_has_non_dependant", + ]: + reference = calc(sims[0][0], variable) + for sim, _ in sims[1:]: + np.testing.assert_allclose( + calc(sim, variable), reference, atol=MONEY_TOLERANCE + ) + + +@PROPERTY_SETTINGS +@given(population) +def test_severe_disability_premium_reads_the_same_residence(population): + """A joint occupier whose claimant and partner receive the daily living + component of Personal Independence Payment meets the severe disability + premium conditions (HB Regs 2006 Sch 3 para 14(2)(a)) exactly when no + non-dependant resides with them (reg 3; + housing_benefit_has_non_dependant). Every generated non-dependant family + has an adult aged 18 or over with no qualifying benefit, so the two + tests name the same families. The household heads' families receive the + component in one population and the sharers' in the other. The other + joint occupiers then receive no qualifying benefit, which tests that + they are never non-dependants, whatever their rent.""" + for role in ["head", "sharer"]: + sim, roles = build(population, disabled_roles=(role,)) + disabled = roles == role + applies = calc(sim, "housing_benefit_severe_disability_premium_applies") + has_non_dependant = calc(sim, "housing_benefit_has_non_dependant") + np.testing.assert_array_equal( + applies[disabled], 1 - has_non_dependant[disabled] + ) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_non_dependant.py index 9880fa79f2..1e14db7a87 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): @@ -11,16 +14,20 @@ class housing_benefit_has_non_dependant(Variable): "as a foster child or for adoption), 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): @@ -39,7 +46,13 @@ def formula(benunit, period, parameters): ) 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..cd3c5bfedf 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_severe_disability_premium_applies.py @@ -1,4 +1,7 @@ from policyengine_uk.model_api import * +from policyengine_uk.variables.household.consumption.rent.non_dependant_normally_resides_with import ( + non_dependants_residing_with, +) class housing_benefit_severe_disability_premium_applies(Variable): @@ -10,7 +13,12 @@ class housing_benefit_severe_disability_premium_applies(Variable): "Benefit severe disability premium: the claimant (and any partner) " "receives a qualifying disability benefit, and no non-dependant aged " "18 or over normally resides with them, other than one who receives " - "a qualifying benefit or is blind. A partner who is blind and " + "a qualifying benefit or is blind. Where the rent is shared, another " + "family's non-dependant resides with each joint occupier that " + "non_dependant_normally_resides_with gives, by default every one, " + "and a joint occupier's own family is never another's " + "non-dependant, whatever its rent (as for " + "housing_benefit_has_non_dependant). A partner who is blind and " "receives no qualifying benefit is treated as not being the " "claimant's partner, so the claimant is tested as a single person. " "Not modelled: who receives Carer's Allowance, Carer Support Payment " @@ -22,6 +30,8 @@ class housing_benefit_severe_disability_premium_applies(Variable): reference = ( "https://www.legislation.gov.uk/uksi/2006/213/schedule/3/paragraph/14", "https://www.legislation.gov.uk/uksi/2006/214/schedule/3/paragraph/6", + "https://www.legislation.gov.uk/uksi/2006/213/regulation/3", + "https://www.legislation.gov.uk/uksi/2006/214/regulation/3", ) def formula(benunit, period, parameters): @@ -53,10 +63,14 @@ def formula(benunit, period, parameters): ) | person("is_child_or_young_person_placed_with_family", period) within = benunit.any(adult_non_dependant & ~claimant_or_partner & ~young_person) liable_family = benunit.any(person("is_liable_for_household_rent", period)) - outside = benunit.max( - person.household.sum( - adult_non_dependant - & person("is_non_dependant_of_household_head", period) - ) + # Outside the family, reg 3(1), (2)(d) and (4): the non-dependants + # who normally reside with this joint occupier + # (non_dependant_normally_resides_with; LHA Guidance Manual paras + # 2.093 and 2.110). A member of a joint occupier's family is no one's + # non-dependant, even where the family has no rent of its own. + outside = non_dependants_residing_with( + benunit, + period, + adult_non_dependant & person("is_non_dependant_of_household_head", period), ) return all_qualify & ~within & ~(liable_family & (outside > 0)) 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_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/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