Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
fixed:
- Prorate the Montana federal income tax deduction based on Montana AGI.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- name: Deductions split evenly
period: 2021
input:
people:
person1:
mt_agi: 500
person2:
mt_agi: 500
tax_units:
tax_unit:
members: [person1, person2]
mt_federal_income_tax_deduction_unit: 3_000
state_filing_status_if_married_filing_separately_on_same_return: SEPARATE
households:
household:
members: [person1, person2]
state_code: MT
output:
mt_federal_income_tax_deduction_indiv: [1_500, 1_500]

- name: Deductions capped at max amount individually
period: 2021
input:
people:
person1:
mt_agi: 100
person2:
mt_agi: 900
tax_units:
tax_unit:
members: [person1, person2]
mt_federal_income_tax_deduction_unit: 10_000
state_filing_status_if_married_filing_separately_on_same_return: SEPARATE
households:
household:
members: [person1, person2]
state_code: MT
output:
mt_federal_income_tax_deduction_indiv: [1_000, 5_000]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
income_tax_before_refundable_credits: 6_000 # >5,000
state_code: MT
output:
mt_federal_income_tax_deduction: 5_000
mt_federal_income_tax_deduction_unit: 5_000

- name: Test case filing single with income tax below limit
period: 2021
Expand All @@ -14,7 +14,7 @@
income_tax_before_refundable_credits: 2_000 # <5,000
state_code: MT
output:
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_unit: 2_000

- name: Test case filing joint with income tax below limit
period: 2021
Expand All @@ -23,7 +23,7 @@
income_tax_before_refundable_credits: 7_000 #<10,000
state_code: MT
output:
mt_federal_income_tax_deduction: 7_000
mt_federal_income_tax_deduction_unit: 7_000

- name: Test case filing joint with income tax below limit
period: 2021
Expand All @@ -32,7 +32,7 @@
income_tax_before_refundable_credits: 7_000 #<10,000
state_code: MT
output:
mt_federal_income_tax_deduction: 7_000
mt_federal_income_tax_deduction_unit: 7_000

- name: Amount distributed to the head
period: 2021
Expand All @@ -53,4 +53,4 @@
members: [person1, person2]
state_code: MT
output:
mt_federal_income_tax_deduction: [7_000, 0]
mt_federal_income_tax_deduction_unit: 7_000
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mt_medical_expense_deduction_indiv: 1_000
casualty_loss_deduction: 400
mt_child_dependent_care_expense_deduction: 123
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_indiv: 2_000
state_code: MT
output:
mt_itemized_deductions_indiv: 9_188
Expand All @@ -21,7 +21,7 @@
mt_medical_expense_deduction_indiv: 3_000
casualty_loss_deduction: 0
mt_child_dependent_care_expense_deduction: 0
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_indiv: 2_000
state_code: MT
output:
mt_itemized_deductions_indiv: 16_234
Expand All @@ -35,7 +35,7 @@
mt_medical_expense_deduction_indiv: 3_000
casualty_loss_deduction: 745
mt_child_dependent_care_expense_deduction: 1_004
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_indiv: 2_000
state_code: MT
output:
mt_itemized_deductions_indiv: 8_318
Expand All @@ -50,20 +50,20 @@
mt_misc_deductions: 100
mt_medical_expense_deduction_indiv: 200
mt_salt_deduction: 300
mt_federal_income_tax_deduction: 400
mt_federal_income_tax_deduction_indiv: 400
person2:
is_tax_unit_head_or_spouse: true
mt_misc_deductions: 100
mt_medical_expense_deduction_indiv: 200
mt_salt_deduction: 300
mt_federal_income_tax_deduction: 100
mt_federal_income_tax_deduction_indiv: 100
person3:
is_tax_unit_head_or_spouse: false
is_tax_unit_dependent: true
mt_misc_deductions: 100
mt_medical_expense_deduction_indiv: 12
mt_salt_deduction: 200
mt_federal_income_tax_deduction: 100
mt_federal_income_tax_deduction_indiv: 100
tax_units:
tax_unit:
members: [person1, person2, person3]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
mt_medical_expense_deduction_joint: 1_000
casualty_loss_deduction: 400
mt_child_dependent_care_expense_deduction: 123
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_unit: 2_000
state_code: MT
output:
mt_itemized_deductions_joint: 9_588
Expand All @@ -23,7 +23,7 @@
mt_medical_expense_deduction_joint: 3_000
casualty_loss_deduction: 0
mt_child_dependent_care_expense_deduction: 0
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_unit: 2_000
state_code: MT
output:
mt_itemized_deductions_joint: 16_234
Expand All @@ -38,7 +38,7 @@
mt_medical_expense_deduction_joint: 3_000
casualty_loss_deduction: 745
mt_child_dependent_care_expense_deduction: 1_004
mt_federal_income_tax_deduction: 2_000
mt_federal_income_tax_deduction_unit: 2_000
state_code: MT
output:
mt_itemized_deductions_joint: 8_818
Expand All @@ -53,23 +53,24 @@
mt_misc_deductions: 100
mt_medical_expense_deduction_joint: 200
mt_salt_deduction: 300
mt_federal_income_tax_deduction: 400
investment_interest_expense: 100
person2:
is_tax_unit_head: false
mt_misc_deductions: 100
mt_medical_expense_deduction_joint: 200
mt_salt_deduction: 300
mt_federal_income_tax_deduction: 100
person3:
is_tax_unit_head: false
mt_misc_deductions: 100
mt_medical_expense_deduction_joint: 12
mt_salt_deduction: 200
mt_federal_income_tax_deduction: 100
households:
household:
members: [person1, person2, person3]
state_code: MT
tax_units:
tax_unit:
members: [person1, person2, person3]
mt_federal_income_tax_deduction_unit: 600
output:
mt_itemized_deductions_joint: [2_212, 0, 0]
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,6 @@
mt_eitc: [98.854, 0, 0]
mt_income_tax_joint: 354.65

