Skip to content

Commit

Permalink
Puerto Rico Earned Income Credit
Browse files Browse the repository at this point in the history
Fixes #5467
  • Loading branch information
llennemann committed Jan 21, 2025
1 parent eb9f6be commit 9b54ff2
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: The earned income credit will be denied if the sum of the following forms of income is greater than the max limit.
description: Puerto Rico will deny the earned income credit if the sum of the following forms of income is greater than the defined maximum limit.
values:
2010-12-31:
- interest_income
Expand All @@ -8,7 +8,8 @@ values:
- child_support_received
metadata:
unit: list
label: Puerto Rico income sources to calculate for credit denial criteria for earned income credit
period: year
label: Puerto Rico investment income sources to calculate for credit denial criteria for earned income credit
reference:
- title: P.R. Laws tit. 13, § 30211 (e)
href: https://casetext.com/statute/laws-of-puerto-rico/title-thirteen-taxation-and-finance/subtitle-17-internal-revenue-code-of-2011/part-ii-income-taxes/chapter-1007-credits-against-tax/subchapter-b-refundable-credits/30211-earned-income-credit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: Puerto Rico
description: Puerto Rico allows a maximum amount of credit for the earned income credit.
values:
2010-12-31: 350
2011-12-31: 400
Expand All @@ -9,7 +9,7 @@ values:

metadata:
unit: currency-USD
label: Puerto Rico earned income credit maximum amount
label: Puerto Rico earned income credit max amount
period: year
reference:
- title: P.R. Laws tit. 13, § 30211 (1)-(6)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
description: The following is the maximum amount allowed in certain forms of income (i.e. child support payments, interest) to receive the earned income credit.
description: Puerto Rico limits the earned income credit to filers with investment income below this threshold.
values:
2010-12-31: 2_200
metadata:
unit: currency-USD
label: Puerto Rico maximum investment income to receive earned income credit
label: Puerto Rico max investment income to receive earned income credit
period: year
reference:
- title: P.R. Laws tit. 13, § 30211 (e)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description: Puerto Rico has a phase in rate to determine the amount of earned income credit for people that have an income below a certain limit.
description: Puerto Rico has a phase in rate for the earned income credit.
values:
2010-12-31: 0.035
2011-12-31: 0.04
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
description: Puerto Rico has a phase out rate to calculate on any income greater than a certain limit.
description: Puerto Rico has a phase out rate for the earned income credit.
brackets:
- threshold: # if below the threshold, no phase out
# if below the threshold, no phase out
- threshold:
2010-12-31: 0
rate:
2010-12-31: 0
- threshold: # if in the middle bracket, phase out percentage which subtracts from phase in part
# if in the middle bracket, phase out percentage which subtracts from phase in part
- threshold:
2010-12-31: 10_000
rate:
2010-12-31: 0.02
- threshold: # no percentage rate for any amount of income above upper limit
# no percentage rate for any amount of income above upper limit
- threshold:
2010-12-31: 22_500
2011-12-31: 25_000
2012-12-31: 27_500
Expand All @@ -20,6 +23,7 @@ brackets:
metadata:
rate_unit: /1
threshold_unit: currency-USD
type_marginal: marginal_rate
label: Puerto Rico earned income credit phase out rate
period: year
reference:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
- name: Not eligible person, 2024
period: 2024
input:
pr_gross_income_person: 10_000
pr_earned_income_credit_eligible: false
output:
pr_earned_income_credit_amount: 0

- name: Eligible person in the highest bracket, 2024
period: 2024
input:
pr_gross_income_person: 35_000
pr_earned_income_credit_eligible: true
output:
pr_earned_income_credit_amount: 100

- name: Eligible person in the middle bracket, 2024
period: 2024
input:
pr_gross_income_person: 34_000
pr_earned_income_credit_eligible: true
output:
pr_earned_income_credit_amount: 120

- name: Eligible person with max credit, 2024
period: 2024
input:
pr_gross_income_person: 10_000
pr_earned_income_credit_eligible: true
output:
pr_earned_income_credit_amount: 600

- name: Eligible person in the lower bracket, 2024
period: 2024
input:
pr_gross_income_person: 8_000
pr_earned_income_credit_eligible: true
output:
pr_earned_income_credit_amount: 480

- name: Eligible person in the lower bracket, 2011
period: 2011
input:
pr_gross_income_person: 8_000
pr_earned_income_credit_eligible: true
output:
pr_earned_income_credit_amount: 320
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Dependent
period: 2024
input:
is_tax_unit_head_or_spouse: true
pr_earned_income_credit_investment_income: 2_000
output:
pr_earned_income_credit_eligible: false

