policyengine-us 1.367.0__py3-none-any.whl → 1.368.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.

@@ -0,0 +1,18 @@
1
+ description: The Committee for a Responsible Federal Budget proposes a nonrefundable credit of this amount to offset taxes from Social Security benefits.
2
+ metadata:
3
+ unit: currency-USD
4
+ label: CRFB Social Security nonrefundable credit amount
5
+ period: year
6
+ breakdown:
7
+ - filing_status
8
+
9
+ JOINT:
10
+ 0000-01-01: 600
11
+ SINGLE:
12
+ 0000-01-01: 600
13
+ SEPARATE:
14
+ 0000-01-01: 600
15
+ HEAD_OF_HOUSEHOLD:
16
+ 0000-01-01: 600
17
+ SURVIVING_SPOUSE:
18
+ 0000-01-01: 600
@@ -0,0 +1,8 @@
1
+ description: The Committee for a Responsible Federal Budget's proposed nonrefundable credit to offset taxes from Social Security benefits is active if this is true.
2
+ metadata:
3
+ unit: bool
4
+ period: year
5
+ label: CRFB Social Security nonrefundable credit in effect
6
+
7
+ values:
8
+ 0000-01-01: false
@@ -18,3 +18,6 @@ from .tax_employer_medicare_tax import (
18
18
  from .tax_employer_payroll_tax import (
19
19
  create_tax_employer_payroll_tax_reform,
20
20
  )
21
+ from .non_refundable_ss_credit import (
22
+ create_non_refundable_ss_credit_reform,
23
+ )
@@ -0,0 +1,123 @@
1
+ from policyengine_us.model_api import *
2
+ from policyengine_core.periods import period as period_
3
+ from policyengine_core.periods import instant
4
+
5
+
6
+ def non_refundable_ss_credit_reform() -> Reform:
7
+ class ss_credit(Variable):
8
+ value_type = float
9
+ entity = Person
10
+ label = "Social Security credit"
11
+ definition_period = YEAR
12
+ unit = USD
13
+
14
+ def formula(person, period, parameters):
15
+ taxable_social_security = person("taxable_social_security", period)
16
+ highest_tax_rate = person.tax_unit("highest_tax_rate", period)
17
+ ss_tax = taxable_social_security * highest_tax_rate
18
+ p = parameters(period).gov.contrib.crfb.ss_credit
19
+ filing_status = person.tax_unit("filing_status", period)
20
+ return min_(ss_tax, p.amount[filing_status])
21
+
22
+ class highest_tax_rate(Variable):
23
+ value_type = float
24
+ entity = TaxUnit
25
+ definition_period = YEAR
26
+ label = "Highest tax rate faced by tax unit"
27
+ reference = "https://www.law.cornell.edu/uscode/text/26/1"
28
+ unit = "/1"
29
+
30
+ def formula(tax_unit, period, parameters):
31
+ # compute taxable income that is taxed at the main rates
32
+ full_taxable_income = tax_unit("taxable_income", period)
33
+ cg_exclusion = tax_unit(
34
+ "capital_gains_excluded_from_taxable_income", period
35
+ )
36
+ taxinc = max_(0, full_taxable_income - cg_exclusion)
37
+
38
+ # get bracket rates and thresholds
39
+ p = parameters(period).gov.irs.income
40
+ filing_status = tax_unit("filing_status", period)
41
+
42
+ # Vectorized approach: determine the highest applicable rate for each household
43
+ # We'll check each bracket and keep the rate if income falls within it
44
+
45
+ # Start with the base rate (10%)
46
+ highest_rate = p.bracket.rates["1"]
47
+
48
+ # Get all bracket numbers
49
+ bracket_numbers = list(p.bracket.rates.__iter__())
50
+
51
+ # Process each bracket from lowest to highest
52
+ # The threshold is the upper bound of each bracket
53
+ prev_threshold = np.zeros_like(taxinc)
54
+
55
+ for bracket_num in bracket_numbers:
56
+ b = str(bracket_num)
57
+ rate = p.bracket.rates[b]
58
+
59
+ # Get the upper threshold for this bracket based on filing status
60
+ if b == "7":
61
+ # The top bracket has no upper limit
62
+ threshold = np.inf * np.ones_like(taxinc)
63
+ else:
64
+ threshold = p.bracket.thresholds[b][filing_status]
65
+
66
+ # Update the rate for households with income in this bracket
67
+ # Income is in this bracket if it's > prev_threshold and <= threshold
68
+ in_bracket = (taxinc > prev_threshold) & (taxinc <= threshold)
69
+ highest_rate = where(in_bracket, rate, highest_rate)
70
+
71
+ # Store this threshold as the previous for next iteration
72
+ prev_threshold = where(
73
+ threshold != np.inf, threshold, prev_threshold
74
+ )
75
+
76
+ return highest_rate
77
+
78
+ class reform(Reform):
79
+ def apply(self):
80
+ self.update_variable(ss_credit)
81
+ self.update_variable(highest_tax_rate)
82
+ self.neutralize_variable("additional_senior_deduction")
83
+
84
+ return reform
85
+
86
+
87
+ def create_non_refundable_ss_credit_reform(
88
+ parameters, period, bypass: bool = False
89
+ ):
90
+ # Create a create_{reform name} function that initializes the reform object
91
+ # There are two sufficient conditions for this function to return
92
+ # the reform
93
+
94
+ # 1. If bypass is set to true
95
+ if bypass is True:
96
+ return non_refundable_ss_credit_reform()
97
+
98
+ # 2. If boolean in in_effect.yaml is set to true
99
+ parameter = parameters.gov.contrib.crfb.ss_credit
100
+ current_period = period_(period)
101
+ reform_active = False
102
+
103
+ for i in range(5):
104
+ if parameter(current_period).in_effect:
105
+ # If in any of the next five years, the boolean is true,
106
+ # set the boolean reform_active to true, and stop the check,
107
+ # i.e., assume the reform is active in all subsequent years.
108
+ reform_active = True
109
+ break
110
+ current_period = current_period.offset(1, "year")
111
+
112
+ # if the loop set reform_active to true, return the reform.
113
+ if reform_active:
114
+ return non_refundable_ss_credit_reform()
115
+ else:
116
+ return None
117
+
118
+
119
+ # Create a reform object to by setting bypass to true,
120
+ # for the purpose of running tests
121
+ non_refundable_ss_credit_reform_object = (
122
+ create_non_refundable_ss_credit_reform(None, None, bypass=True)
123
+ )
@@ -101,6 +101,9 @@ from .additional_tax_bracket import (
101
101
  from .congress.hawley.awra import (
102
102
  create_american_worker_rebate_act_reform,
103
103
  )
104
+ from .crfb import (
105
+ create_non_refundable_ss_credit_reform,
106
+ )
104
107
 
105
108
  from policyengine_core.reforms import Reform
106
109
  import warnings
@@ -210,6 +213,9 @@ def create_structural_reforms_from_parameters(parameters, period):
210
213
  afa_other_dependent_credit = create_afa_other_dependent_credit_reform(
211
214
  parameters, period
212
215
  )
216
+ non_refundable_ss_credit = create_non_refundable_ss_credit_reform(
217
+ parameters, period
218
+ )
213
219
 
214
220
  reconciled_ssn_for_llc_and_aoc = (
215
221
  create_reconciled_ssn_for_llc_and_aoc_reform(parameters, period)
@@ -265,6 +271,7 @@ def create_structural_reforms_from_parameters(parameters, period):
265
271
  tax_employer_medicare_tax,
266
272
  tax_employer_payroll_tax,
267
273
  afa_other_dependent_credit,
274
+ non_refundable_ss_credit,
268
275
  reconciled_ssn_for_llc_and_aoc,
269
276
  ctc_additional_bracket,
270
277
  mi_surtax,
@@ -0,0 +1,45 @@
1
+ - name: Single person in the highest tax bracket
2
+ period: 2026
3
+ reforms: policyengine_us.reforms.crfb.non_refundable_ss_credit.non_refundable_ss_credit_reform_object
4
+ input:
5
+ gov.contrib.crfb.ss_credit.in_effect: true
6
+ taxable_social_security: 30_000
7
+ taxable_income: 1_000_000
8
+ filing_status: SINGLE
9
+ output:
10
+ highest_tax_rate: 0.37
11
+ ss_credit: 600
12
+
13
+ - name: Single person in the highest tax bracket
14
+ period: 2026
15
+ reforms: policyengine_us.reforms.crfb.non_refundable_ss_credit.non_refundable_ss_credit_reform_object
16
+ input:
17
+ gov.contrib.crfb.ss_credit.in_effect: true
18
+ taxable_social_security: 2_000
19
+ taxable_income: 200_000
20
+ filing_status: JOINT
21
+ output:
22
+ highest_tax_rate: 0.22
23
+ ss_credit: 440
24
+
25
+ - name: Additional senior deduction repeal test
26
+ period: 2026
27
+ reforms: policyengine_us.reforms.crfb.non_refundable_ss_credit.non_refundable_ss_credit_reform_object
28
+ input:
29
+ gov.contrib.crfb.ss_credit.in_effect: true
30
+ additional_senior_deduction_eligible_person: true
31
+ adjusted_gross_income: 10_000
32
+ filing_status: JOINT
33
+ itemized_taxable_income_deductions: 0
34
+ output:
35
+ taxable_income_deductions_if_itemizing: 0
36
+
37
+ - name: Reform not active
38
+ period: 2026
39
+ input:
40
+ additional_senior_deduction_eligible_person: true
41
+ adjusted_gross_income: 10_000
42
+ filing_status: JOINT
43
+ itemized_taxable_income_deductions: 0
44
+ output:
45
+ taxable_income_deductions_if_itemizing: 6_000
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-us
3
- Version: 1.367.0
3
+ Version: 1.368.0
4
4
  Summary: Add your description here.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License-File: LICENSE
@@ -180,6 +180,8 @@ policyengine_us/parameters/gov/contrib/congress/wftca/bonus_guaranteed_deduction
180
180
  policyengine_us/parameters/gov/contrib/congress/wftca/bonus_guaranteed_deduction/phase_out/threshold.yaml,sha256=D7QFIbulmExcc9MVzeEz64isJ9_jscq8ujgDvJMzRlY,906
181
181
  policyengine_us/parameters/gov/contrib/congress/wyden_smith/actc_lookback.yaml,sha256=7nW2PVchIb6Slfip6iPtIqSrmdYoOrFhn0M7N7D6EIY,437
182
182
  policyengine_us/parameters/gov/contrib/congress/wyden_smith/per_child_actc_phase_in.yaml,sha256=3Uer49v5OPi7uDAuGnsSlr_L0EnyeDOlKcQGJYIQ4Ro,418
183
+ policyengine_us/parameters/gov/contrib/crfb/ss_credit/amount.yaml,sha256=6pbayvL12orx2LVgRwCoDOjhinIVKku-Seazx8zVc1A,444
184
+ policyengine_us/parameters/gov/contrib/crfb/ss_credit/in_effect.yaml,sha256=lCJAlnTlCg7juzkhHRO1N8doT6aSmfX2y-2ffJWXQUo,293
183
185
  policyengine_us/parameters/gov/contrib/crfb/tax_employer_medicare_tax/in_effect.yaml,sha256=E2lrX7YCKkIctuL1bw4dlMXDQnLKW29jwYV9temCYsY,221
184
186
  policyengine_us/parameters/gov/contrib/crfb/tax_employer_payroll_tax/in_effect.yaml,sha256=f1OyGZQyJqq0QeUj0oVdtVrWuvSt7bLpRALdu3isHRg,250
185
187
  policyengine_us/parameters/gov/contrib/crfb/tax_employer_social_security_tax/in_effect.yaml,sha256=DTXhl5bLmrrrpBneziAAHGjqKfMIn826IotgKmOajHI,235
@@ -3061,7 +3063,7 @@ policyengine_us/params_on_demand/gov/hhs/medicaid/geography/medicaid_rating_area
3061
3063
  policyengine_us/reforms/__init__.py,sha256=FPV8k2633kzUhbKUK8jC6yJONbnZ5n9zLAq2UL57KH4,113
3062
3064
  policyengine_us/reforms/dc_kccatc.py,sha256=LyGMfEKe-0TgQ-2vCYGOD8W-EGEW8_DgIqCQP89qDyg,4283
3063
3065
  policyengine_us/reforms/dc_tax_threshold_joint_ratio.py,sha256=G-5E1EJFGZ3VeUl_fuyj82nMIttHRNRdlT-x98koJrk,1633
3064
- policyengine_us/reforms/reforms.py,sha256=n6hBdmlke2QPjB15YDu8yuxxQhc6RrOP-n-DxL6RiK4,9502
3066
+ policyengine_us/reforms/reforms.py,sha256=MNsiN7aXbr8MfEpeVpXB0MxRxHpa9-i8zscaWFWkQio,9706
3065
3067
  policyengine_us/reforms/taxsim.py,sha256=bXNFWfjBX5USld1C7fziT6BBmRy-avz00QtL8WmCHy0,5276
3066
3068
  policyengine_us/reforms/winship.py,sha256=_q74Af1nkmoh0-M6PZJ2FcJAn6v5zf5sAEgvxjwHwyA,3069
3067
3069
  policyengine_us/reforms/additional_tax_bracket/__init__.py,sha256=087GDzojnzkbARUgGTQDMNVWJzjtNZvBGr46jfu1kXc,89
@@ -3091,7 +3093,8 @@ policyengine_us/reforms/congress/tlaib/boost/__init__.py,sha256=mTOD_i0DRodonczS
3091
3093
  policyengine_us/reforms/congress/tlaib/boost/boost_middle_class_tax_credit.py,sha256=i-QXr3jR8yTq8XDUdytE7FXjSlNTdBcXV5QZQqrNAZw,5964
3092
3094
  policyengine_us/reforms/congress/wyden_smith/__init__.py,sha256=E2ZbN4mRYi9FniynFYQiWk18byKe_-WmAp9tpG1aXnU,55
3093
3095
  policyengine_us/reforms/congress/wyden_smith/ctc_expansion.py,sha256=SLqv8nk2gQT9xH8amGZMOgbljIkxPMSvL3RC1IMyLsA,5269
3094
- policyengine_us/reforms/crfb/__init__.py,sha256=Vkh4aLUC45PDKXVWqQKI_E_tN1CbIurxb8Ca0IBxRoo,654
3096
+ policyengine_us/reforms/crfb/__init__.py,sha256=na1OcXNKdnI-L9qEKU1HoDOLz7I7LS9Wa7e0fTkaZpc,740
3097
+ policyengine_us/reforms/crfb/non_refundable_ss_credit.py,sha256=xrrXoDlB4s1TqV2PEj0H1RZG8IZl9-zgHSPx7pITqlg,4706
3095
3098
  policyengine_us/reforms/crfb/tax_employer_medicare_tax.py,sha256=Hc2GVwoXn2b_izOyoEpocySLo11BdmzFnyQoEiHJsFI,4236
3096
3099
  policyengine_us/reforms/crfb/tax_employer_payroll_tax.py,sha256=Tkod1VMnZQ-JBJo3dx7xUCq50ZuqUjiHUnkoOyBPVes,4342
3097
3100
  policyengine_us/reforms/crfb/tax_employer_social_security_tax.py,sha256=hawAdLtwCnY3_7jUVPTM0KpeYRfT7tVk0xqCMhdxP4E,4292
@@ -5100,6 +5103,7 @@ policyengine_us/tests/policy/contrib/congress/romney/family_security_act_2024/ei
5100
5103
  policyengine_us/tests/policy/contrib/congress/tlaib/boost/boost_middle_class_tax_credit.yaml,sha256=yT2Xh7jo3t-IVMiI-g2KQ-8_jhCvGLgjtQeKTtVeJT4,4400
5101
5104
  policyengine_us/tests/policy/contrib/congress/tlaib/end_child_poverty_act/ecpa_filer_credit.yaml,sha256=kWLbi3IrulWIxG-JmCXuCg5ItexVNhKSPSDRPPp9meg,460
5102
5105
  policyengine_us/tests/policy/contrib/congress/tlaib/end_child_poverty_act/integration.yaml,sha256=ftBPYvBYAcU-eqk36RQaurDomA9P657tw3V6n107YBk,3692
5106
+ policyengine_us/tests/policy/contrib/crfb/non_refundable_ss_credit.yaml,sha256=ZzhhKEwtqryaEJwUfBKkslGJfA5hSh1kyjBJ3da0-SI,1442
5103
5107
  policyengine_us/tests/policy/contrib/crfb/tax_employer_all_payroll_tax.yaml,sha256=ljSr35bDosWTqTDqEZKWhRqZvIw7SwPVMY-O8YFIsLc,559
5104
5108
  policyengine_us/tests/policy/contrib/crfb/tax_employer_medicare_tax.yaml,sha256=jE-_SssrvqdWuVgw9GrA1sJy6dvrvKuMHwZCHm48oRc,446
5105
5109
  policyengine_us/tests/policy/contrib/crfb/tax_employer_social_security_tax.yaml,sha256=0boINedj32lA-V2VLztNBoylnOlzRinlwtcg3JIij0g,474
@@ -8243,8 +8247,8 @@ policyengine_us/variables/input/farm_income.py,sha256=BEKxYmHNNnWJAAvULl5qZJigy5
8243
8247
  policyengine_us/variables/input/geography.py,sha256=XmBlgXhzBoLRKk6R8taVZHqUw1eU8MbNeGS9iJ7_l44,4506
8244
8248
  policyengine_us/variables/input/self_employment_income.py,sha256=PwsGz8R4lRikKWUYOhsC0qosNNLXq4f5SQmfw4S3mk8,511
8245
8249
  policyengine_us/variables/input/self_employment_income_before_lsr.py,sha256=E8fcX9Nlyqz8dziHhQv_euutdmoIwFMMWePUwbbwv_w,379
8246
- policyengine_us-1.367.0.dist-info/METADATA,sha256=vf9G-Tvd2Fjg47ynSUH4OUWv1SZZKeUPxpAJLukbaqk,1693
8247
- policyengine_us-1.367.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8248
- policyengine_us-1.367.0.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
8249
- policyengine_us-1.367.0.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
8250
- policyengine_us-1.367.0.dist-info/RECORD,,
8250
+ policyengine_us-1.368.0.dist-info/METADATA,sha256=5N6lcyKErpq91X04VTWlq8AsGAZIlUXbpJEhrcCa0R4,1693
8251
+ policyengine_us-1.368.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8252
+ policyengine_us-1.368.0.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
8253
+ policyengine_us-1.368.0.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
8254
+ policyengine_us-1.368.0.dist-info/RECORD,,