Repository navigation
Conversation
Form 39R worksheet lines 3-6 take the medical expenses claimed on federal Schedule A, and Schedule A line 1 counts bills the filers paid for their dependents. other_medical_expenses sits on the person cared for (the CPS ASEC asks each person's own care, paid by anyone in the household), so a dependent's amount is the filers' payment. The worksheet summed it over the head and spouse only, which dropped every dependent's bills from the premium overlap and from Idaho itemized deductions. Premiums stay filer-only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From derived inputs Idaho's claimant worksheet now equals the federal medical deduction, so a deleted federal medical input changes no Idaho amount; the only separator, a supplied Idaho premium amount below the Schedule A premiums, is a case where the derived worksheet departs from Form 39R line 6. Test the same provenance defect where it still shows: a derived federal itemized total, whose medical component Idaho replaces with an explicit claimant deduction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The standard deduction and taxable income before itemized deductions do not depend on medical expenses; deriving them pulled most of the federal tax graph into the core test group. Supplying them cuts the property test's added peak footprint from about 273 MB to about 36 MB locally, with the 2026 itemized limitation still binding in half of its 2026 simulations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
force-pushed
the
id-worksheet-dependent-medical
branch
from
October 19, 2026 14:44
fcdf73c to
14c9854
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Idaho's Form 39R claimant medical worksheet (
id_health_insurance_premiums_medical_deduction, from #10023) summedother_medical_expensesover the head and spouse only. So every dependent's medical bills were left out of the premium overlap and, throughid_itemized_deductions, out of Idaho itemized deductions, while the federal Schedule A subtotal counted them. This PR counts every member's other medical expenses in the worksheet. Premiums stay filer-only.Stacked on #10270 (base branch
fix-schedule-a-dependent-paid-premiums). #10270 sets the input contract this PR relies on and edits the same Idaho test files. Once #10270 lands, rebase ontomain:git rebase --onto upstream/main <#10270's final head>(currently2e5fccfd1f).Law and input contract
other_medical_expensessits on the person cared for. The CPS ASEC asks about each person's "OWN medical care" and adds "Include any amount paid out-of-pocket on (your/his/her) behalf by anyone in this household" (Census working paper, PDF pages 2-3). Count only filer-paid premiums in Schedule A medical expenses #10270 documents this on the variable. A dependent's amount is therefore a bill the household paid for the dependent, which Schedule A counts. Fix Idaho health insurance premium subtraction #10023 treated it as recorded on the payer, which holds for premiums (the Exclude SE health insurance deductions from Schedule A medical expenses #10055 contract) but not for these.What changes
id_health_insurance_premiums_medical_deduction:other_medical_expensesis summed over every member (tax_unit_non_dep_add(..., include_dependents=["other_medical_expenses"])). The documentation and comments now state the two attributions: premiums on the payer, other costs on the person cared for. Premiums still come fromid_qualified_health_insurance_premiums, the head's and spouse's own payments.id_itemized_deductions: one comment, which said the medical correction keeps "dependent-paid costs" out, now says what the correction does after this PR (below).From derived inputs the worksheet now equals the federal
medical_expense_deduction: both take the filers' premiums less the self-employed deduction, plus every member's other costs, less 7.5% of AGI. The worksheet and the federal deduction differ only when a caller supplies an Idaho amount (id_qualified_health_insurance_premiumsor the worksheet itself) or an intermediate federal one (itemized_medical_expenses_excluded_premiums). Soid_itemized_deductions' medical correction is zero from derived inputs.Household before and after
Real model runs at
b3c256be8d(#10270's head when this branch started; its later commit2e5fccfd1ftouches no Idaho or federal medical formula) and at this head, script and JSON in the review folder. In both, the parent pays the child's bills and Idaho itemizes.medical_expense_deductionid_health_insurance_premiums_medical_deductionid_itemized_deductionsid_health_insurance_premiums_subtractionid_taxable_incomeid_income_tax_before_refundable_creditsIn 2026 Idaho tax rises $28.66. The child's 10,000 medical deduction now enters the itemized total, which IRC 68 (P.L. 119-21 sec. 70111) keeps at 35/37, and line 8 takes it in full off the premium subtraction. The combined reduction (itemized deductions plus subtraction) falls from 68,378.38 to 67,837.84, by 10,000 × 2/37 = 540.54. The model already treats the same bills this way when they sit on the parent's input. After this PR the two placements agree.
Invariants
These hold for every input; the property test checks 1-5 on generated returns.
id_health_insurance_premiums_medical_deduction=medical_expense_deduction= an independent oracle, max(0, max(0, filer premiums − self-employed deduction) + every member's other medical expenses − 7.5% × AGI). Form 39R line 6 is the Schedule A deduction.id_itemized_deductions=itemized_taxable_income_deductions(with zero Idaho SALT), in 2025 and under the 2026 limitation.Intended non-invariant: Idaho taxable income is not monotone in medical expenses under the 2026 limitation (the witness above).
Tests
b3c256be8d) and passes here. The other 29 cases in the two files pass on both.id_health_insurance_premiums_subtraction.yaml:id_itemized_deductions.yaml:test_claimant_worksheet_counts_bills_paid_for_dependentsis intests/core/test_id_health_insurance_premiums.py(Hypothesis,derandomize=True, 8 examples). Each example runs one vectorized simulation for 2025 and one for 2026, covering invariants 1-5. It fails on the old formula and passes here. Over its 16 simulations, 14 have a positive medical deduction and 14 have dependents' bills, and 4 of the 8 for 2026 bind the IRC 68 limitation.test_deleted_medical_input_recalculated_federal_firstno longer separates a supplied from a recalculated federal medical deduction: both give the same Idaho amounts. Its dependent's other costs were the separator. The only remaining separator is a supplied Idaho premium amount below the Schedule A premiums, and on that input the derived worksheet departs from Form 39R line 6 (see known gaps), so a test built on it would assert a value the form contradicts.test_deleted_itemized_input_recalculated_federal_first. It now covers the same Core defect onid_itemized_deductions, where a supplied federal itemized total is used as given and a derived one has its medical component replaced by an explicit Idaho claimant deduction. Recalculated federal total: 21,250; Idaho: 20,250.xfail(Core < 3.32.27)marker is kept, but the dependency floor is now>=3.32.27, so the test runs as a plain regression on every supported install.policyengine-core3.32.27, one process at a time):id_deductions.yaml,id_income_tax_before_refundable_credits.yaml(PolicyBench cells 007 and 053 unchanged),integration.yamlandid_taxable_income.yaml: 22 passed.tests/core/test_id_health_insurance_premiums.py: 4 passed. On the old formula the property test fails.states/id/, no YAML file names an Idaho income tax variable or has an Idaho household with other medical expenses, and no partner contract test has an Idaho household with medical bills.coregroup (13.3 GB RSS in CI run 38141803955).Known gaps (not changed here)
id_qualified_health_insurance_premiumsbelow the Schedule A premiums, the derived worksheet is min(federal deduction, Idaho premiums + other costs − floor). Form 39R line 6 is the federal Schedule A deduction itself. This predates this PR (Fix Idaho health insurance premium subtraction #10023), and nothing in the repo supplies that input. Reading line 6 straight frommedical_expense_deductionwould fix it. Idaho's provenance checks and the itemized medical correction would then serve only an explicit Idaho override. Proposed as a follow-up.mt_medical_expense_deduction_indiv) has the same dependent gap. Another session is fixing it.Impact
The US + core hub runs the microsimulation impact. Local runs are paused for disk.
axiom: us-id/statute/63-3022P TheAxiomFoundation/rulespec-us#1625 queued (extended: worksheet line 3 counts bills the claimant paid for dependents, with companion cases from the 2025 Form 39R and Schedule A instructions)
🤖 Generated with Claude Code