policyengine-us 1.400.1__py3-none-any.whl → 1.401.0__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.

Files changed (42) hide show
  1. policyengine_us/parameters/gov/irs/social_security/taxability/rate/additional/benefit_cap.yaml +11 -0
  2. policyengine_us/parameters/gov/irs/social_security/taxability/rate/additional/bracket.yaml +11 -0
  3. policyengine_us/parameters/gov/irs/social_security/taxability/rate/additional/excess.yaml +11 -0
  4. policyengine_us/parameters/gov/irs/social_security/taxability/rate/base/benefit_cap.yaml +11 -0
  5. policyengine_us/parameters/gov/irs/social_security/taxability/rate/base/excess.yaml +11 -0
  6. policyengine_us/parameters/gov/states/household/state_itemized_deductions.yaml +6 -6
  7. policyengine_us/parameters/gov/states/household/state_standard_deductions.yaml +6 -6
  8. policyengine_us/parameters/gov/states/la/tax/income/deductions/itemized/relevant_federal_deductions.yaml +1 -1
  9. policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.yaml +109 -0
  10. policyengine_us/tests/policy/baseline/gov/irs/social_security/taxable_social_security.yaml +71 -0
  11. policyengine_us/tests/policy/baseline/gov/states/la/tax/income/deductions/la_itemized_deductions.yaml +4 -2
  12. policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_deductions.yaml +15 -10
  13. policyengine_us/tests/policy/baseline/gov/states/me/tax/income/taxable_income/deductions/me_itemized_deductions_pre_phaseout.yaml +4 -1
  14. 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
  15. 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
  16. policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_indiv.yaml +76 -0
  17. policyengine_us/tests/policy/baseline/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_joint.yaml +76 -0
  18. policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/deductions/nm_itemized_deductions.yaml +47 -0
  19. policyengine_us/tests/policy/baseline/gov/states/tax/income/state_itemized_deductions.yaml +180 -0
  20. policyengine_us/tests/policy/baseline/gov/states/tax/income/state_standard_deduction.yaml +178 -0
  21. policyengine_us/variables/gov/irs/income/taxable_income/adjusted_gross_income/irs_gross_income/social_security/tax_unit_taxable_social_security.py +27 -11
  22. policyengine_us/variables/gov/irs/income/taxable_income/deductions/tax_unit_itemizes.py +21 -2
  23. policyengine_us/variables/gov/states/ia/tax/income/including_married_filing_separately/deductions/ia_standard_deduction_indiv.py +0 -2
  24. policyengine_us/variables/gov/states/la/tax/income/deductions/la_standard_deduction.py +4 -2
  25. policyengine_us/variables/gov/states/me/tax/income/taxable_income/deductions/me_itemized_deductions_pre_phaseout.py +1 -3
  26. policyengine_us/variables/gov/states/me/tax/income/taxable_income/me_deductions.py +5 -2
  27. policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/README.md +1 -0
  28. policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_federal_income_tax_deduction_for_federal_itemization.py +26 -0
  29. policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_federal_income_tax_deduction_for_federal_itemization_indiv.py +34 -0
  30. policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_indiv.py +41 -0
  31. policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/federal_itemization/mt_itemized_deductions_for_federal_itemization_joint.py +37 -0
  32. policyengine_us/variables/gov/states/nm/tax/income/deductions/nm_deductions.py +1 -1
  33. policyengine_us/variables/gov/states/nm/tax/income/deductions/nm_itemized_deductions.py +13 -0
  34. policyengine_us/variables/gov/states/tax/income/state_itemized_deductions.py +64 -0
  35. policyengine_us/variables/gov/states/tax/income/state_standard_deduction.py +68 -1
  36. {policyengine_us-1.400.1.dist-info → policyengine_us-1.401.0.dist-info}/METADATA +1 -1
  37. {policyengine_us-1.400.1.dist-info → policyengine_us-1.401.0.dist-info}/RECORD +40 -22
  38. policyengine_us/parameters/gov/irs/social_security/taxability/rate/additional.yaml +0 -11
  39. policyengine_us/parameters/gov/irs/social_security/taxability/rate/base.yaml +0 -11
  40. {policyengine_us-1.400.1.dist-info → policyengine_us-1.401.0.dist-info}/WHEEL +0 -0
  41. {policyengine_us-1.400.1.dist-info → policyengine_us-1.401.0.dist-info}/entry_points.txt +0 -0
  42. {policyengine_us-1.400.1.dist-info → policyengine_us-1.401.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,47 @@
1
+ - name: New Mexico adopts federal itemized deductions
2
+ period: 2023
3
+ input:
4
+ state_code: NM
5
+ filing_status: SINGLE
6
+ age_head: 35
7
+ charitable_deduction: 5_000
8
+ interest_deduction: 8_000
9
+ salt_deduction: 10_000
10
+ medical_expense_deduction: 2_000
11
+ output:
12
+ # Federal itemized deductions total
13
+ total_itemized_taxable_income_deductions: 25_000
14
+ # NM uses federal itemized deductions
15
+ nm_itemized_deductions: 25_000
16
+ # Should flow through to state_itemized_deductions
17
+ state_itemized_deductions: 25_000
18
+
19
+ - name: New Mexico itemized deductions for married couple
20
+ period: 2023
21
+ input:
22
+ state_code: NM
23
+ filing_status: JOINT
24
+ age_head: 45
25
+ age_spouse: 43
26
+ charitable_deduction: 10_000
27
+ interest_deduction: 15_000
28
+ salt_deduction: 10_000
29
+ output:
30
+ total_itemized_taxable_income_deductions: 35_000
31
+ nm_itemized_deductions: 35_000
32
+ state_itemized_deductions: 35_000
33
+
34
+ - name: New Mexico itemized deductions for head of household
35
+ period: 2023
36
+ input:
37
+ state_code: NM
38
+ filing_status: HEAD_OF_HOUSEHOLD
39
+ age_head: 38
40
+ charitable_deduction: 3_000
41
+ interest_deduction: 7_000
42
+ salt_deduction: 8_000
43
+ medical_expense_deduction: 1_500
44
+ output:
45
+ total_itemized_taxable_income_deductions: 19_500
46
+ nm_itemized_deductions: 19_500
47
+ state_itemized_deductions: 19_500
@@ -0,0 +1,180 @@
1
+ - name: Federal itemized deductions adopted for Connecticut
2
+ period: 2023
3
+ input:
4
+ state_code: CT
5
+ filing_status: SINGLE
6
+ age_head: 30
7
+ # Set the individual federal deduction components directly
8
+ charitable_deduction: 5_000
9
+ interest_deduction: 8_000
10
+ salt_deduction: 10_000
11
+ output:
12
+ # State should use sum of federal itemized deduction components
13
+ state_itemized_deductions: 23_000
14
+
15
+ - name: Federal itemized deductions adopted for Georgia
16
+ period: 2023
17
+ input:
18
+ state_code: GA
19
+ filing_status: JOINT
20
+ age_head: 40
21
+ age_spouse: 38
22
+ # Set the individual federal deduction components directly
23
+ charitable_deduction: 10_000
24
+ interest_deduction: 15_000
25
+ salt_deduction: 10_000
26
+ output:
27
+ # State should use sum of federal itemized deduction components
28
+ state_itemized_deductions: 35_000
29
+
30
+ - name: State-specific itemized deductions for New York
31
+ period: 2023
32
+ input:
33
+ state_code: NY
34
+ filing_status: SINGLE
35
+ age_head: 35
36
+ adjusted_gross_income: 80_000
37
+ # NY has its own calculation that we set directly
38
+ ny_itemized_deductions: 15_000
39
+ output:
40
+ state_itemized_deductions: 15_000
41
+
42
+ - name: Federal itemized deductions adopted for Utah
43
+ period: 2023
44
+ input:
45
+ state_code: UT
46
+ filing_status: JOINT
47
+ age_head: 45
48
+ age_spouse: 43
49
+ charitable_deduction: 7_500
50
+ interest_deduction: 12_000
51
+ salt_deduction: 8_000
52
+ output:
53
+ # State should use sum of federal itemized deduction components
54
+ state_itemized_deductions: 27_500
55
+
56
+ - name: New Mexico uses federal itemized deductions through its own implementation
57
+ period: 2023
58
+ input:
59
+ state_code: NM
60
+ filing_status: HEAD_OF_HOUSEHOLD
61
+ age_head: 38
62
+ charitable_deduction: 4_000
63
+ interest_deduction: 9_000
64
+ salt_deduction: 7_000
65
+ output:
66
+ # NM uses federal itemized deductions via nm_itemized_deductions
67
+ total_itemized_taxable_income_deductions: 20_000
68
+ nm_itemized_deductions: 20_000
69
+ state_itemized_deductions: 20_000
70
+
71
+ - name: Montana check for individual vs joint itemization
72
+ period: 2023
73
+ input:
74
+ state_code: MT
75
+ filing_status: HEAD_OF_HOUSEHOLD
76
+ age_head: 38
77
+ charitable_deduction: 4_000
78
+ interest_deduction: 9_000
79
+ salt_deduction: 7_000
80
+ output:
81
+ # NM uses federal itemized deductions via nm_itemized_deductions
82
+ total_itemized_taxable_income_deductions: 20_000
83
+ mt_itemized_deductions_for_federal_itemization_indiv: 2_000
84
+ mt_itemized_deductions_for_federal_itemization_joint: 4_000
85
+ state_itemized_deductions: 4_000
86
+
87
+ - name: Montana maximum logic - joint higher
88
+ period: 2023
89
+ input:
90
+ state_code: MT
91
+ filing_status: JOINT
92
+ age_head: 40
93
+ age_spouse: 38
94
+ # Set up scenario where joint calculation is higher
95
+ mt_itemized_deductions_for_federal_itemization_indiv: 8_000
96
+ mt_itemized_deductions_for_federal_itemization_joint: 12_000
97
+ output:
98
+ # Should take the maximum (joint in this case)
99
+ state_itemized_deductions: 12_000
100
+
101
+ - name: Montana maximum logic - individual higher
102
+ period: 2023
103
+ input:
104
+ state_code: MT
105
+ filing_status: SEPARATE
106
+ age_head: 35
107
+ # Set up scenario where individual calculation is higher
108
+ mt_itemized_deductions_for_federal_itemization_indiv: 15_000
109
+ mt_itemized_deductions_for_federal_itemization_joint: 10_000
110
+ output:
111
+ # Should take the maximum (individual in this case)
112
+ state_itemized_deductions: 15_000
113
+
114
+ - name: Iowa maximum logic - joint higher
115
+ period: 2023
116
+ input:
117
+ state_code: IA
118
+ filing_status: JOINT
119
+ age_head: 42
120
+ age_spouse: 40
121
+ # Set up scenario where joint calculation is higher
122
+ ia_itemized_deductions_indiv: 6_000
123
+ ia_itemized_deductions_joint: 9_000
124
+ output:
125
+ # Should take the maximum (joint in this case)
126
+ state_itemized_deductions: 9_000
127
+
128
+ - name: Iowa maximum logic - individual higher
129
+ period: 2023
130
+ input:
131
+ state_code: IA
132
+ filing_status: SEPARATE
133
+ age_head: 45
134
+ # Set up scenario where individual calculation is higher
135
+ ia_itemized_deductions_indiv: 11_000
136
+ ia_itemized_deductions_joint: 7_000
137
+ output:
138
+ # Should take the maximum (individual in this case)
139
+ state_itemized_deductions: 11_000
140
+
141
+ - name: Delaware maximum logic - joint higher
142
+ period: 2023
143
+ input:
144
+ state_code: DE
145
+ filing_status: JOINT
146
+ age_head: 38
147
+ age_spouse: 35
148
+ # Set up scenario where joint calculation is higher
149
+ de_itemized_deductions_indv: 4_500
150
+ de_itemized_deductions_joint: 8_200
151
+ output:
152
+ # Should take the maximum (joint in this case)
153
+ state_itemized_deductions: 8_200
154
+
155
+ - name: Delaware maximum logic - individual higher
156
+ period: 2023
157
+ input:
158
+ state_code: DE
159
+ filing_status: SEPARATE
160
+ age_head: 42
161
+ # Set up scenario where individual calculation is higher
162
+ de_itemized_deductions_indv: 12_500
163
+ de_itemized_deductions_joint: 9_800
164
+ output:
165
+ # Should take the maximum (individual in this case)
166
+ state_itemized_deductions: 12_500
167
+
168
+ - name: Arkansas maximum logic - joint higher
169
+ period: 2023
170
+ input:
171
+ state_code: AR
172
+ filing_status: JOINT
173
+ age_head: 46
174
+ age_spouse: 44
175
+ # Set up scenario where joint calculation is higher
176
+ ar_itemized_deductions_indiv: 3_800
177
+ ar_itemized_deductions_joint: 7_600
178
+ output:
179
+ # Should take the maximum (joint in this case)
180
+ state_itemized_deductions: 7_600
@@ -0,0 +1,178 @@
1
+ - name: Federal standard deduction adopted for Connecticut
2
+ period: 2023
3
+ input:
4
+ state_code: CT
5
+ filing_status: SINGLE
6
+ age_head: 30
7
+ output:
8
+ standard_deduction: 13_850
9
+ state_standard_deduction: 13_850
10
+
11
+ - name: Federal standard deduction adopted for Utah married couple
12
+ period: 2023
13
+ input:
14
+ state_code: UT
15
+ filing_status: JOINT
16
+ age_head: 35
17
+ age_spouse: 33
18
+ output:
19
+ standard_deduction: 27_700
20
+ state_standard_deduction: 27_700
21
+
22
+ - name: State-specific deduction for Georgia
23
+ period: 2023
24
+ input:
25
+ state_code: GA
26
+ filing_status: SINGLE
27
+ age_head: 30
28
+ adjusted_gross_income: 50_000
29
+ output:
30
+ ga_standard_deduction: 5_400
31
+ state_standard_deduction: 5_400
32
+
33
+ - name: State-specific deduction for New York
34
+ period: 2023
35
+ input:
36
+ state_code: NY
37
+ filing_status: JOINT
38
+ age_head: 40
39
+ age_spouse: 38
40
+ adjusted_gross_income: 100_000
41
+ output:
42
+ ny_standard_deduction: 16_050
43
+ state_standard_deduction: 16_050
44
+
45
+ - name: State-specific deduction for Montana
46
+ period: 2023
47
+ input:
48
+ state_code: MT
49
+ filing_status: JOINT
50
+ age_head: 40
51
+ age_spouse: 38
52
+ adjusted_gross_income: 20_000
53
+ output:
54
+ mt_standard_deduction_indiv: 2_460
55
+ mt_standard_deduction_joint: 4_920
56
+ state_standard_deduction: 4_920
57
+
58
+ - name: Montana standard deduction maximum logic - joint higher
59
+ period: 2023
60
+ input:
61
+ state_code: MT
62
+ filing_status: JOINT
63
+ age_head: 45
64
+ age_spouse: 43
65
+ # Set up scenario where joint calculation is higher
66
+ mt_standard_deduction_indiv: 3_000
67
+ mt_standard_deduction_joint: 5_000
68
+ output:
69
+ # Should take the maximum (joint in this case)
70
+ state_standard_deduction: 5_000
71
+
72
+ - name: Montana standard deduction maximum logic - individual higher
73
+ period: 2023
74
+ input:
75
+ state_code: MT
76
+ filing_status: SEPARATE
77
+ age_head: 35
78
+ # Set up scenario where individual calculation is higher
79
+ mt_standard_deduction_indiv: 8_000
80
+ mt_standard_deduction_joint: 6_000
81
+ output:
82
+ # Should take the maximum (individual in this case)
83
+ state_standard_deduction: 8_000
84
+
85
+ - name: Iowa standard deduction maximum logic - joint higher
86
+ period: 2023
87
+ input:
88
+ state_code: IA
89
+ filing_status: JOINT
90
+ age_head: 42
91
+ age_spouse: 40
92
+ # Set up scenario where joint calculation is higher
93
+ ia_standard_deduction_indiv: 2_500
94
+ ia_standard_deduction_joint: 4_000
95
+ output:
96
+ # Should take the maximum (joint in this case)
97
+ state_standard_deduction: 4_000
98
+
99
+ - name: Iowa standard deduction maximum logic - individual higher
100
+ period: 2023
101
+ input:
102
+ state_code: IA
103
+ filing_status: SEPARATE
104
+ age_head: 38
105
+ # Set up scenario where individual calculation is higher
106
+ ia_standard_deduction_indiv: 7_000
107
+ ia_standard_deduction_joint: 5_500
108
+ output:
109
+ # Should take the maximum (individual in this case)
110
+ state_standard_deduction: 7_000
111
+
112
+ - name: Delaware standard deduction maximum logic - joint higher
113
+ period: 2023
114
+ input:
115
+ state_code: DE
116
+ filing_status: JOINT
117
+ age_head: 40
118
+ age_spouse: 37
119
+ # Set up scenario where joint calculation is higher
120
+ de_standard_deduction_indv: 3_200
121
+ de_standard_deduction_joint: 6_400
122
+ output:
123
+ # Should take the maximum (joint in this case)
124
+ state_standard_deduction: 6_400
125
+
126
+ - name: Delaware standard deduction maximum logic - individual higher
127
+ period: 2023
128
+ input:
129
+ state_code: DE
130
+ filing_status: SEPARATE
131
+ age_head: 45
132
+ # Set up scenario where individual calculation is higher
133
+ de_standard_deduction_indv: 8_500
134
+ de_standard_deduction_joint: 7_000
135
+ output:
136
+ # Should take the maximum (individual in this case)
137
+ state_standard_deduction: 8_500
138
+
139
+ - name: Arkansas standard deduction maximum logic - joint higher
140
+ period: 2023
141
+ input:
142
+ state_code: AR
143
+ filing_status: JOINT
144
+ age_head: 44
145
+ age_spouse: 41
146
+ # Set up scenario where joint calculation is higher
147
+ ar_standard_deduction_indiv: 2_340
148
+ ar_standard_deduction_joint: 4_680
149
+ output:
150
+ # Should take the maximum (joint in this case)
151
+ state_standard_deduction: 4_680
152
+
153
+ - name: Mississippi standard deduction maximum logic - joint higher
154
+ period: 2023
155
+ input:
156
+ state_code: MS
157
+ filing_status: JOINT
158
+ age_head: 39
159
+ age_spouse: 36
160
+ # Set up scenario where joint calculation is higher
161
+ ms_standard_deduction_indiv: 2_300
162
+ ms_standard_deduction_joint: 4_600
163
+ output:
164
+ # Should take the maximum (joint in this case)
165
+ state_standard_deduction: 4_600
166
+
167
+ - name: Kentucky standard deduction maximum logic - individual higher
168
+ period: 2023
169
+ input:
170
+ state_code: KY
171
+ filing_status: SEPARATE
172
+ age_head: 41
173
+ # Set up scenario where individual calculation is higher
174
+ ky_standard_deduction_indiv: 3_400
175
+ ky_standard_deduction_joint: 2_650
176
+ output:
177
+ # Should take the maximum (individual in this case)
178
+ state_standard_deduction: 3_400
@@ -49,26 +49,42 @@ class tax_unit_taxable_social_security(Variable):
49
49
  0, combined_income - adjusted_base_amount
50
50
  )