- name: Tax unit with taxsimid 21195 in e21.its.csv and e21.ots.csv
absolute_error_margin: 0.01
period: 2021
input:
people:
person1:
age: 55
employment_income: 13_010
taxable_interest_income: 5_505.0
person2:
age: 55
employment_income: 146_010
taxable_interest_income: 5_505.0
person3:
age: 16
person4:
age: 16
person5:
age: 16
person6:
age: 16
households:
household:
members: [person1, person2, person3, person4, person5, person6]
state_fips: 30 # MT
output: # expected results from patched TAXSIM35 2024-02-05 version
mt_agi: [18_515, 151_515, 0, 0, 0, 0]
mt_itemized_deductions_indiv: [10_000, 0, 0, 0, 0, 0]
mt_personal_exemptions_indiv: [2_580, 2_580, 0, 0, 0, 0]
mt_dependent_exemptions_person: [0, 0, 2_580, 2_580, 2_580, 2_580]

- name: Tax unit with taxsimid 22630 in e21.its.csv and e21.ots.csv
absolute_error_margin: 0.01
period: 2021
Expand Down Expand Up @@ -91,3 +60,40 @@
state_fips: 30 # MT
output: # expected results from patched TAXSIM35 2024-03-21 version
mt_income_tax: 1140.90

- name: Tax unit with taxsimid 34790 in e21.its.csv and e21.ots.csv
absolute_error_margin: 0.01
period: 2021
input:
people:
person1:
age: 33
employment_income: 7010
taxable_interest_income: 5505
person2:
age: 33
employment_income: 136010
taxable_interest_income: 5505
person3:
age: 16
person4:
age: 16
person5:
age: 16
person6:
age: 16
tax_units:
tax_unit:
members: [person1, person2, person3, person4, person5, person6]
local_income_tax: 0 # not in TAXSIM35
spm_units:
spm_unit:
members: [person1, person2, person3, person4, person5, person6]
snap: 0 # not in TAXSIM35
tanf: 0 # not in TAXSIM35
households:
household:
members: [person1, person2, person3, person4, person5, person6]
state_fips: 30 # MT
output: # expected results from patched TAXSIM35 2024-04-21 version
mt_income_tax: 8078.93
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from policyengine_us.model_api import *


class mt_federal_income_tax_deduction_indiv(Variable):
value_type = float
entity = Person
definition_period = YEAR
label = "Montana federal income tax deduction when married couples are filing separately"
reference = (
"https://law.justia.com/codes/montana/2021/title-15/chapter-30/part-21/section-15-30-2131/"
# MT Code § 15-30-2131 (2021) (1)(b)
)
unit = USD
defined_for = StateCode.MT

def formula(person, period, parameters):
unit_deds = person.tax_unit(
"mt_federal_income_tax_deduction_unit", period
)
person_agi = person("mt_agi", period)
total_agi = person.tax_unit.sum(person_agi)

prorate = np.zeros_like(total_agi)
mask = total_agi > 0
prorate[mask] = person_agi[mask] / total_agi[mask]
filing_status = person.tax_unit(
"state_filing_status_if_married_filing_separately_on_same_return",
period,
)
p = parameters(
period
).gov.states.mt.tax.income.deductions.itemized.federal_income_tax
cap = p.cap[filing_status]
return min_(unit_deds * prorate, cap)
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
from policyengine_us.model_api import *


class mt_federal_income_tax_deduction(Variable):
class mt_federal_income_tax_deduction_unit(Variable):
value_type = float
entity = Person
entity = TaxUnit
definition_period = YEAR
label = "Montana federal income tax deduction"
label = "Montana federal income tax deduction for the entire tax unit"
reference = (
"https://law.justia.com/codes/montana/2021/title-15/chapter-30/part-21/section-15-30-2131/"
# MT Code § 15-30-2131 (2021) (1)(b)
)
unit = USD
defined_for = StateCode.MT

def formula(person, period, parameters):
filing_status = person.tax_unit("filing_status", period)
def formula(tax_unit, period, parameters):
filing_status = tax_unit("filing_status", period)
p = parameters(
period
).gov.states.mt.tax.income.deductions.itemized.federal_income_tax
federal_income_tax_limit = p.cap[filing_status]

federal_income_tax = person.tax_unit(
federal_income_tax = tax_unit(
"income_tax_before_refundable_credits", period
)
# The federal income tax deduction is attributed to the head in any case
# as we currently do not have a way to determine individual federal income tax before credits.
is_head = person("is_tax_unit_head", period)
return is_head * min_(federal_income_tax, federal_income_tax_limit)
return min_(federal_income_tax, federal_income_tax_limit)
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def formula(person, period, parameters):
"mt_misc_deductions",
"mt_medical_expense_deduction_indiv",
"mt_salt_deduction",
"mt_federal_income_tax_deduction",
"mt_federal_income_tax_deduction_indiv",
],
)
return head_or_spouse * (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def formula(person, period, parameters):
"mt_misc_deductions",
"mt_medical_expense_deduction_joint",
"mt_salt_deduction",
"mt_federal_income_tax_deduction",
"mt_federal_income_tax_deduction_unit",
],
)
is_head = person("is_tax_unit_head", period)
Expand Down