From 151693045e58f3569289df3e0c86ec74bb5d0871 Mon Sep 17 00:00:00 2001 From: the8thbit Date: Fri, 23 Oct 2026 14:18:18 -0500 Subject: [PATCH 1/5] Count Medicaid non-filer household members once --- .../fix-medicaid-nonfiler-duplicates.fixed.md | 1 + .../income/medicaid_household_income.yaml | 168 ++++++++++ .../income/medicaid_household_size.yaml | 309 ++++++++++++++++++ .../medicaid/income/_non_filer_household.py | 80 +++++ .../income/medicaid_household_income.py | 36 +- .../income/medicaid_household_size.py | 10 +- 6 files changed, 567 insertions(+), 37 deletions(-) create mode 100644 changelog.d/fix-medicaid-nonfiler-duplicates.fixed.md diff --git a/changelog.d/fix-medicaid-nonfiler-duplicates.fixed.md b/changelog.d/fix-medicaid-nonfiler-duplicates.fixed.md new file mode 100644 index 00000000000..d938af68e0d --- /dev/null +++ b/changelog.d/fix-medicaid-nonfiler-duplicates.fixed.md @@ -0,0 +1 @@ +Count overlapping applicant, spouse, parent and child-age members once in Medicaid non-filer household size and income when explicit parent links are absent. diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml index 50ac0ef050b..42878857d46 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml @@ -443,3 +443,171 @@ # parents ((f)(3)(iii)): 12,000 - 5,000 = 7,000 for all three. medicaid_uses_non_filer_rules: [true, true, true] medicaid_household_income: [7_000, 7_000, 7_000] + +# These member-income inputs isolate the composition sum after the filing exclusions. +- name: Non-filer membership counts each income once for young parents. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 1200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 2300 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 400 + medicaid_uses_non_filer_rules: true + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + medicaid_household_income: + - 3900 + - 3900 + - 3900 +- name: Non-filer membership counts each income once for an adult with a young spouse. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + parent1: + age: 35 + own_children_in_household: 1 + medicaid_household_income_member: 1200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 2300 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 400 + medicaid_uses_non_filer_rules: true + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + medicaid_household_income: + - 3900 + - 3900 + - 3900 +- name: Non-filer membership counts each income once for young spouses filing separately. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 1200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 2300 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 400 + medicaid_uses_non_filer_rules: true + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + tax_units: + return1: + members: + - parent1 + - child + cohabitating_spouses: true + return2: + members: + - parent2 + cohabitating_spouses: true + output: + medicaid_household_income: + - 3900 + - 3900 + - 3900 +- name: Non-filer membership counts each income once for young parents netting a business loss. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 1200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: -500 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 0 + medicaid_uses_non_filer_rules: true + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + medicaid_household_income: + - 700 + - 700 + - 700 diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml index e0d8a81bef7..620aca29594 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml @@ -97,3 +97,312 @@ state_code: KS output: medicaid_household_size: 1 + +# Non-filer members in 42 CFR 435.603(f)(3) form a union, even for young parents. +- name: Non-filing adults and their child keep the ordinary household size. + period: 2025 + input: + people: + parent1: + age: 35 + parent2: + age: 35 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: false + medicaid_uses_non_filer_rules: + - true + - true + - false + medicaid_household_size: + - 3 + - 3 + - 3 +- name: Filing adults and their child keep the ordinary household size. + period: 2025 + input: + people: + parent1: + age: 35 + employment_income: 50000 + parent2: + age: 35 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: true + medicaid_uses_non_filer_rules: + - false + - false + - false + medicaid_household_size: + - 3 + - 3 + - 3 +- name: Non-filing young spouses are counted once without parent-count inputs. + period: 2025 + input: + people: + parent1: + age: 18 + parent2: + age: 18 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: false + medicaid_uses_non_filer_rules: + - true + - true + - false + medicaid_household_size: + - 3 + - 3 + - 3 +- name: Filing young spouses keep their tax-unit household size. + period: 2025 + input: + people: + parent1: + age: 18 + employment_income: 50000 + parent2: + age: 18 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: true + medicaid_uses_non_filer_rules: + - false + - false + - false + medicaid_household_size: + - 3 + - 3 + - 3 +- name: Non-filing young parents and their child are each counted once. + period: 2025 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + parent2: + age: 18 + own_children_in_household: 1 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: false + medicaid_uses_non_filer_rules: + - true + - true + - false + medicaid_household_size: + - 3 + - 3 + - 3 +- name: Non-filing young parents add an expected child after counting members once. + period: 2025 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + parent2: + age: 18 + own_children_in_household: 1 + current_pregnancies: 1 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: false + medicaid_uses_non_filer_rules: + - true + - true + - false + medicaid_household_size: + - 4 + - 4 + - 4 +- name: Non-filing adult and young spouse are each counted once. + period: 2025 + input: + people: + parent1: + age: 35 + own_children_in_household: 1 + parent2: + age: 18 + own_children_in_household: 1 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_size: 3 + tax_unit_is_filer: false + medicaid_uses_non_filer_rules: + - true + - true + - false + medicaid_household_size: + - 3 + - 3 + - 3 + +- name: Young non-filing spouses on separate tax returns are each counted once. + period: 2025 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + parent2: + age: 18 + own_children_in_household: 1 + child: + age: 1 + marital_units: + couple: + members: + - parent1 + - parent2 + child_unit: + members: + - child + tax_units: + return1: + members: + - parent1 + - child + cohabitating_spouses: true + return2: + members: + - parent2 + cohabitating_spouses: true + households: + household: + members: + - parent1 + - parent2 + - child + state_code: CA + output: + tax_unit_is_filer: + - false + - false + medicaid_household_size: + - 3 + - 3 + - 3 diff --git a/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py b/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py index 18ba4c140c3..a4994ebb029 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py +++ b/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py @@ -7,12 +7,92 @@ ) from policyengine_us.variables.household.demographic.person._parent_links import ( has_parent_ids, + group_member_indices, household_has_parent_ids, household_member_indices, unlinked_parent, ) +def medicaid_non_filer_fallback_sum(person, period, values, spouse_sum, income=False): + """Deduplicate the existing family proxy when parent links are absent. + + Keep the proxy's family-level parent and child groups, and its tax-role + and cohabiting-spouse channels. The applicant and spouse take precedence + over relatives; parents take precedence over child-age relatives. For + income, keep own/spouse amounts signed, remaining parents netted within + each marital unit and floored, and remaining children's positive amounts. + ``spouse_sum`` retains the caller's fallback for an unidentified spouse. + """ + values = np.asarray(values, dtype=np.float64) + total = values + spouse_sum + own = np.arange(person.count) + child = person("medicaid_non_filer_child_age_eligible", period) + parent = person("is_parent", period) + head_or_spouse = person("is_tax_unit_head_or_spouse", period) + separate = ( + person.tax_unit("cohabitating_spouses", period) + & (person.tax_unit("head_spouse_count", period) == 1) + & (head_or_spouse | person("claimed_as_dependent_on_another_return", period)) + ) + spouse = np.full(person.count, -1, dtype=int) + matches = np.zeros(person.count, dtype=int) + for member in group_member_indices(person.tax_unit): + included = ( + (member >= 0) & (member != own) & head_or_spouse & head_or_spouse[member] + ) + spouse = np.where(included, member, spouse) + matches += included + for member in group_member_indices(person.marital_unit): + included = (member >= 0) & (member != own) & separate + spouse = np.where(included, member, spouse) + matches += included + # A larger, ambiguous group cannot identify which member is the spouse. + spouse = np.where(matches == 1, spouse, -1) + + if income: + marital_unit = person.marital_unit.reference_entity.members_entity_id + parent_income = person.marital_unit.sum(parent * values) + parent_count = person.marital_unit.sum(parent) + + for member in group_member_indices(person.family): + included = (member >= 0) & (member != own) & (member != spouse) + relative_parent = child & parent[member] + relative_child = child[member] & ~relative_parent + if income: + # Exclude direct members before netting the remaining parents; + # otherwise a young parent/spouse contributes in both groups. + own_parent = parent & (marital_unit == marital_unit[member]) + spouse_parent = ( + (spouse >= 0) + & parent[spouse] + & (marital_unit[spouse] == marital_unit[member]) + ) + remaining_income = ( + parent_income[member] + - own_parent * values + - spouse_parent * values[spouse] + ) + remaining_count = ( + parent_count[member] + - own_parent.astype(int) + - spouse_parent.astype(int) + ) + parent_share = np.divide( + np.maximum(0, remaining_income), + remaining_count, + out=np.zeros(person.count), + where=remaining_count > 0, + ) + amount = np.where( + relative_parent, parent_share, np.maximum(0, values[member]) + ) + else: + amount = values[member] + total += np.where(included & (relative_parent | relative_child), amount, 0) + return total + + def _shares_parent_id(parent_1, parent_2, member): """Whether each person shares a nonzero parent id with a co-resident.""" return ( diff --git a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py index 7decd3be91e..b8e949c43dc 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py +++ b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py @@ -5,6 +5,7 @@ ) from policyengine_us.variables.gov.hhs.medicaid.income._non_filer_household import ( medicaid_filer_spouse_sum, + medicaid_non_filer_fallback_sum, medicaid_non_filer_member_sum, medicaid_tax_dependent_spouse_sum, ) @@ -33,9 +34,9 @@ class medicaid_household_income(Variable): "siblings are read from the whole family, and those relatives' " "amounts are added only when positive (each child's, and each " "couple's parents' netted), so a relative outside the household " - "cannot lower its income. An adult's own amount and their spouse's " - "are added signed; a child's own amount and their siblings' enter " - "with the family's children, only when positive. Unmarried " + "cannot lower its income. The applicant's own amount and their spouse's " + "are added signed and excluded from the relatives' groups. A parent " + "who is also child-age is counted only as a parent. Unmarried " "co-resident parents are each counted only when positive." ) definition_period = YEAR @@ -46,7 +47,6 @@ class medicaid_household_income(Variable): ) def formula(person, period, parameters): - child_age_eligible = person("medicaid_non_filer_child_age_eligible", period) non_filer_rules = person("medicaid_uses_non_filer_rules", period) member_income = person("medicaid_household_income_member", period) required_to_file = person("medicaid_person_is_required_to_file", period) @@ -76,32 +76,8 @@ def formula(person, period, parameters): 0, ) spouse_income = same_unit_spouse_income + separate_spouse_income - # The non-filer household's parents and siblings are read from the - # whole family, which can include people outside the household, such - # as a grandparent who is also a parent there. So their amounts are - # added only when positive: each child's, and each couple's parents' - # netted together, so married parents' losses still offset each - # other's income. An adult's own and their spouse's amounts are added - # signed; a child's own amount is among the family's children. - family_child_income = person.family.sum( - child_age_eligible * max_(0, member_income) - ) - is_parent = person("is_parent", period) - couple_parent_income = person.marital_unit.sum(is_parent * member_income) - couple_parents = person.marital_unit.sum(is_parent) - parent_share = np.divide( - is_parent.astype(float), - couple_parents, - out=np.zeros_like(couple_parents, dtype=float), - where=couple_parents > 0, - ) - family_parent_income = person.family.sum( - parent_share * max_(0, couple_parent_income) - ) - non_filer_household_income = where( - child_age_eligible, - spouse_income + family_parent_income + family_child_income, - member_income + spouse_income + family_child_income, + non_filer_household_income = medicaid_non_filer_fallback_sum( + person, period, member_income, spouse_income, income=True ) # With parent links in the household, sum over the same members that # medicaid_household_size counts, adding every selected amount signed. diff --git a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_size.py b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_size.py index 1b01c40950e..8bf886f4bf0 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_size.py +++ b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_size.py @@ -5,6 +5,7 @@ ) from policyengine_us.variables.gov.hhs.medicaid.income._non_filer_household import ( medicaid_filer_spouse_sum, + medicaid_non_filer_fallback_sum, medicaid_non_filer_member_sum, medicaid_tax_dependent_spouse_sum, ) @@ -27,10 +28,7 @@ class medicaid_household_size(Variable): ) def formula(person, period, parameters): - child_age_eligible = person("medicaid_non_filer_child_age_eligible", period) non_filer_rules = person("medicaid_uses_non_filer_rules", period) - family_child_count = person.family.sum(child_age_eligible) - family_parent_count = person.family.sum(person("is_parent", period)) head_or_spouse = person("is_tax_unit_head_or_spouse", period) same_unit_spouse_count = head_or_spouse.astype(int) * ( person.tax_unit("head_spouse_count", period) - 1 @@ -45,10 +43,8 @@ def formula(person, period, parameters): int ) * cohabitating_separate.astype(int) spouse_count = same_unit_spouse_count + separate_spouse_count - non_filer_household_size = where( - child_age_eligible, - spouse_count + family_parent_count + family_child_count, - 1 + spouse_count + family_child_count, + non_filer_household_size = medicaid_non_filer_fallback_sum( + person, period, np.ones(person.count), spouse_count ) # With parent links in the household, count each member of the # applicant's own non-filer household once, spouse included. From 0afa161b44b1dc5ef21463bcce8bc601340d130e Mon Sep 17 00:00:00 2001 From: Ziming Date: Sun, 15 Nov 2026 13:53:01 -0500 Subject: [PATCH 2/5] Count a non-filer's same-unit spouse only on a joint return The Medicaid non-filer fallback now treats the other head or spouse as the spouse only on a joint return (head_spouse_count 2), as medicaid_household_size already counts the spouse and as _spouse_rule does for households with parent ids. Under a supplied non-joint filing status with an inferred spouse, such as a head of household parent and an 18-year-old, the fallback had excluded the 18-year-old as a relative without counting them as a spouse. medicaid_household_income applies the same joint-return test to the same-unit spouse's income, so size and income count the same people. Add the New Jersey partner household from issue 9562 to the size and adult group tests, and a head of household case to the size and income tests. Renumber the size cases in the file's style, keep their inputs and outputs, and drop the income case that the other cases cover. Replace += in the new helper, update two docstrings and rename the changelog fragment. Co-Authored-By: Claude Opus 5.5 --- ...edicaid-non-filer-household-once.fixed.md} | 0 .../categories/is_adult_for_medicaid.yaml | 26 ++ .../income/medicaid_household_income.yaml | 154 +++----- .../income/medicaid_household_size.yaml | 361 ++++++++---------- .../medicaid/income/_non_filer_household.py | 26 +- .../income/medicaid_household_income.py | 22 +- 6 files changed, 288 insertions(+), 301 deletions(-) rename changelog.d/{fix-medicaid-nonfiler-duplicates.fixed.md => medicaid-non-filer-household-once.fixed.md} (100%) diff --git a/changelog.d/fix-medicaid-nonfiler-duplicates.fixed.md b/changelog.d/medicaid-non-filer-household-once.fixed.md similarity index 100% rename from changelog.d/fix-medicaid-nonfiler-duplicates.fixed.md rename to changelog.d/medicaid-non-filer-household-once.fixed.md diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml index a7f6e4177f2..77fc9dfbce4 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml @@ -328,3 +328,29 @@ state_code: MO output: is_adult_for_medicaid_fc: [false, false, false, false] + +# A Household API partner reported this household (issue 9562): a New Jersey +# parent and an 18-year-old child with no relationship or tax-role inputs. The +# model takes the 18-year-old as the parent's spouse, and neither files. +- name: New Jersey parent of an 18-year-old with no role inputs is above the adult group limit + period: 2026 + absolute_error_margin: 0.001 + input: + people: + person1: + age: 45 + employment_income: 31_000 + person2: + age: 18 + households: + household: + members: [person1, person2] + state_code: NJ + output: + # Household of 2 (medicaid_household_size Case 12). 2026 guideline for 2: + # 15,960 + 5,680 = 21,640, and 31,000 / 21,640 = 1.4325. The 138% limit is + # 21,640 x 1.38 / 12 = 2,488.60, rounded up to 2,489 a month, a 1.3802 + # ratio. Counting the 18-year-old twice gave 3 and 31,000 / 27,320 = + # 1.1347, inside the limit. The 18-year-old is under the adult age range. + medicaid_income_level: [1.4325, 1.4325] + is_adult_for_medicaid: [false, false] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml index 42878857d46..38a564394c3 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml @@ -444,21 +444,24 @@ medicaid_uses_non_filer_rules: [true, true, true] medicaid_household_income: [7_000, 7_000, 7_000] -# These member-income inputs isolate the composition sum after the filing exclusions. -- name: Non-filer membership counts each income once for young parents. +# The next cases enter each member's MAGI-based income as an input, after the +# filing-threshold exclusions, to isolate who the non-filer household counts +# (42 CFR 435.603(f)(3)). Each member's amount enters once, as in +# medicaid_household_size. +- name: Non-filer membership counts each income once for an adult with an 18-year-old spouse. period: 2025 absolute_error_margin: 0.01 input: people: parent1: - age: 18 + age: 35 own_children_in_household: 1 - medicaid_household_income_member: 1200 + medicaid_household_income_member: 1_200 medicaid_uses_non_filer_rules: true parent2: age: 18 own_children_in_household: 1 - medicaid_household_income_member: 2300 + medicaid_household_income_member: 2_300 medicaid_uses_non_filer_rules: true child: age: 1 @@ -466,38 +469,32 @@ medicaid_uses_non_filer_rules: true marital_units: couple: - members: - - parent1 - - parent2 + members: [parent1, parent2] child_unit: - members: - - child + members: [child] households: household: - members: - - parent1 - - parent2 - - child + members: [parent1, parent2, child] state_code: CA output: - medicaid_household_income: - - 3900 - - 3900 - - 3900 -- name: Non-filer membership counts each income once for an adult with a young spouse. + # Each parent: self, spouse and child. The child: self and both parents. + # 1,200 + 2,300 + 400 = 3,900 for all three. + medicaid_household_income: [3_900, 3_900, 3_900] + +- name: Non-filer membership counts each income once for 18-year-old spouses filing separately. period: 2025 absolute_error_margin: 0.01 input: people: parent1: - age: 35 + age: 18 own_children_in_household: 1 - medicaid_household_income_member: 1200 + medicaid_household_income_member: 1_200 medicaid_uses_non_filer_rules: true parent2: age: 18 own_children_in_household: 1 - medicaid_household_income_member: 2300 + medicaid_household_income_member: 2_300 medicaid_uses_non_filer_rules: true child: age: 1 @@ -505,25 +502,26 @@ medicaid_uses_non_filer_rules: true marital_units: couple: - members: - - parent1 - - parent2 + members: [parent1, parent2] child_unit: - members: - - child + members: [child] + tax_units: + return1: + members: [parent1, child] + cohabitating_spouses: true + return2: + members: [parent2] + cohabitating_spouses: true households: household: - members: - - parent1 - - parent2 - - child + members: [parent1, parent2, child] state_code: CA output: - medicaid_household_income: - - 3900 - - 3900 - - 3900 -- name: Non-filer membership counts each income once for young spouses filing separately. + # The cohabiting spouse on the other return is the spouse: 3,900 for all + # three. + medicaid_household_income: [3_900, 3_900, 3_900] + +- name: Non-filer membership counts each income once for 18-year-old parents netting a business loss. period: 2025 absolute_error_margin: 0.01 input: @@ -531,83 +529,57 @@ parent1: age: 18 own_children_in_household: 1 - medicaid_household_income_member: 1200 + medicaid_household_income_member: 1_200 medicaid_uses_non_filer_rules: true parent2: age: 18 own_children_in_household: 1 - medicaid_household_income_member: 2300 + medicaid_household_income_member: -500 medicaid_uses_non_filer_rules: true child: age: 1 - medicaid_household_income_member: 400 + medicaid_household_income_member: 0 medicaid_uses_non_filer_rules: true marital_units: couple: - members: - - parent1 - - parent2 + members: [parent1, parent2] child_unit: - members: - - child + members: [child] households: household: - members: - - parent1 - - parent2 - - child + members: [parent1, parent2, child] state_code: CA - tax_units: - return1: - members: - - parent1 - - child - cohabitating_spouses: true - return2: - members: - - parent2 - cohabitating_spouses: true output: - medicaid_household_income: - - 3900 - - 3900 - - 3900 -- name: Non-filer membership counts each income once for young parents netting a business loss. - period: 2025 + # The spouse's loss is added signed: 1,200 - 500 = 700 for each parent. + # The child's married parents are netted before the floor: 700. + medicaid_household_income: [700, 700, 700] + +- name: Non-filer membership counts each income once for an 18-year-old taken as the spouse on a head of household return. + period: 2026 absolute_error_margin: 0.01 input: people: - parent1: - age: 18 - own_children_in_household: 1 - medicaid_household_income_member: 1200 - medicaid_uses_non_filer_rules: true - parent2: - age: 18 + parent: + age: 45 own_children_in_household: 1 - medicaid_household_income_member: -500 + medicaid_household_income_member: 1_200 medicaid_uses_non_filer_rules: true child: - age: 1 - medicaid_household_income_member: 0 + age: 18 + medicaid_household_income_member: 400 medicaid_uses_non_filer_rules: true - marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + tax_units: + tax_unit: + members: [parent, child] + filing_status: HEAD_OF_HOUSEHOLD households: household: - members: - - parent1 - - parent2 - - child - state_code: CA + members: [parent, child] + state_code: NJ output: - medicaid_household_income: - - 700 - - 700 - - 700 + # The model takes the 18-year-old as the tax unit spouse, but the return + # isn't joint, so neither is the other's spouse, as in + # medicaid_household_size. The parent's household has the 18-year-old as + # a child under 19, and the 18-year-old's has the parent: 1,200 + 400 = + # 1,600 for both. Main gave 2,000 and 2,800. + medicaid_household_income: [1_600, 1_600] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml index 620aca29594..cd232bcab6a 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml @@ -98,311 +98,286 @@ output: medicaid_household_size: 1 -# Non-filer members in 42 CFR 435.603(f)(3) form a union, even for young parents. -- name: Non-filing adults and their child keep the ordinary household size. +# 42 CFR 435.603(f)(3): a non-filer's household is the individual and, if +# living with them, their spouse, their children under 19 and, for an +# individual under 19, their parents and siblings under 19. Each person counts +# once, even when they fit more than one of those groups, such as a spouse who +# is also under 19 or a parent who is also under 19. Without parent ids the +# parents and children come from the family (is_parent and age). Cases 4-11 +# are the household examples in issue 9562. +- name: Case 4, non-filing adults and their child keep the ordinary household size. period: 2025 input: people: - parent1: + person1: age: 35 - parent2: + person2: age: 35 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: false - medicaid_uses_non_filer_rules: - - true - - true - - false - medicaid_household_size: - - 3 - - 3 - - 3 -- name: Filing adults and their child keep the ordinary household size. + medicaid_uses_non_filer_rules: [true, true, false] + # Each adult: self, spouse and child. The child: the tax household of 3. + medicaid_household_size: [3, 3, 3] + +- name: Case 5, filing adults and their child keep the ordinary household size. period: 2025 input: people: - parent1: + person1: age: 35 - employment_income: 50000 - parent2: + employment_income: 50_000 + person2: age: 35 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: true - medicaid_uses_non_filer_rules: - - false - - false - - false - medicaid_household_size: - - 3 - - 3 - - 3 -- name: Non-filing young spouses are counted once without parent-count inputs. + medicaid_uses_non_filer_rules: [false, false, false] + medicaid_household_size: [3, 3, 3] + +- name: Case 6, non-filing 18-year-old spouses without parent-count inputs are each counted once. period: 2025 input: people: - parent1: + person1: age: 18 - parent2: + person2: age: 18 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: false - medicaid_uses_non_filer_rules: - - true - - true - - false - medicaid_household_size: - - 3 - - 3 - - 3 -- name: Filing young spouses keep their tax-unit household size. + medicaid_uses_non_filer_rules: [true, true, false] + # Each spouse: self, spouse and child. Main also counted the spouse as a + # family member under 19, giving 4. + medicaid_household_size: [3, 3, 3] + +- name: Case 7, filing 18-year-old spouses keep their tax household size. period: 2025 input: people: - parent1: + person1: age: 18 - employment_income: 50000 - parent2: + employment_income: 50_000 + person2: age: 18 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: true - medicaid_uses_non_filer_rules: - - false - - false - - false - medicaid_household_size: - - 3 - - 3 - - 3 -- name: Non-filing young parents and their child are each counted once. + medicaid_uses_non_filer_rules: [false, false, false] + medicaid_household_size: [3, 3, 3] + +- name: Case 8, non-filing 18-year-old parents and their child are each counted once. period: 2025 input: people: - parent1: + person1: age: 18 own_children_in_household: 1 - parent2: + person2: age: 18 own_children_in_household: 1 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: false - medicaid_uses_non_filer_rules: - - true - - true - - false - medicaid_household_size: - - 3 - - 3 - - 3 -- name: Non-filing young parents add an expected child after counting members once. + medicaid_uses_non_filer_rules: [true, true, false] + # Each parent: self, spouse and child. Main gave 6: the spouse, both + # parents and the three people under 19. + medicaid_household_size: [3, 3, 3] + +- name: Case 9, non-filing 18-year-old parents add an expected child after counting members once. period: 2025 input: people: - parent1: + person1: age: 18 own_children_in_household: 1 - parent2: + person2: age: 18 own_children_in_household: 1 current_pregnancies: 1 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: false - medicaid_uses_non_filer_rules: - - true - - true - - false - medicaid_household_size: - - 4 - - 4 - - 4 -- name: Non-filing adult and young spouse are each counted once. + medicaid_uses_non_filer_rules: [true, true, false] + # Case 8's 3 members plus the 1 expected child, which California counts in + # every member's household (ca_medicaid_household_pregnancies). + medicaid_household_size: [4, 4, 4] + +- name: Case 10, a non-filing adult and an 18-year-old spouse are each counted once. period: 2025 input: people: - parent1: + person1: age: 35 own_children_in_household: 1 - parent2: + person2: age: 18 own_children_in_household: 1 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: tax_unit_size: 3 tax_unit_is_filer: false - medicaid_uses_non_filer_rules: - - true - - true - - false - medicaid_household_size: - - 3 - - 3 - - 3 + medicaid_uses_non_filer_rules: [true, true, false] + # Each parent: self, spouse and child. Main gave the adult 4 (the spouse + # again as a member under 19) and the 18-year-old 5. + medicaid_household_size: [3, 3, 3] -- name: Young non-filing spouses on separate tax returns are each counted once. +- name: Case 11, non-filing 18-year-old spouses on separate tax returns are each counted once. period: 2025 input: people: - parent1: + person1: age: 18 own_children_in_household: 1 - parent2: + person2: age: 18 own_children_in_household: 1 - child: + person3: age: 1 marital_units: - couple: - members: - - parent1 - - parent2 - child_unit: - members: - - child + marital_unit: + members: [person1, person2] + marital_unit2: + members: [person3] tax_units: - return1: - members: - - parent1 - - child + tax_unit1: + members: [person1, person3] cohabitating_spouses: true - return2: - members: - - parent2 + tax_unit2: + members: [person2] cohabitating_spouses: true households: household: - members: - - parent1 - - parent2 - - child + members: [person1, person2, person3] state_code: CA output: - tax_unit_is_filer: - - false - - false - medicaid_household_size: - - 3 - - 3 - - 3 + tax_unit_is_filer: [false, false] + # The cohabiting spouse on the other return is the spouse (42 CFR + # 435.603(f)(4)), counted once with the child. + medicaid_household_size: [3, 3, 3] + +# A Household API partner reported this household (issue 9562): a New Jersey +# parent and an 18-year-old child with no relationship or tax-role inputs. +- name: Case 12, a New Jersey parent and an 18-year-old with no role inputs are a household of two. + period: 2026 + input: + people: + person1: + age: 45 + employment_income: 31_000 + person2: + age: 18 + households: + household: + members: [person1, person2] + state_code: NJ + output: + # Without marital units or roles, the model takes the 18-year-old as the + # parent's spouse, so the return is joint and $31,000 is below the joint + # filing threshold: both use the non-filer rules. Main counted the + # 18-year-old as both spouse and member under 19, giving the parent 3. + medicaid_household_size: [2, 2] + +- name: Case 13, an 18-year-old taken as the spouse on a head of household return counts once as the parent's child. + period: 2026 + input: + people: + person1: + age: 45 + own_children_in_household: 1 + person2: + age: 18 + tax_units: + tax_unit: + members: [person1, person2] + filing_status: HEAD_OF_HOUSEHOLD + households: + household: + members: [person1, person2] + state_code: NJ + output: + # The model still takes the 18-year-old as the tax unit spouse, but the + # supplied filing status isn't joint, so neither is counted as the other's + # spouse. With no income neither files. The 18-year-old is the parent's + # child under 19 (435.603(f)(3)(ii)) and the parent is the 18-year-old's + # parent ((f)(3)(iii)). + is_tax_unit_spouse: [false, true] + tax_unit_is_filer: false + medicaid_uses_non_filer_rules: [true, true] + medicaid_household_size: [2, 2] diff --git a/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py b/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py index a4994ebb029..ea7cd550f7f 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py +++ b/policyengine_us/variables/gov/hhs/medicaid/income/_non_filer_household.py @@ -23,6 +23,12 @@ def medicaid_non_filer_fallback_sum(person, period, values, spouse_sum, income=F income, keep own/spouse amounts signed, remaining parents netted within each marital unit and floored, and remaining children's positive amounts. ``spouse_sum`` retains the caller's fallback for an unidentified spouse. + + The spouse is the one ``spouse_sum`` counts: the other head or spouse of + a joint return (head_spouse_count 2), or the cohabiting spouse on a + separate return. A head or spouse on a return that isn't joint, such as + an inferred spouse under a supplied HEAD_OF_HOUSEHOLD filing status, has + no spouse here, so a child-age partner still counts once as a relative. """ values = np.asarray(values, dtype=np.float64) total = values + spouse_sum @@ -30,23 +36,23 @@ def medicaid_non_filer_fallback_sum(person, period, values, spouse_sum, income=F child = person("medicaid_non_filer_child_age_eligible", period) parent = person("is_parent", period) head_or_spouse = person("is_tax_unit_head_or_spouse", period) + head_spouse_count = person.tax_unit("head_spouse_count", period) + joint = head_or_spouse & (head_spouse_count == 2) separate = ( person.tax_unit("cohabitating_spouses", period) - & (person.tax_unit("head_spouse_count", period) == 1) + & (head_spouse_count == 1) & (head_or_spouse | person("claimed_as_dependent_on_another_return", period)) ) spouse = np.full(person.count, -1, dtype=int) matches = np.zeros(person.count, dtype=int) for member in group_member_indices(person.tax_unit): - included = ( - (member >= 0) & (member != own) & head_or_spouse & head_or_spouse[member] - ) + included = (member >= 0) & (member != own) & joint & head_or_spouse[member] spouse = np.where(included, member, spouse) - matches += included + matches = matches + included for member in group_member_indices(person.marital_unit): included = (member >= 0) & (member != own) & separate spouse = np.where(included, member, spouse) - matches += included + matches = matches + included # A larger, ambiguous group cannot identify which member is the spouse. spouse = np.where(matches == 1, spouse, -1) @@ -89,7 +95,9 @@ def medicaid_non_filer_fallback_sum(person, period, values, spouse_sum, income=F ) else: amount = values[member] - total += np.where(included & (relative_parent | relative_child), amount, 0) + total = total + np.where( + included & (relative_parent | relative_child), amount, 0 + ) return total @@ -161,8 +169,8 @@ def is_spouse(member): def medicaid_non_filer_member_sum(person, period, values): """Sum ``values`` once over each person's MAGI non-filer household. - Callers use this in households with parent links and keep their original - family-level expressions elsewhere. Under 42 CFR 435.603(f)(3) the + Callers use this in households with parent links and + medicaid_non_filer_fallback_sum elsewhere. Under 42 CFR 435.603(f)(3) the household is the individual and, if living with the individual, (i) the spouse, (ii) the individual's children under the age limit and (iii) for an individual under the age limit, their parents and their siblings under diff --git a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py index b8e949c43dc..ca3958ac111 100644 --- a/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py +++ b/policyengine_us/variables/gov/hhs/medicaid/income/medicaid_household_income.py @@ -35,9 +35,11 @@ class medicaid_household_income(Variable): "amounts are added only when positive (each child's, and each " "couple's parents' netted), so a relative outside the household " "cannot lower its income. The applicant's own amount and their spouse's " - "are added signed and excluded from the relatives' groups. A parent " - "who is also child-age is counted only as a parent. Unmarried " - "co-resident parents are each counted only when positive." + "(the other head or spouse of a joint return, or a cohabiting spouse " + "filing separately) are added signed and excluded from the relatives' " + "groups. In a child-age applicant's household, a parent who is also " + "child-age is counted only as a parent. Unmarried co-resident parents " + "are each counted only when positive." ) definition_period = YEAR reference = ( @@ -59,13 +61,17 @@ def formula(person, period, parameters): person("medicaid_magi_person", period), ) head_or_spouse = person("is_tax_unit_head_or_spouse", period) - head_or_spouse_count = head_or_spouse.astype(int) - head_spouse_income = person.tax_unit.sum(head_or_spouse_count * member_income) - same_unit_spouse_income = head_or_spouse_count * head_spouse_income - ( - head_or_spouse_count * member_income + head_spouse_count = person.tax_unit("head_spouse_count", period) + head_spouse_income = person.tax_unit.sum(head_or_spouse * member_income) + # As in medicaid_household_size, the other head or spouse is a + # same-unit spouse only on a joint return (head_spouse_count 2). + same_unit_spouse_income = where( + head_or_spouse & (head_spouse_count == 2), + head_spouse_income - member_income, + 0, ) cohabitating_separate = person.tax_unit("cohabitating_spouses", period) & ( - person.tax_unit("head_spouse_count", period) == 1 + head_spouse_count == 1 ) claimed_by_another_return = person( "claimed_as_dependent_on_another_return", period From e70daf563c74f778012a2930f55369c188a21287 Mon Sep 17 00:00:00 2001 From: Ziming Date: Sun, 15 Nov 2026 22:12:50 -0500 Subject: [PATCH 3/5] Put the 18-year-old in the spouse role explicitly after marital units are built PR 10000 builds omitted marital units, so an 18-year-old who passes the qualifying child age test is now the parent's dependent, not the inferred spouse. The head of household cases in medicaid_household_size and medicaid_household_income test the joint-return spouse rule, so they now input the parent as head and the 18-year-old as spouse. The New Jersey partner household keeps no role inputs: it now takes the parent's tax household of 2, which size Case 12 pins through medicaid_uses_non_filer_rules. Update the comments that described the old spouse guess. Co-Authored-By: Claude Opus 5.5 --- .../categories/is_adult_for_medicaid.yaml | 8 ++++--- .../income/medicaid_household_income.yaml | 14 +++++++----- .../income/medicaid_household_size.yaml | 22 ++++++++++++------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml index 77fc9dfbce4..9bb9ab294ce 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/is_adult_for_medicaid.yaml @@ -331,7 +331,8 @@ # A Household API partner reported this household (issue 9562): a New Jersey # parent and an 18-year-old child with no relationship or tax-role inputs. The -# model takes the 18-year-old as the parent's spouse, and neither files. +# model builds the omitted marital units, so the 18-year-old is the parent's +# dependent, and the parent files. - name: New Jersey parent of an 18-year-old with no role inputs is above the adult group limit period: 2026 absolute_error_margin: 0.001 @@ -350,7 +351,8 @@ # Household of 2 (medicaid_household_size Case 12). 2026 guideline for 2: # 15,960 + 5,680 = 21,640, and 31,000 / 21,640 = 1.4325. The 138% limit is # 21,640 x 1.38 / 12 = 2,488.60, rounded up to 2,489 a month, a 1.3802 - # ratio. Counting the 18-year-old twice gave 3 and 31,000 / 27,320 = - # 1.1347, inside the limit. The 18-year-old is under the adult age range. + # ratio. Before those units were built, the model took the 18-year-old as + # the spouse and counted them twice: 3, and 31,000 / 27,320 = 1.1347, + # inside the limit. The 18-year-old is under the adult age range. medicaid_income_level: [1.4325, 1.4325] is_adult_for_medicaid: [false, false] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml index 38a564394c3..416adba8f7f 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml @@ -554,7 +554,7 @@ # The child's married parents are netted before the floor: 700. medicaid_household_income: [700, 700, 700] -- name: Non-filer membership counts each income once for an 18-year-old taken as the spouse on a head of household return. +- name: Non-filer membership counts each income once for an 18-year-old in the spouse role on a head of household return. period: 2026 absolute_error_margin: 0.01 input: @@ -562,10 +562,12 @@ parent: age: 45 own_children_in_household: 1 + is_tax_unit_head: true medicaid_household_income_member: 1_200 medicaid_uses_non_filer_rules: true child: age: 18 + is_tax_unit_spouse: true medicaid_household_income_member: 400 medicaid_uses_non_filer_rules: true tax_units: @@ -577,9 +579,9 @@ members: [parent, child] state_code: NJ output: - # The model takes the 18-year-old as the tax unit spouse, but the return - # isn't joint, so neither is the other's spouse, as in - # medicaid_household_size. The parent's household has the 18-year-old as - # a child under 19, and the 18-year-old's has the parent: 1,200 + 400 = - # 1,600 for both. Main gave 2,000 and 2,800. + # The 18-year-old is input as the tax unit spouse, but the return isn't + # joint, so neither is the other's spouse, as in medicaid_household_size. + # The parent's household has the 18-year-old as a child under 19, and the + # 18-year-old's has the parent: 1,200 + 400 = 1,600 for both. Main gave + # 2,000 and 2,800. medicaid_household_income: [1_600, 1_600] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml index cd232bcab6a..1ce95c41f59 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml @@ -348,21 +348,27 @@ members: [person1, person2] state_code: NJ output: - # Without marital units or roles, the model takes the 18-year-old as the - # parent's spouse, so the return is joint and $31,000 is below the joint - # filing threshold: both use the non-filer rules. Main counted the - # 18-year-old as both spouse and member under 19, giving the parent 3. + # The model builds the omitted marital units by the tax-role rules: the + # 18-year-old, under 19 and younger than the parent, gets their own and is + # the parent's dependent. $31,000 is above the head of household filing + # threshold, so both use the parent's tax household of 2 (42 CFR + # 435.603(f)(1)-(2)). Before those units were built, the model took the + # 18-year-old as the spouse, and the non-filer rules counted them twice, + # giving the parent 3. + medicaid_uses_non_filer_rules: [false, false] medicaid_household_size: [2, 2] -- name: Case 13, an 18-year-old taken as the spouse on a head of household return counts once as the parent's child. +- name: Case 13, an 18-year-old in the spouse role on a head of household return counts once as the parent's child. period: 2026 input: people: person1: age: 45 own_children_in_household: 1 + is_tax_unit_head: true person2: age: 18 + is_tax_unit_spouse: true tax_units: tax_unit: members: [person1, person2] @@ -372,9 +378,9 @@ members: [person1, person2] state_code: NJ output: - # The model still takes the 18-year-old as the tax unit spouse, but the - # supplied filing status isn't joint, so neither is counted as the other's - # spouse. With no income neither files. The 18-year-old is the parent's + # The 18-year-old is input as the tax unit spouse, but the supplied filing + # status isn't joint, so neither is counted as the other's spouse. With no + # income neither files. The 18-year-old is the parent's # child under 19 (435.603(f)(3)(ii)) and the parent is the 18-year-old's # parent ((f)(3)(iii)). is_tax_unit_spouse: [false, true] From e8c31c99600bdb0caadf2c6ad6f4f552c9c55a1c Mon Sep 17 00:00:00 2001 From: Ziming Date: Mon, 16 Nov 2026 15:16:08 -0500 Subject: [PATCH 4/5] Pin the non-filer fallback's netting terms and ambiguous-spouse guard Review fixes for David's should-address finding: no test pinned the own-parent and spouse-parent terms in the fallback's parent netting, or the guard that leaves a spouse unidentified when a marital unit has several other members. - medicaid_household_income: married 18-year-old parents on separate returns without the cohabiting flag (David's case). Each counts the other as a relative parent with their own amount netted out: 3,900 each, against 3,350 and 4,450 without the own-parent term. - medicaid_household_income: 18-year-old joint filers whose listed marital unit also holds the head's parent with no income. The netted share leaves out both spouses: 3,900 each, against 5,050 and 4,500 without the spouse-parent term. - medicaid_household_size Case 14: cohabiting parents on separate returns whose marital unit also lists their child. No member is identified as the spouse, so each parent counts 3; taking the last member as the spouse would drop the child and give 2. Co-Authored-By: Claude Opus 5.5 --- .../income/medicaid_household_income.yaml | 88 +++++++++++++++++++ .../income/medicaid_household_size.yaml | 37 ++++++++ 2 files changed, 125 insertions(+) diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml index 416adba8f7f..3b8a47a7161 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml @@ -585,3 +585,91 @@ # 18-year-old's has the parent: 1,200 + 400 = 1,600 for both. Main gave # 2,000 and 2,800. medicaid_household_income: [1_600, 1_600] + +- name: Non-filer membership counts each income once for married 18-year-old parents on separate returns without the cohabiting flag. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + parent1: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 1_200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + medicaid_household_income_member: 2_300 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 400 + medicaid_uses_non_filer_rules: true + marital_units: + couple: + members: [parent1, parent2] + child_unit: + members: [child] + tax_units: + return1: + members: [parent1, child] + return2: + members: [parent2] + households: + household: + members: [parent1, parent2, child] + state_code: CA + output: + # Without a joint return or the cohabiting flag, neither parent is the + # other's identified spouse, so each is the other's relative parent. The + # applicant's own amount is netted out of the couple first: + # 1,200 + (3,500 - 1,200) + 400 = 3,900, and 2,300 + 1,200 + 400 = 3,900. + medicaid_household_size: [3, 3, 3] + medicaid_household_income: [3_900, 3_900, 3_900] + +- name: Non-filer membership nets each income once when the whole household is listed as one marital unit. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + grandmother: + age: 45 + own_children_in_household: 1 + medicaid_household_income_member: 0 + medicaid_uses_non_filer_rules: false + parent1: + age: 18 + own_children_in_household: 1 + is_tax_unit_head: true + medicaid_household_income_member: 1_200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + is_tax_unit_spouse: true + medicaid_household_income_member: 2_300 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 400 + medicaid_uses_non_filer_rules: true + marital_units: + household_unit: + members: [grandmother, parent1, parent2, child] + tax_units: + grandmother_unit: + members: [grandmother] + parents: + members: [parent1, parent2, child] + households: + household: + members: [grandmother, parent1, parent2, child] + state_code: CA + output: + # The joint-return spouse shares the listed marital unit with the + # grandmother, parent1's parent. A parent's netted share of that unit + # leaves out both the applicant and the spouse, so the grandmother adds + # her own 0: 1,200 + 2,300 + 0 + 400 = 3,900 for each parent. The child + # adds the unit's three parents netted together: 400 + 3,500 = 3,900. The + # grandmother's own household is her tax household, with no income. + medicaid_household_income: [0, 3_900, 3_900, 3_900] diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml index 1ce95c41f59..8487f6a9e9f 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_size.yaml @@ -387,3 +387,40 @@ tax_unit_is_filer: false medicaid_uses_non_filer_rules: [true, true] medicaid_household_size: [2, 2] + +- name: Case 14, a marital unit that also lists the child leaves the cohabiting spouse unidentified and counts each member once. + period: 2025 + input: + people: + person1: + age: 35 + own_children_in_household: 1 + person2: + age: 35 + own_children_in_household: 1 + person3: + age: 1 + marital_units: + marital_unit: + members: [person1, person2, person3] + tax_units: + tax_unit1: + members: [person1, person3] + cohabitating_spouses: true + tax_unit2: + members: [person2] + cohabitating_spouses: true + households: + household: + members: [person1, person2, person3] + state_code: CA + output: + # A parent's separate-return spouse is the other member of their marital + # unit, which here also lists the child, so no member is identified as the + # spouse. Each parent counts self, the cohabiting spouse once through the + # spouse count, and the child once as a member under 19. Taking the last + # member as the spouse would drop the child and give each parent 2. The + # child, claimed by one parent while living with both, uses the non-filer + # rules: self and both parents. + medicaid_uses_non_filer_rules: [true, true, true] + medicaid_household_size: [3, 3, 3] From 2398bf2e6877b5e539bf975d4dd47050fbeaffbf Mon Sep 17 00:00:00 2001 From: Ziming Date: Tue, 17 Nov 2026 10:32:43 -0500 Subject: [PATCH 5/5] Pin the spouse-parent count in the non-filer parent netting Add the whole-household marital-unit case with the grandmother at 600 and assert parent1 only: (600 + 1,200 + 2,300 - 1,200 - 2,300) / (3 - 2) = 600, so 1,200 + 2,300 + 600 + 400 = 4,500. Removing the spouse-parent count term divides by 2 instead (4,200). Note in the zero-income case that parent2 and the child count the grandmother only through the family-level proxy. Co-Authored-By: Claude Opus 5.5 --- .../income/medicaid_household_income.yaml | 57 ++++++++++++++++++- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml index 3b8a47a7161..7a08e89b757 100644 --- a/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml +++ b/policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_household_income.yaml @@ -669,7 +669,58 @@ # The joint-return spouse shares the listed marital unit with the # grandmother, parent1's parent. A parent's netted share of that unit # leaves out both the applicant and the spouse, so the grandmother adds - # her own 0: 1,200 + 2,300 + 0 + 400 = 3,900 for each parent. The child - # adds the unit's three parents netted together: 400 + 3,500 = 3,900. The - # grandmother's own household is her tax household, with no income. + # her own 0: 1,200 + 2,300 + 0 + 400 = 3,900 for each parent. Parent2 and + # the child count her only through the family-level proxy (#9404). The + # child adds the unit's three parents netted together: 400 + 3,500 = + # 3,900. The grandmother's own household is her tax household, with no + # income. medicaid_household_income: [0, 3_900, 3_900, 3_900] + +- name: Non-filer membership divides a listed marital unit's remaining parent income among the remaining parents only. + period: 2025 + absolute_error_margin: 0.01 + input: + people: + grandmother: + age: 45 + own_children_in_household: 1 + medicaid_household_income_member: 600 + medicaid_uses_non_filer_rules: false + parent1: + age: 18 + own_children_in_household: 1 + is_tax_unit_head: true + medicaid_household_income_member: 1_200 + medicaid_uses_non_filer_rules: true + parent2: + age: 18 + own_children_in_household: 1 + is_tax_unit_spouse: true + medicaid_household_income_member: 2_300 + medicaid_uses_non_filer_rules: true + child: + age: 1 + medicaid_household_income_member: 400 + medicaid_uses_non_filer_rules: true + marital_units: + household_unit: + members: [grandmother, parent1, parent2, child] + tax_units: + grandmother_unit: + members: [grandmother] + parents: + members: [parent1, parent2, child] + households: + household: + members: [grandmother, parent1, parent2, child] + state_code: CA + output: + # Only parent1 is asserted: the grandmother is parent1's parent + # (42 CFR 435.603(f)(3)(iii)), while parent2 and the child would count her + # only through the family-level proxy (#9404). Parent1's netted share of + # the unit leaves out parent1 and the spouse: + # (600 + 1,200 + 2,300 - 1,200 - 2,300) / (3 - 2) = 600, so + # 1,200 + 2,300 + 600 + 400 = 4,500. + people: + parent1: + medicaid_household_income: 4_500