- name: Investment income over the limit
period: 2024
input:
is_tax_unit_head_or_spouse: false
pr_earned_income_credit_investment_income: 2_201
output:
pr_earned_income_credit_eligible: false

- name: Eligible person
period: 2024
input:
is_tax_unit_head_or_spouse: true
pr_earned_income_credit_investment_income: 2_200
output:
pr_earned_income_credit_eligible: true
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
from policyengine_us.model_api import *

class pr_low_income_credit(Variable):
class pr_earned_income_credit_amount(Variable):
value_type = float
entity = Person
label = "Puerto Rico earned income credit"
label = "Puerto Rico earned income credit amount"
unit = USD
definition_period = YEAR
reference = ""
reference = "https://casetext.com/statute/laws-of-puerto-rico/title-thirteen-taxation-and-finance/subtitle-17-internal-revenue-code-of-2011/part-ii-income-taxes/chapter-1007-credits-against-tax/subchapter-b-refundable-credits/30211-earned-income-credit"
defined_for = "pr_earned_income_credit_eligible"

def formula(tax_unit, period, parameters):
p = parameters(
period
).gov.territories.pr.tax.income.credits.earned_income

# workflow:
# Calculate credit amount pre phase out
# Income * phase_in_rate capped at max_credit
# Calculate the phase_out
# p.phase_out_rate.calc(income)
# Calculate final value
# credit - phase_out
earned_gross_income = 10_000 # PLACEHOLDER for earned gross income, person level
gross_income = person("pr_gross_income_person", period)
# if in the lower bracket: gross_income * rate. if higher, use max credit
phase_in = min(gross_income * p.phase_in_rate, p.max_amount)
phase_out = p.phase_out_rate.calc(gross_income)

# calculate phase in
# what does p.phase_out_amount.threshold return? which threshold?
upper_threshold = p.phase_out_amount.threshold[]
# if gross income > upper threshold, calculate [bottom threshold * phase_in] - [(upper - bottom threshold) * phase_out]
# if gross income > lower threshold, calculate [bottom threshold (i.e. 10k) * phase_in] - [(income - bottom threshold) * phase_out]
# ELSE, calculate income * phase_in_rate


return False
return phase_in - phase_out
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
class pr_earned_income_credit_eligible(Variable):
value_type = bool
entity = Person
label = ""
label = "Eligible person for Puerto Rico earned income credit"
definition_period = YEAR
reference = ""
reference = "https://casetext.com/statute/laws-of-puerto-rico/title-thirteen-taxation-and-finance/subtitle-17-internal-revenue-code-of-2011/part-ii-income-taxes/chapter-1007-credits-against-tax/subchapter-b-refundable-credits/30211-earned-income-credit"

def formula(person, period, parameters):
p = parameters(
period
).gov.territories.pr.tax.income.credits.earned_income
head_or_spouse = person("is_tax_unit_head_or_spouse", period)
adds = "gov.territories.pr.tax.income.credits.earned_income.ineligible_income_categories"
investment_income_amount_allowed = adds < p.max_investment_income
# check that earned income is above 0?
return head_or_spouse & investment_income_amount_allowed
investment_income = person("pr_earned_income_credit_investment_income", period)
investment_income_amount_under_limit = investment_income < p.max_investment_income
return head_or_spouse & investment_income_amount_under_limit
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from policyengine_us.model_api import *

class pr_earned_income_credit_investment_income(Variable):
value_type = float
entity = Person
label = "Puerto Rico earned income credit investment income"
definition_period = YEAR
reference = "https://casetext.com/statute/laws-of-puerto-rico/title-thirteen-taxation-and-finance/subtitle-17-internal-revenue-code-of-2011/part-ii-income-taxes/chapter-1007-credits-against-tax/subchapter-b-refundable-credits/30211-earned-income-credit"

def formula(person, period, parameters):
p = parameters(
period
).gov.territories.pr.tax.income.credits.earned_income
# sum up all defined categories for investment income
adds = "gov.territories.pr.tax.income.credits.earned_income.ineligible_income_categories"
return adds
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from policyengine_us.model_api import *


class pr_gross_income(Variable):
value_type = float
entity = Person
label = "Puerto Rico gross income person level"
unit = USD
definition_period = YEAR
reference = "https://casetext.com/statute/laws-of-puerto-rico/title-thirteen-taxation-and-finance/subtitle-17-internal-revenue-code-of-2011/part-ii-income-taxes/chapter-1005-computation-of-taxable-income/subchapter-a-determination-of-net-income-general-concepts/30101-gross-income"

0 comments on commit 9b54ff2

Please sign in to comment.