policyengine-us 1.400.0__py3-none-any.whl → 1.400.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of policyengine-us might be problematic. Click here for more details.
- policyengine_us/parameters/gov/states/household/state_itemized_deductions.yaml +6 -6
- policyengine_us/parameters/gov/states/household/state_standard_deductions.yaml +6 -6
- policyengine_us/parameters/gov/states/la/tax/income/deductions/itemized/relevant_federal_deductions.yaml +1 -1
- policyengine_us/parameters/gov/states/mn/tax/income/credits/cdcc/reduced_base_amount.yaml +28 -0
- policyengine_us/parameters/gov/territories/pr/tax/income/taxable_income/exemptions/dependent/income_limit/nonstudent.yaml +1 -1
- policyengine_us/parameters/gov/territories/pr/tax/income/taxable_income/exemptions/dependent/income_limit/student.yaml +1 -1
- policyengine_us/parameters/gov/territories/pr/tax/income/taxable_income/exemptions/personal.yaml +1 -1
- policyengine_us/parameters/gov/territories/pr/tax/income/taxable_income/exemptions/veteran.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.yaml +109 -0
- policyengine_us/tests/policy/baseline/gov/states/la/tax/income/deductions/la_itemized_deductions.yaml +4 -2
- policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_deductions.yaml +15 -10
- policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_itemized_deductions_pre_phaseout.yaml +4 -1
- policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/{mn_cdcc.yaml → credits/cdcc/mn_cdcc.yaml} +66 -0
- policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/credits/cdcc/mn_cdcc_dependent_count.yaml +51 -0
- policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/credits/cdcc/mn_cdcc_eligible.yaml +24 -0
- policyengine_us/tests/policy/baseline/gov/states/mn/tax/income/credits/cdcc/mn_cdcc_phase_out.yaml +44 -0
- policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_federal_income_tax_deduction_for_federal_itemization.yaml +57 -0
- policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_federal_income_tax_deduction_for_federal_itemization_indiv.yaml +39 -0
- policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_indiv.yaml +76 -0
- policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_joint.yaml +76 -0
- policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/nm_itemized_deductions.yaml +47 -0
- policyengine_us/tests/policy/baseline/gov/states/tax/income/state_itemized_deductions.yaml +180 -0
- policyengine_us/tests/policy/baseline/gov/states/tax/income/state_standard_deduction.yaml +178 -0
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax/income/credits/low_income/pr_low_income_credit_eligible.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax/income/taxable_income/exemptions/dependent/pr_dependents_exemption.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax/income/taxable_income/exemptions/dependent/pr_eligible_dependent_for_exemption.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax/income/taxable_income/exemptions/dependent/pr_exemptions_is_eligible_student.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax/income/taxable_income/exemptions/pr_personal_exemption.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax/income/taxable_income/exemptions/pr_veteran_exemption.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax_unit_dependent/integration.yaml +1 -1
- policyengine_us/tests/policy/baseline/gov/territories/pr/tax_unit_dependent/pr_is_tax_unit_dependent.yaml +1 -1
- policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.py +21 -2
- policyengine_us/variables/gov/states/ia/tax/income/including_married_filing_separately/deductions/ia_standard_deduction_indiv.py +0 -2
- policyengine_us/variables/gov/states/la/tax/income/deductions/la_standard_deduction.py +4 -2
- policyengine_us/variables/gov/states/me/tax/income/taxable_income/deductions/me_itemized_deductions_pre_phaseout.py +1 -3
- policyengine_us/variables/gov/states/me/tax/income/taxable_income/me_deductions.py +5 -2
- policyengine_us/variables/gov/states/mn/tax/income/credits/cdcc/mn_cdcc.py +47 -0
- policyengine_us/variables/gov/states/mn/tax/income/credits/cdcc/mn_cdcc_dependent_count.py +27 -0
- policyengine_us/variables/gov/states/mn/tax/income/credits/cdcc/mn_cdcc_eligible.py +23 -0
- policyengine_us/variables/gov/states/mn/tax/income/credits/cdcc/mn_cdcc_phase_out.py +25 -0
- policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/README.md +1 -0
- policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_federal_income_tax_deduction_for_federal_itemization.py +26 -0
- policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_federal_income_tax_deduction_for_federal_itemization_indiv.py +34 -0
- policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_indiv.py +41 -0
- policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_joint.py +37 -0
- policyengine_us/variables/gov/states/nm/tax/income/deductions/nm_deductions.py +1 -1
- policyengine_us/variables/gov/states/nm/tax/income/deductions/nm_itemized_deductions.py +13 -0
- policyengine_us/variables/gov/states/tax/income/state_itemized_deductions.py +64 -0
- policyengine_us/variables/gov/states/tax/income/state_standard_deduction.py +68 -1
- {policyengine_us-1.400.0.dist-info → policyengine_us-1.400.2.dist-info}/METADATA +1 -1
- {policyengine_us-1.400.0.dist-info → policyengine_us-1.400.2.dist-info}/RECORD +54 -33
- policyengine_us/variables/gov/states/mn/tax/income/credits/mn_cdcc.py +0 -49
- {policyengine_us-1.400.0.dist-info → policyengine_us-1.400.2.dist-info}/WHEEL +0 -0
- {policyengine_us-1.400.0.dist-info → policyengine_us-1.400.2.dist-info}/entry_points.txt +0 -0
- {policyengine_us-1.400.0.dist-info → policyengine_us-1.400.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -19,10 +19,13 @@ class me_deductions(Variable):
|
|
|
19
19
|
|
|
20
20
|
# Get the relevant deduction amount (Line 6).
|
|
21
21
|
# Either itemized deduction or federal standard deduction.
|
|
22
|
-
|
|
22
|
+
itemizes = tax_unit("tax_unit_itemizes", period)
|
|
23
|
+
standard_deduction = tax_unit("standard_deduction", period)
|
|
24
|
+
larger_deduction = max_(
|
|
23
25
|
tax_unit("me_itemized_deductions_pre_phaseout", period),
|
|
24
|
-
|
|
26
|
+
standard_deduction,
|
|
25
27
|
)
|
|
28
|
+
max_deduction = where(itemizes, larger_deduction, standard_deduction)
|
|
26
29
|
|
|
27
30
|
# Calculate the phaseout amount (Line 7).
|
|
28
31
|
phaseout_amount = max_deduction * phaseout_percent
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mn_cdcc(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = "Minnesota child and dependent care expense credit"
|
|
8
|
+
unit = USD
|
|
9
|
+
definition_period = YEAR
|
|
10
|
+
reference = (
|
|
11
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-02/m1cd_21.pdf"
|
|
12
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-01/m1cd_22_0.pdf"
|
|
13
|
+
)
|
|
14
|
+
defined_for = "mn_cdcc_eligible"
|
|
15
|
+
|
|
16
|
+
def formula(tax_unit, period, parameters):
|
|
17
|
+
p = parameters(period).gov.states.mn.tax.income.credits.cdcc
|
|
18
|
+
dep_count = tax_unit("mn_cdcc_dependent_count", period)
|
|
19
|
+
# calculate qualifying care expenses
|
|
20
|
+
expenses = tax_unit("tax_unit_childcare_expenses", period)
|
|
21
|
+
# ... cap expense by number of qualifying dependents
|
|
22
|
+
eligible_count = min_(dep_count, p.maximum_dependents)
|
|
23
|
+
maximum_eligible_expenses = min_(
|
|
24
|
+
expenses, p.maximum_expense * eligible_count
|
|
25
|
+
)
|
|
26
|
+
# ... cap expense by lower earnings of head and spouse if present
|
|
27
|
+
# Line 2
|
|
28
|
+
capped_expenses = min_(
|
|
29
|
+
maximum_eligible_expenses,
|
|
30
|
+
tax_unit("min_head_spouse_earned", period),
|
|
31
|
+
)
|
|
32
|
+
# calculate pre-phaseout credit amount
|
|
33
|
+
# Line 5
|
|
34
|
+
agi = tax_unit("adjusted_gross_income", period)
|
|
35
|
+
# Line 7
|
|
36
|
+
pre_phaseout_amount = capped_expenses * p.expense_fraction.calc(agi)
|
|
37
|
+
# calculate post-phaseout credit amount
|
|
38
|
+
# Line 8
|
|
39
|
+
phaseout_amount = tax_unit("mn_cdcc_phase_out", period)
|
|
40
|
+
smaller_of_expenses_and_reduced_credit = min_(
|
|
41
|
+
pre_phaseout_amount, phaseout_amount
|
|
42
|
+
)
|
|
43
|
+
return where(
|
|
44
|
+
agi > p.phaseout_threshold,
|
|
45
|
+
smaller_of_expenses_and_reduced_credit,
|
|
46
|
+
pre_phaseout_amount,
|
|
47
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mn_cdcc_dependent_count(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = "Minnesota child and dependent care expense credit dependent count"
|
|
8
|
+
unit = USD
|
|
9
|
+
definition_period = YEAR
|
|
10
|
+
reference = (
|
|
11
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-02/m1cd_21.pdf"
|
|
12
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-01/m1cd_22_0.pdf"
|
|
13
|
+
)
|
|
14
|
+
defined_for = "mn_cdcc_eligible"
|
|
15
|
+
|
|
16
|
+
def formula(tax_unit, period, parameters):
|
|
17
|
+
p = parameters(period).gov.states.mn.tax.income.credits.cdcc
|
|
18
|
+
person = tax_unit.members
|
|
19
|
+
# calculate number of qualifying dependents
|
|
20
|
+
# ... children
|
|
21
|
+
age = person("age", period)
|
|
22
|
+
qualifies_by_age = age < p.child_age
|
|
23
|
+
# ... disability
|
|
24
|
+
non_head = ~person("is_tax_unit_head", period)
|
|
25
|
+
disabled = person("is_incapable_of_self_care", period)
|
|
26
|
+
qualifies_by_disability = non_head & disabled
|
|
27
|
+
return tax_unit.sum(qualifies_by_age | qualifies_by_disability)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mn_cdcc_eligible(Variable):
|
|
5
|
+
value_type = bool
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = (
|
|
8
|
+
"Eligible for the Minnesota child and dependent care expense credit"
|
|
9
|
+
)
|
|
10
|
+
definition_period = YEAR
|
|
11
|
+
reference = (
|
|
12
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-02/m1cd_21.pdf"
|
|
13
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-01/m1cd_22_0.pdf"
|
|
14
|
+
)
|
|
15
|
+
defined_for = StateCode.MN
|
|
16
|
+
|
|
17
|
+
def formula(tax_unit, period, parameters):
|
|
18
|
+
p = parameters(period).gov.states.mn.tax.income.credits.cdcc
|
|
19
|
+
if p.separate_filers_excluded:
|
|
20
|
+
filing_status = tax_unit("filing_status", period)
|
|
21
|
+
return filing_status != filing_status.possible_values.SEPARATE
|
|
22
|
+
else:
|
|
23
|
+
return True
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mn_cdcc_phase_out(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = "Minnesota child and dependent care expense credit phase out"
|
|
8
|
+
unit = USD
|
|
9
|
+
definition_period = YEAR
|
|
10
|
+
reference = (
|
|
11
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-02/m1cd_21.pdf"
|
|
12
|
+
"https://www.revenue.state.mn.us/sites/default/files/2023-01/m1cd_22_0.pdf"
|
|
13
|
+
)
|
|
14
|
+
defined_for = "mn_cdcc_eligible"
|
|
15
|
+
|
|
16
|
+
def formula(tax_unit, period, parameters):
|
|
17
|
+
p = parameters(period).gov.states.mn.tax.income.credits.cdcc
|
|
18
|
+
dep_count = tax_unit("mn_cdcc_dependent_count", period)
|
|
19
|
+
# calculate pre-phaseout credit amount
|
|
20
|
+
agi = tax_unit("adjusted_gross_income", period)
|
|
21
|
+
# calculate post-phaseout credit amount
|
|
22
|
+
excess_agi = max_(0, agi - p.phaseout_threshold)
|
|
23
|
+
reduced_agi = excess_agi * p.phaseout_rate
|
|
24
|
+
reduced_base_amount = p.reduced_base_amount.calc(dep_count)
|
|
25
|
+
return max_(0, reduced_base_amount - reduced_agi)
|
policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# These files are used for the calculation of the federal itemization choice to avoid circular reference errors regarding the federal tax deduction. They are not applied in the final Montana income tax calculation.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mt_federal_income_tax_deduction_for_federal_itemization(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
definition_period = YEAR
|
|
8
|
+
label = "Montana federal income tax deduction for the entire tax unit"
|
|
9
|
+
reference = (
|
|
10
|
+
"https://law.justia.com/codes/montana/2021/title-15/chapter-30/part-21/section-15-30-2131/"
|
|
11
|
+
# MT Code § 15-30-2131 (2021) (1)(b)
|
|
12
|
+
)
|
|
13
|
+
unit = USD
|
|
14
|
+
defined_for = StateCode.MT
|
|
15
|
+
|
|
16
|
+
def formula(tax_unit, period, parameters):
|
|
17
|
+
filing_status = tax_unit("filing_status", period)
|
|
18
|
+
p = parameters(
|
|
19
|
+
period
|
|
20
|
+
).gov.states.mt.tax.income.deductions.itemized.federal_income_tax
|
|
21
|
+
federal_income_tax_limit = p.cap[filing_status]
|
|
22
|
+
|
|
23
|
+
withheld_income_tax = tax_unit("mt_withheld_income_tax", period)
|
|
24
|
+
# The federal income tax deduction is attributed to the head in any case
|
|
25
|
+
# as we currently do not have a way to determine individual federal income tax before credits.
|
|
26
|
+
return min_(withheld_income_tax, federal_income_tax_limit)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mt_federal_income_tax_deduction_for_federal_itemization_indiv(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = Person
|
|
7
|
+
definition_period = YEAR
|
|
8
|
+
label = "Montana federal income tax deduction when married couples are filing separately"
|
|
9
|
+
reference = (
|
|
10
|
+
"https://law.justia.com/codes/montana/2021/title-15/chapter-30/part-21/section-15-30-2131/"
|
|
11
|
+
# MT Code § 15-30-2131 (2021) (1)(b)
|
|
12
|
+
)
|
|
13
|
+
unit = USD
|
|
14
|
+
defined_for = StateCode.MT
|
|
15
|
+
|
|
16
|
+
def formula(person, period, parameters):
|
|
17
|
+
unit_deds = person.tax_unit(
|
|
18
|
+
"mt_federal_income_tax_deduction_for_federal_itemization", period
|
|
19
|
+
)
|
|
20
|
+
person_agi = person("mt_agi", period)
|
|
21
|
+
total_agi = person.tax_unit.sum(person_agi)
|
|
22
|
+
|
|
23
|
+
prorate = np.zeros_like(total_agi)
|
|
24
|
+
mask = total_agi > 0
|
|
25
|
+
prorate[mask] = person_agi[mask] / total_agi[mask]
|
|
26
|
+
filing_status = person.tax_unit(
|
|
27
|
+
"state_filing_status_if_married_filing_separately_on_same_return",
|
|
28
|
+
period,
|
|
29
|
+
)
|
|
30
|
+
p = parameters(
|
|
31
|
+
period
|
|
32
|
+
).gov.states.mt.tax.income.deductions.itemized.federal_income_tax
|
|
33
|
+
cap = p.cap[filing_status]
|
|
34
|
+
return min_(unit_deds * prorate, cap)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mt_itemized_deductions_for_federal_itemization_indiv(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = Person
|
|
7
|
+
label = "Montana itemized deductions when married couples are filing separately"
|
|
8
|
+
unit = USD
|
|
9
|
+
definition_period = YEAR
|
|
10
|
+
reference = (
|
|
11
|
+
"https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7"
|
|
12
|
+
"https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/"
|
|
13
|
+
# MT Code § 15-30-2131 (2022) (1)
|
|
14
|
+
)
|
|
15
|
+
defined_for = StateCode.MT
|
|
16
|
+
|
|
17
|
+
def formula(person, period, parameters):
|
|
18
|
+
p = parameters(period).gov.irs.deductions
|
|
19
|
+
# Since we only compute the federal charitable deduction at the tax unit level,
|
|
20
|
+
# we will split the value between each spouse
|
|
21
|
+
charitable_deduction = (
|
|
22
|
+
person.tax_unit("charitable_deduction", period) * 0.5
|
|
23
|
+
)
|
|
24
|
+
head_or_spouse = person("is_tax_unit_head_or_spouse", period)
|
|
25
|
+
# The interest deduction is the sum of mortagage and investment interest expenses
|
|
26
|
+
investment_interest = person("investment_interest_expense", period)
|
|
27
|
+
mortgage_interest = person("mortgage_interest", period)
|
|
28
|
+
interest_ded = investment_interest + mortgage_interest
|
|
29
|
+
other_deductions = add(
|
|
30
|
+
person,
|
|
31
|
+
period,
|
|
32
|
+
[
|
|
33
|
+
"mt_misc_deductions",
|
|
34
|
+
"mt_medical_expense_deduction_indiv",
|
|
35
|
+
"mt_salt_deduction",
|
|
36
|
+
"mt_federal_income_tax_deduction_for_federal_itemization_indiv",
|
|
37
|
+
],
|
|
38
|
+
)
|
|
39
|
+
return head_or_spouse * (
|
|
40
|
+
interest_ded + charitable_deduction + other_deductions
|
|
41
|
+
)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class mt_itemized_deductions_for_federal_itemization_joint(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = Person
|
|
7
|
+
label = (
|
|
8
|
+
"Montana itemized deductions when married couples are filing jointly"
|
|
9
|
+
)
|
|
10
|
+
unit = USD
|
|
11
|
+
definition_period = YEAR
|
|
12
|
+
reference = (
|
|
13
|
+
"https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7"
|
|
14
|
+
"https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/"
|
|
15
|
+
# MT Code § 15-30-2131 (2022) (1)
|
|
16
|
+
)
|
|
17
|
+
defined_for = StateCode.MT
|
|
18
|
+
|
|
19
|
+
def formula(person, period, parameters):
|
|
20
|
+
charitable_deduction = person.tax_unit("charitable_deduction", period)
|
|
21
|
+
investment_interest = person("investment_interest_expense", period)
|
|
22
|
+
mortgage_interest = person("mortgage_interest", period)
|
|
23
|
+
interest_ded = investment_interest + mortgage_interest
|
|
24
|
+
other_deductions = add(
|
|
25
|
+
person.tax_unit,
|
|
26
|
+
period,
|
|
27
|
+
[
|
|
28
|
+
"mt_misc_deductions",
|
|
29
|
+
"mt_medical_expense_deduction_joint",
|
|
30
|
+
"mt_salt_deduction",
|
|
31
|
+
"mt_federal_income_tax_deduction_for_federal_itemization",
|
|
32
|
+
],
|
|
33
|
+
)
|
|
34
|
+
is_head = person("is_tax_unit_head", period)
|
|
35
|
+
return is_head * (
|
|
36
|
+
interest_ded + other_deductions + charitable_deduction
|
|
37
|
+
)
|
|
@@ -11,7 +11,7 @@ class nm_deductions(Variable):
|
|
|
11
11
|
|
|
12
12
|
def formula(tax_unit, period, parameters):
|
|
13
13
|
itemized_on_federal_return = tax_unit("tax_unit_itemizes", period)
|
|
14
|
-
itm_ded = tax_unit("
|
|
14
|
+
itm_ded = tax_unit("nm_itemized_deductions", period)
|
|
15
15
|
standard_ded = tax_unit("standard_deduction", period)
|
|
16
16
|
# Tax filer is required to itemize deductions if they itemize on their federal return as per:
|
|
17
17
|
# https://klvg4oyd4j.execute-api.us-west-2.amazonaws.com/prod/PublicFiles/34821a9573ca43e7b06dfad20f5183fd/1afc56af-ea90-4d48-82e5-1f9aeb43255a/PITbook2022.pdf
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class nm_itemized_deductions(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = "New Mexico itemized deductions"
|
|
8
|
+
unit = USD
|
|
9
|
+
definition_period = YEAR
|
|
10
|
+
reference = "https://klvg4oyd4j.execute-api.us-west-2.amazonaws.com/prod/PublicFiles/34821a9573ca43e7b06dfad20f5183fd/1afc56af-ea90-4d48-82e5-1f9aeb43255a/PITbook2022.pdf"
|
|
11
|
+
defined_for = StateCode.NM
|
|
12
|
+
|
|
13
|
+
adds = ["total_itemized_taxable_income_deductions"]
|
|
@@ -8,3 +8,67 @@ class state_itemized_deductions(Variable):
|
|
|
8
8
|
unit = USD
|
|
9
9
|
definition_period = YEAR
|
|
10
10
|
adds = "gov.states.household.state_itemized_deductions"
|
|
11
|
+
|
|
12
|
+
def formula(tax_unit, period, parameters):
|
|
13
|
+
# States that adopt the federal itemized deductions
|
|
14
|
+
# Based on comments in state_itemized_deductions.yaml
|
|
15
|
+
FEDERAL_ITEMIZED_DEDUCTION_STATES = [
|
|
16
|
+
"CT", # Connecticut
|
|
17
|
+
"GA", # Georgia
|
|
18
|
+
"ND", # North Dakota
|
|
19
|
+
"SC", # South Carolina
|
|
20
|
+
"UT", # Utah
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Get the current state
|
|
24
|
+
state_code = tax_unit.household("state_code_str", period)
|
|
25
|
+
|
|
26
|
+
# Get the sum of state-specific itemized deductions
|
|
27
|
+
state_specific_base = add(
|
|
28
|
+
tax_unit,
|
|
29
|
+
period,
|
|
30
|
+
parameters(period).gov.states.household.state_itemized_deductions,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Special handling for states that need individual vs joint itemization maximum
|
|
34
|
+
STATES_WITH_INDIVIDUAL_JOINT_MAXIMUM = {
|
|
35
|
+
"MT": {
|
|
36
|
+
"indiv": "mt_itemized_deductions_for_federal_itemization_indiv",
|
|
37
|
+
"joint": "mt_itemized_deductions_for_federal_itemization_joint",
|
|
38
|
+
},
|
|
39
|
+
"IA": {
|
|
40
|
+
"indiv": "ia_itemized_deductions_indiv",
|
|
41
|
+
"joint": "ia_itemized_deductions_joint",
|
|
42
|
+
},
|
|
43
|
+
"DE": {
|
|
44
|
+
"indiv": "de_itemized_deductions_indv",
|
|
45
|
+
"joint": "de_itemized_deductions_joint",
|
|
46
|
+
},
|
|
47
|
+
"AR": {
|
|
48
|
+
"indiv": "ar_itemized_deductions_indiv",
|
|
49
|
+
"joint": "ar_itemized_deductions_joint",
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Calculate maximum itemized deductions for applicable states
|
|
54
|
+
for state, variables in STATES_WITH_INDIVIDUAL_JOINT_MAXIMUM.items():
|
|
55
|
+
is_state = state_code == state
|
|
56
|
+
indiv_deductions = add(tax_unit, period, [variables["indiv"]])
|
|
57
|
+
joint_deductions = add(tax_unit, period, [variables["joint"]])
|
|
58
|
+
max_deductions = max_(indiv_deductions, joint_deductions)
|
|
59
|
+
state_specific_base = where(
|
|
60
|
+
is_state, max_deductions, state_specific_base
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Check if the state adopts federal itemized deductions
|
|
64
|
+
uses_federal = np.isin(state_code, FEDERAL_ITEMIZED_DEDUCTION_STATES)
|
|
65
|
+
|
|
66
|
+
# Get federal itemized deductions (sum of all federal itemized deduction components)
|
|
67
|
+
federal_itemized = add(
|
|
68
|
+
tax_unit,
|
|
69
|
+
period,
|
|
70
|
+
parameters(period).gov.irs.deductions.itemized_deductions,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# Return federal itemized deductions for states that adopt them, otherwise state-specific
|
|
74
|
+
return where(uses_federal, federal_itemized, state_specific_base)
|
|
@@ -7,4 +7,71 @@ class state_standard_deduction(Variable):
|
|
|
7
7
|
label = "State standard deduction"
|
|
8
8
|
unit = USD
|
|
9
9
|
definition_period = YEAR
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
def formula(tax_unit, period, parameters):
|
|
12
|
+
# States that adopt the federal standard deduction
|
|
13
|
+
# Based on comments in state_standard_deductions.yaml
|
|
14
|
+
FEDERAL_STANDARD_DEDUCTION_STATES = [
|
|
15
|
+
"CT", # Connecticut
|
|
16
|
+
"ID", # Idaho
|
|
17
|
+
"ME", # Maine
|
|
18
|
+
"MO", # Missouri
|
|
19
|
+
"ND", # North Dakota
|
|
20
|
+
"NM", # New Mexico
|
|
21
|
+
"SC", # South Carolina
|
|
22
|
+
"UT", # Utah
|
|
23
|
+
"CO", # Colorado
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
# Get the sum of state-specific standard deductions
|
|
27
|
+
state_specific = add(
|
|
28
|
+
tax_unit,
|
|
29
|
+
period,
|
|
30
|
+
parameters(period).gov.states.household.state_standard_deductions,
|
|
31
|
+
)
|
|
32
|
+
state_code = tax_unit.household("state_code_str", period)
|
|
33
|
+
|
|
34
|
+
# Special handling for states that need individual vs joint standard deduction maximum
|
|
35
|
+
STATES_WITH_INDIVIDUAL_JOINT_MAXIMUM = {
|
|
36
|
+
"MT": {
|
|
37
|
+
"indiv": "mt_standard_deduction_indiv",
|
|
38
|
+
"joint": "mt_standard_deduction_joint",
|
|
39
|
+
},
|
|
40
|
+
"IA": {
|
|
41
|
+
"indiv": "ia_standard_deduction_indiv",
|
|
42
|
+
"joint": "ia_standard_deduction_joint",
|
|
43
|
+
},
|
|
44
|
+
"DE": {
|
|
45
|
+
"indiv": "de_standard_deduction_indv",
|
|
46
|
+
"joint": "de_standard_deduction_joint",
|
|
47
|
+
},
|
|
48
|
+
"AR": {
|
|
49
|
+
"indiv": "ar_standard_deduction_indiv",
|
|
50
|
+
"joint": "ar_standard_deduction_joint",
|
|
51
|
+
},
|
|
52
|
+
"MS": {
|
|
53
|
+
"indiv": "ms_standard_deduction_indiv",
|
|
54
|
+
"joint": "ms_standard_deduction_joint",
|
|
55
|
+
},
|
|
56
|
+
"KY": {
|
|
57
|
+
"indiv": "ky_standard_deduction_indiv",
|
|
58
|
+
"joint": "ky_standard_deduction_joint",
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Calculate maximum standard deductions for applicable states
|
|
63
|
+
for state, variables in STATES_WITH_INDIVIDUAL_JOINT_MAXIMUM.items():
|
|
64
|
+
is_state = state_code == state
|
|
65
|
+
indiv_deductions = add(tax_unit, period, [variables["indiv"]])
|
|
66
|
+
joint_deductions = add(tax_unit, period, [variables["joint"]])
|
|
67
|
+
max_deductions = max_(indiv_deductions, joint_deductions)
|
|
68
|
+
state_specific = where(is_state, max_deductions, state_specific)
|
|
69
|
+
|
|
70
|
+
# Check if the state adopts federal standard deduction
|
|
71
|
+
uses_federal = np.isin(state_code, FEDERAL_STANDARD_DEDUCTION_STATES)
|
|
72
|
+
|
|
73
|
+
# Get federal standard deduction
|
|
74
|
+
federal_deduction = tax_unit("standard_deduction", period)
|
|
75
|
+
|
|
76
|
+
# Return federal deduction for states that adopt it, otherwise state-specific
|
|
77
|
+
return where(uses_federal, federal_deduction, state_specific)
|