51
51
 
52
- amount_if_under_second_threshold = p.rate.base * min_(
53
- combined_income_excess, gross_ss
52
+ # Tier 1: Between base and adjusted base thresholds
53
+ # Per IRC §86(a)(1), "the amount determined under paragraph (1)"
54
+ # Taxable amount is lesser of:
55
+ # - base.benefit_cap * SS benefits [§86(a)(1)(A)]
56
+ # - base.excess * excess over base [§86(a)(1)(B)]
57
+ amount_under_paragraph_1 = min_(
58
+ p.rate.base.benefit_cap * gross_ss,
59
+ p.rate.base.excess * combined_income_excess,
54
60
  )
61
+
62
+ # Tier 2: Above adjusted base threshold
63
+ # Per IRC §86(a)(2)(A)(ii), the lesser of:
64
+ # - "the amount determined under paragraph (1)" (calculated above)
65
+ # - "one-half of the difference between the adjusted base amount and the base amount"
66
+ bracket_amount = min_(
67
+ amount_under_paragraph_1,
68
+ p.rate.additional.bracket * (adjusted_base_amount - base_amount),
69
+ )
70
+
71
+ # Per IRC §86(a)(2), the lesser of:
72
+ # (A) 85% of excess over adjusted base + bracket amount, or
73
+ # (B) 85% of social security benefits
55
74
  amount_if_over_second_threshold = min_(
56
- p.rate.additional * excess_over_adjusted_base
57
- + min_(
58
- amount_if_under_second_threshold,
59
- p.rate.base * (adjusted_base_amount - base_amount),
60
- ),
61
- p.rate.additional * gross_ss,
75
+ p.rate.additional.excess * excess_over_adjusted_base
76
+ + bracket_amount,
77
+ p.rate.additional.benefit_cap * gross_ss,
62
78
  )
79
+
63
80
  return select(
64
81
  [
65
82
  under_first_threshold,
66
83
  under_second_threshold,
67
- True,
68
84
  ],
69
85
  [
70
86
  0,
71
- amount_if_under_second_threshold,
72
- amount_if_over_second_threshold,
87
+ amount_under_paragraph_1,
73
88
  ],
89
+ default=amount_if_over_second_threshold,
74
90
  )
@@ -10,6 +10,7 @@ class tax_unit_itemizes(Variable):
10
10
  definition_period = YEAR
11
11
 
12
12
  def formula(tax_unit, period, parameters):
13
+
13
14
  if parameters(period).gov.simulation.branch_to_determine_itemization:
14
15
  # determine federal itemization behavior by comparing tax liability
15
16
  tax_liability_if_itemizing = tax_unit(
@@ -18,11 +19,29 @@ class tax_unit_itemizes(Variable):
18
19
  tax_liability_if_not_itemizing = tax_unit(
19
20
  "tax_liability_if_not_itemizing", period
20
21
  )
21
- return tax_liability_if_itemizing < tax_liability_if_not_itemizing
22
+ state_standard_deduction = tax_unit(
23
+ "state_standard_deduction", period
24
+ )
25
+ state_itemized_deductions = tax_unit(
26
+ "state_itemized_deductions", period
27
+ )
28
+ # Use a small tolerance for floating-point comparison due to floating point imprecision
29
+ TOLERANCE = 0.0001
30
+ federal_tax_equal = (
31
+ np.abs(
32
+ tax_liability_if_itemizing - tax_liability_if_not_itemizing
33
+ )
34
+ <= TOLERANCE
35
+ )
36
+ return where(
37
+ federal_tax_equal,
38
+ state_standard_deduction < state_itemized_deductions,
39
+ tax_liability_if_itemizing < tax_liability_if_not_itemizing,
40
+ )
22
41
  else:
23
- # determine federal itemization behavior by comparing deductions
24
42
  standard_deduction = tax_unit("standard_deduction", period)
25
43
  itemized_deductions = tax_unit(
26
44
  "itemized_taxable_income_deductions", period
27
45
  )
46
+ # determine federal itemization behavior by comparing deductions
28
47
  return itemized_deductions > standard_deduction
@@ -34,8 +34,6 @@ class ia_standard_deduction_indiv(Variable):
34
34
  fsvals.SURVIVING_SPOUSE,
35
35
  ],
36
36
  )
