Repository navigation
Conversation
…eturn's Montana AGI The 2021-2023 Form 2 Itemized Deductions Schedule (line 1b) and Standard Deduction Worksheet (line 1) take Montana AGI from page 1, line 14. Single, head of household and joint returns report that line in one column, so a joint return pools both spouses' income before flooring at zero. Both joint-path variables instead summed each spouse's mt_agi_indiv, which floors each spouse at zero first, so a spouse's loss never offset the other's income. They now use mt_agi_joint. From 2024 mt_agi_indiv is switched off (Montana repealed filing separately on the same form), so the joint medical floor fell to zero and the full medical expense was deducted. From 2024 Form 2 line 2 takes federal itemized deductions (Worksheet A), so the variable now carries the federal medical expense deduction (7.5% of federal AGI). A new parameter, gov.states.mt.tax.income.deductions.itemized.state_specific_deduction_applies, marks the switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s in full For TY2021-2023 the Form 2 Itemized Deductions Schedule floors only line 1, medical and dental expenses other than premiums, at 7.5% of Montana AGI. Line 2 deducts medical insurance premiums in full, except premiums already deducted in Montana AGI (the self-employed health insurance deduction) and pre-tax premiums; line 3 deducts long-term care insurance premiums in full (former MCA 15-30-2131(1)(a)(iii)-(iv) and (1)(g)). - New mt_eligible_medical_insurance_premiums (person): federal medical expense premiums, including Medicare Part B, less the person's self-employed health insurance deduction. - mt_medical_expense_deduction_joint (2021-2023) and _indiv: line 1 floored on Montana AGI, plus lines 2 and 3 in full. From 2024 the joint variant keeps the federal medical expense deduction. Fixes #9930. Stacked on #9903. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 6, 2026
The 2021-2023 property now expects max(0, other expenses - 7.5% of Montana AGI) plus line 2 and 3 premiums. The grid's age-70 single filers carry modeled Medicare Part B premiums, which the schedule deducts in full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iums-in-full # Conflicts: # policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/mt_medical_expense_deduction_joint.yaml # policyengine_us/tests/unit/test_mt_joint_agi_deductions_properties.py # policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/medical/mt_medical_expense_deduction_joint.py
…nto fix-mt-medical-premiums-in-full # Conflicts: # policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/mt_medical_expense_deduction_indiv.yaml # policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/mt_medical_expense_deduction_joint.yaml # policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/medical/mt_medical_expense_deduction_indiv.py
- Line 2 reuses #10055's per-person excluded premiums; the new line 3 variable nets the remainder of the self-employed deduction from long-term care premiums (26 U.S.C. 162(l)(2)(C) lets those premiums into that deduction). - The separate-filing variant applies lines 2 and 3 only while the Itemized Deductions Schedule applies; a reform that allows separate filing after 2023 keeps premiums under the floor. - Tests: supply the self-employed deduction where its earnings limit matters, a below-floor dependent case, #10055's Montana cases moved to lines 1-3, and invariants for premium conservation and #10055's applied exclusion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #9930. Stacked on #10055 (hub-owned; nets the self-employed health insurance deduction out of federal Schedule A premiums). Until #10055 merges, this diff also shows its changes. Merge #10055 first, then merge
maininto this branch. #9903, which this PR was first stacked on, has merged (51487d5).Summary
For TY2021–2023, Montana's Itemized Deductions Schedule (Form 2 page 7) splits medical costs across three lines:
Lines 2 and 3 exclude premiums already deducted in Montana AGI. PolicyEngine floored everything together:
mt_medical_expense_deduction_jointandmt_medical_expense_deduction_indivput the premiums (including modeled Medicare Part B) under the 7.5% floor and left out long-term care premiums.What the law and forms say
Former MCA § 15-30-2131(1) (MCA 2021; repealed effective January 1, 2024):
Form 2 page 7 (2022, PDF p. 7; 2021 and 2023 have the same lines):
Form 2 instructions (2022, PDF pp. 32–33; 2021 PDF pp. 31–32 and 2023 PDF p. 36 say the same):
26 U.S.C. 162(l)(2)(C) (govinfo) lets eligible long-term care premiums into the self-employed health insurance deduction. So line 3 must also net that deduction, not only line 2.
From 2024 the 2024 instructions (PDF p. 8) list the Itemized Deductions Schedule (and filing status 2a's schedules) as discontinued. Montana then takes federal itemized deductions, where premiums stay under the federal floor. That treatment is unchanged here.
Changes
mt_eligible_medical_insurance_premiums(new, person; line 2) =medical_expense_health_insurance_premiums− Exclude SE health insurance deductions from Schedule A medical expenses #10055'sself_employed_health_insurance_ald_excluded_premiums(the person's self-employed deduction, capped at their premiums).medical_expense_health_insurance_premiumsincludes modeled Medicare Part B.pre_tax_health_insurance_premiums, a separate input that reduces wages throughpre_tax_contributions. So pre-tax premiums stay off line 2.mt_eligible_long_term_care_insurance_premiums(new, person; line 3) = max(0,long_term_health_insurance_premiums− the part of the person's self-employed deduction not used by line 2).mt_medical_expense_deduction_joint:state_specific_deduction_applies): line 1 = max(0, Σother_medical_expenses− 7.5% ×mt_agi_joint), plus Σ lines 2 and 3 over the return's members, held by the head.itemized_medical_expensesin those years, so Exclude SE health insurance deductions from Schedule A medical expenses #10055's Schedule A exclusion and line 2 never both apply.medical_expense_deduction, unchanged.mt_medical_expense_deduction_indiv: the same three lines per spouse on their ownmt_agi_indiv, while the schedule applies. If a reform allows separate filing after 2023 (enable_mt_mfss_2024_reform), it keeps Exclude SE health insurance deductions from Schedule A medical expenses #10055's treatment: premiums net of the self-employed deduction, under the floor with the other expenses.is_tax_unit_head_or_spouse: true.Household effects (real runs: base = #10055 head ba2f3b8, this branch 595cd1e)
All five itemize before and after. The two self-employed rows show the deduction netted once: #10055 already removes those premiums from the base, and lines 2–3 net them the same way, including the long-term care premiums. The base ran on policyengine-core 3.33.2 and the branch on 3.32.27 (lock). Script and outputs:
~/reviews/mt-medical-premiums-2026-10-06/household_examples.py,household_base_r2.json,household_pr_r2.json.Microsim impact
No microsimulation was run, and none is reported. The change affects TY2021–2023 only. From 2024:
defined_for);So 2024+ baseline microsimulation results are unaffected.
Tests
Pending: targeted files, one at a time, queued behind the shared heavy lock. This section will be filled in from the run.
Invariants
tests/unit/test_mt_medical_premium_deduction_invariants.pyuses Hypothesis batches plus a seeded population of 120 returns, over 2021–2024. Each batch runs as one vectorized simulation that holds each return, a twin with higher premiums, and a twin without pre-tax premiums. The 7.5% rate comes from Form 2 line 1c. Montana AGI and the self-employed deduction are read from the model; they are inputs to the properties, not derived independently.itemized_medical_expenses+ Exclude SE health insurance deductions from Schedule A medical expenses #10055'sitemized_medical_expenses_applied_exclusion− premiums. This fails if the federal aggregate gains a component.medical_expense_deduction, and the separate variant is 0.Non-vacuity (seeded population) checks that the population includes:
Why Python: YAML can't generate populations or compare twin returns. Cost: pending (measured in the same run).
Not modeled (no PE inputs)
health_insurance_premiums._indivcounts each spouse's own amounts, as before.Follow-ups (outside this PR)
itemized_medical_expenses.Reviews
axiom: TheAxiomFoundation/rulespec-us#1528 queued (former MCA § 15-30-2131(1)(g), Itemized Deductions Schedule lines 2–3, TY2021–2023; the signed encoder is blocked because the pinned corpus has § 15-30-2131 only as a repeal marker and no 2021–2023 Form 2 scope; sibling of #1520, which covers line 1)
🤖 Generated with Claude Code