Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update KY, MD, and VT parameters, variables, and tests #86

Merged
merged 16 commits into from
Nov 8, 2024
Prev Previous commit
Next Next commit
Updated VT variables
  • Loading branch information
rickecon committed Nov 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 512d426687598aafe43ea2304f5232d9feea39df
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from fiscalsim_us.model_api import *


class vt_csrs_retirement_pay_exclusion(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Vermont Civil Service Retirement System (CSRS) retirement income exclusion"
reference = (
"https://tax.vermont.gov/individuals/seniors-and-retirees",
"https://legislature.vermont.gov/statutes/section/32/151/05830e", # Legal Code Titl. 32 V.S.A. § 5830e (b)(1)(B), (b)(2)(B)
)
unit = USD
defined_for = StateCode.VT
documentation = "Vermont Civil Service Retirement System (CSRS) retirement benefits exempt from Vermont taxation."

def formula(tax_unit, period, parameters):
person = tax_unit.members
p = parameters(
period
).gov.states.vt.tax.income.agi.retirement_income_exemption.csrs
# Get retirement amount from military retirement system
tax_unit_csrs_retirement_pay = add(
tax_unit, period, ["csrs_retirement_pay"]
)
# Retirement income from systems other than social security have maximum amount.
return min_(tax_unit_csrs_retirement_pay, p.amount)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from fiscalsim_us.model_api import *


class vt_military_retirement_pay_exclusion(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Vermont military retirement income exclusion"
reference = (
"https://tax.vermont.gov/individuals/seniors-and-retirees",
"https://legislature.vermont.gov/statutes/section/32/151/05830e", # Legal Code Titl. 32 V.S.A. § 5830e (d)
)
unit = USD
defined_for = StateCode.VT
documentation = (
"Vermont military retirement benefits exempt from Vermont taxation."
)

def formula(tax_unit, period, parameters):
person = tax_unit.members
p = parameters(
period
).gov.states.vt.tax.income.agi.retirement_income_exemption
# Get retirement amount from military retirement system
tax_unit_military_retirement_pay = add(
tax_unit, period, ["military_retirement_pay"]
)
# Retirement income from systems other than social security have maximum amount.
return min_(
tax_unit_military_retirement_pay, p.military_retirement.amount
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
from fiscalsim_us.model_api import *


class vt_retirement_income_exemption(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Vermont retirement income exemption"
reference = (
"https://legislature.vermont.gov/statutes/section/32/151/05811", # Titl. 32 V.S.A. § 5811(21)(B)(iv)
"https://legislature.vermont.gov/statutes/section/32/151/05830e" # Titl. 32 V.S.A. § 5830e
"https://tax.vermont.gov/sites/tax/files/documents/IN-112%20Instr-2022.pdf#page=3", # Instruction for 2022 SCHEDULE IN-112 - RETIREMENT INCOME EXEMPTION WORKSHEET
"https://tax.vermont.gov/individuals/seniors-and-retirees", # Instruction for exemption from different retirement system
)
unit = USD
documentation = "Vermont retirement benefits exempt from Vermont taxation."
defined_for = "vt_retirement_income_exemption_eligible"

def formula(tax_unit, period, parameters):
# Filer can choose from one of Social Security,
# Civil Service Retirement System (CSRS), Military Retirement Income
# or other eligible retirement systems
# to determine eligibility and calculate retirement income exemption.

# Get social security amount
tax_unit_taxable_social_security = tax_unit(
"tax_unit_taxable_social_security", period
)
# Get vt retirement income exclusion from military retirement system
vt_military_retirement_pay_exclusion = tax_unit(
"vt_military_retirement_pay_exclusion", period
)
# Get vt retirement income exclusion from CSRS
vt_csrs_retirement_pay_exclusion = tax_unit(
"vt_csrs_retirement_pay_exclusion", period
)
# Assume that filers will always choose the largest reitrement income
# exclusion from various retirement system
larger_retirement_income = max_(
tax_unit_taxable_social_security,
vt_military_retirement_pay_exclusion,
)
chosen_retirement_income = max_(
larger_retirement_income, vt_csrs_retirement_pay_exclusion
)
filing_status = tax_unit("filing_status", period)
agi = tax_unit("adjusted_gross_income", period)
# Get which retirement system the filer use
use_ss = tax_unit_taxable_social_security == chosen_retirement_income
# Get which parameter file to use
p = parameters(
period
).gov.states.vt.tax.income.agi.retirement_income_exemption
reduction_start = where(
use_ss,
p.social_security.reduction.start[filing_status],
p.csrs.reduction.start[filing_status],
)
reduction_end = where(
use_ss,
p.social_security.reduction.end[filing_status],
p.csrs.reduction.end[filing_status],
)
# List of partial qualified tax unit(SECTION II)
partial_qualified = (
(agi >= reduction_start)
& (agi < reduction_end)
& (chosen_retirement_income != 0)
)
# Calculate the exemption ratio
partial_exemption_ratio = max_(reduction_end - agi, 0) / p.divisor
# Round the exemption ratio to two decimal point
partial_exemption_ratio = round_(partial_exemption_ratio, 2)
# The exemption ratio should be below one
partial_exemption_ratio = min_(partial_exemption_ratio, 1)
# Calculate parital exemption amount
partial_exemption = chosen_retirement_income * partial_exemption_ratio
# Return final exemption amount based on eligibility status
return where(
partial_qualified, partial_exemption, chosen_retirement_income
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from fiscalsim_us.model_api import *


class vt_retirement_income_exemption_eligible(Variable):
value_type = bool
entity = TaxUnit
definition_period = YEAR
label = "Vermont retirement income exemption eligibility status"
reference = (
"https://legislature.vermont.gov/statutes/section/32/151/05811", # Titl. 32 V.S.A. § 5811(21)(B)(iv)
"https://legislature.vermont.gov/statutes/section/32/151/05830e" # Titl. 32 V.S.A. § 5830e
"https://tax.vermont.gov/sites/tax/files/documents/IN-112%20Instr-2022.pdf#page=3", # Instruction for 2022 SCHEDULE IN-112 - RETIREMENT INCOME EXEMPTION WORKSHEET
"https://tax.vermont.gov/individuals/seniors-and-retirees", # Instruction for exemption from different retirement system
)
defined_for = StateCode.VT
documentation = "Vermont filers use below criteria to check whether the tax unit is eligible for vermont retirement income exemption."

def formula(tax_unit, period, parameters):
# Filer can choose from one of Social Security,
# Civil Service Retirement System (CSRS), Military Retirement Income
# or other eligible retirement systems to determine eligibility
filing_status = tax_unit("filing_status", period)
agi = tax_unit("adjusted_gross_income", period)
p = parameters(
period
).gov.states.vt.tax.income.agi.retirement_income_exemption.csrs.reduction
# One of the retirement income should be greater than 0
retirement_income = add(
tax_unit,
period,
[
"tax_unit_taxable_social_security",
"military_retirement_pay",
"csrs_retirement_pay",
],
)
retirement_income_qualified = retirement_income > 0
# The agi should below threshold
agi_qualified = agi < p.end[filing_status]
# Both qualified then the filer is qualified for vermont retirement
# income exemption
return retirement_income_qualified & agi_qualified
Original file line number Diff line number Diff line change
@@ -20,12 +20,18 @@ def formula(tax_unit, period, parameters):
adjusted_net_capital_gain = tax_unit(
"adjusted_net_capital_gain", period
)
qualified_dividend_income = add(
tax_unit, period, ["qualified_dividend_income"]
)
reduced_adjusted_net_capital_gain = max_(
adjusted_net_capital_gain - qualified_dividend_income, 0
)
p = parameters(
period
).gov.states.vt.tax.income.agi.exclusions.capital_gain
# The flat exclusion is the less of a capped amount
# or the actual amount of net adjusted capital gains
flat_exclusion = min_(adjusted_net_capital_gain, p.flat.cap)
flat_exclusion = min_(reduced_adjusted_net_capital_gain, p.flat.cap)
# Get percentage exclusion
percentage_exclusion = tax_unit(
"vt_percentage_capital_gains_exclusion", period
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ class vt_percentage_capital_gains_exclusion(Variable):
entity = TaxUnit
label = "Vermont percentage capital gains exclusion"
unit = USD
documentation = "This can be selected to be subtracted from federal adjusted gross income in Vermont as percentage captial gains exclusion."
documentation = "This can be selected to be subtracted from federal adjusted gross income in Vermont as percentage capital gains exclusion."
definition_period = YEAR
defined_for = StateCode.VT
reference = (
@@ -20,10 +20,18 @@ def formula(tax_unit, period, parameters):
adjusted_net_capital_gain = tax_unit(
"adjusted_net_capital_gain", period
)
qualified_dividend_income = add(
tax_unit, period, ["qualified_dividend_income"]
)
reduced_adjusted_net_capital_gain = max_(
adjusted_net_capital_gain - qualified_dividend_income, 0
)
p = parameters(
period
).gov.states.vt.tax.income.agi.exclusions.capital_gain
# The percentage exclusion equals to a percentage of
# the adjusted net capital gain and has a maximum value
percentage_exclusion = adjusted_net_capital_gain * p.percentage.rate
percentage_exclusion = (
reduced_adjusted_net_capital_gain * p.percentage.rate
)
return min_(percentage_exclusion, p.percentage.cap)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fiscalsim_us.model_api import *


class vt_agi_additions(Variable):
class vt_additions(Variable):
value_type = float
entity = TaxUnit
label = "Vermont AGI additions"
Original file line number Diff line number Diff line change
@@ -10,5 +10,5 @@ class vt_agi(Variable):
defined_for = StateCode.VT
reference = "https://tax.vermont.gov/sites/tax/files/documents/IN-111-2022.pdf (Line 3)"

adds = ["adjusted_gross_income", "vt_agi_additions"]
adds = ["adjusted_gross_income", "vt_additions"]
subtracts = ["vt_subtractions"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from fiscalsim_us.model_api import *


class vt_cdcc(Variable):
value_type = float
entity = TaxUnit
label = "Vermont child care and dependent care credit"
unit = USD
definition_period = YEAR
reference = (
"https://tax.vermont.gov/sites/tax/files/documents/IN-112-2022.pdf#page=2"
"https://law.justia.com/codes/vermont/2022/title-32/chapter-151/section-5828c/"
"https://www.irs.gov/pub/irs-prior/f2441--2022.pdf#page=1"
)
defined_for = StateCode.VT

def formula(tax_unit, period, parameters):
p = parameters(period).gov.states.vt.tax.income.credits.cdcc
# The form refers to 2022 Form 2441 line 11, which caps the credit at tax liability.
federal_cdcc = tax_unit("capped_cdcc", period)
return federal_cdcc * p.rate
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from fiscalsim_us.model_api import *


class vt_low_income_cdcc(Variable):
value_type = float
entity = TaxUnit
label = "Vermont low-income child care and dependent care credit"
unit = USD
definition_period = YEAR
reference = (
"https://tax.vermont.gov/sites/tax/files/documents/IN-112-2021.pdf#page=2"
"https://law.justia.com/codes/vermont/2021/title-32/chapter-151/section-5828c/"
)
defined_for = "vt_low_income_cdcc_eligible"

def formula(tax_unit, period, parameters):
p = parameters(period).gov.states.vt.tax.income.credits.cdcc.low_income
federal_cdcc = tax_unit("capped_cdcc", period)
return p.rate * federal_cdcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from fiscalsim_us.model_api import *


class vt_low_income_cdcc_eligible(Variable):
value_type = bool
entity = TaxUnit
label = "Eligible for the Vermont low-income child care and dependent care credit"
definition_period = YEAR
reference = (
"https://tax.vermont.gov/sites/tax/files/documents/IN-112-2021.pdf#page=2"
"https://law.justia.com/codes/vermont/2021/title-32/chapter-151/section-5828c/"
)
defined_for = StateCode.VT

def formula(tax_unit, period, parameters):
p = parameters(period).gov.states.vt.tax.income.credits.cdcc.low_income
filing_status = tax_unit("filing_status", period)
federal_agi_threshold = p.income_threshold[filing_status]
federal_agi = tax_unit("adjusted_gross_income", period)
# Law says "less than" but tax form says "$x or less". We apply form rules.
return federal_agi <= federal_agi_threshold
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from fiscalsim_us.model_api import *


class vt_ctc(Variable):
value_type = float
entity = TaxUnit
label = "Vermont child tax credit"
definition_period = YEAR
unit = USD
reference = "https://casetext.com/statute/vermont-statutes/title-32-taxation-and-finance/chapter-151-income-taxes/subchapter-002-taxation-of-individuals-trusts-and-estates/section-5830f-see-note-vermont-child-tax-credit/1"
defined_for = StateCode.VT

def formula(tax_unit, period, parameters):
# Get age status of all people in the tax unit.
person = tax_unit.members
age = person("age", period)
p = parameters(period).gov.states.vt.tax.income.credits.ctc
eligible = age <= p.age_limit
count_eligible = tax_unit.sum(eligible)
# Get maximum credit amount.
max_credit = p.amount * count_eligible
# Get adjusted gross income.
agi = tax_unit("adjusted_gross_income", period)
# Reduce credit amount over the phaseout range.
excess_agi = max_(agi - p.reduction.start, 0)
increments = np.ceil(excess_agi / p.reduction.increment)
total_reduction = p.reduction.amount * increments
# Return reduced credit amount.
return max_(max_credit - total_reduction, 0)
Loading