37
- is_head = person("is_tax_unit_head", period)
38
- is_spouse = person("is_tax_unit_spouse", period)
39
37
  p = parameters(period).gov.states.ia.tax.income.deductions.standard
40
38
 
41
39
  if p.applies_federal:
@@ -11,5 +11,7 @@ class la_standard_deduction(Variable):
11
11
 
12
12
  def formula(tax_unit, period, parameters):
13
13
  p = parameters(period).gov.states.la.tax.income.deductions.standard
14
- filing_status = tax_unit("filing_status", period)
15
- return p.amount[filing_status]
14
+ if p.applies:
15
+ filing_status = tax_unit("filing_status", period)
16
+ return p.amount[filing_status]
17
+ return 0
@@ -14,8 +14,6 @@ class me_itemized_deductions_pre_phaseout(Variable):
14
14
  defined_for = StateCode.ME
15
15
 
16
16
  def formula(tax_unit, period, parameters):
17
- # Whether or not the taxpayer itemized for federal taxes.
18
- us_itemizing = tax_unit("tax_unit_itemizes", period)
19
17
 
20
18
  # Get the Maine itemizing deduction parameters.
21
19
  p = parameters(period).gov.states.me.tax.income.deductions.itemized
@@ -36,4 +34,4 @@ class me_itemized_deductions_pre_phaseout(Variable):
36
34
  capped_deduction_no_med = min_(deduction_no_med, p.cap)
37
35
 
38
36
  # Add back medical and dental expenses (which are not capped).
39
- return us_itemizing * (capped_deduction_no_med + medical_expenses)
37
+ return capped_deduction_no_med + medical_expenses
@@ -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
- max_deduction = max_(
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
- tax_unit("standard_deduction", period),
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 @@
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
+ )