Skip to content

Commit

Permalink
Merge pull request #2680 from PSLmodels/master
Browse files Browse the repository at this point in the history
Sync v4 branch with master
  • Loading branch information
jdebacker authored May 3, 2023
2 parents c6420c1 + 1a0ac7a commit 01ebe83
Show file tree
Hide file tree
Showing 26 changed files with 1,163 additions and 736 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
pytest -m 'not requires_pufcsv and not pre_release and not local' --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
file: ./coverage.xml
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Tax-Calculator
Tax-Calculator is an open-source microsimulation model for static
analysis of USA federal income and payroll taxes.

We are seeking contributors and maintainers. If you are interested in joining the project as a contributor or maintainer,
contact [email protected] or jump right in.
We are seeking contributors and maintainers. If you are interested in joining the project as a contributor or maintainer,
open a new [issue](https://github.com/PSLmodels/Tax-Calculator/issues) and ping @MattHJensen or @jdebacker -- or just jump right in.

Complete documentation is available
[here](https://PSLmodels.github.io/Tax-Calculator/).
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'description': 'taxcalc',
'long_description': longdesc,
'version': version,
'license': 'CC0 1.0 Universal public domain dedication',
'license': 'CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
'packages': ['taxcalc', 'taxcalc.cli'],
'include_package_data': True,
'name': 'taxcalc',
Expand All @@ -21,7 +21,7 @@
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: CC0 1.0 Universal public domain dedication',
'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
Expand Down
8 changes: 4 additions & 4 deletions taxcalc.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Version: 3.3.0
Summary: taxcalc
Home-page: https://github.com/PSLmodels/Tax-Calculator
Download-URL: https://github.com/PSLmodels/Tax-Calculator
License: CC0 1.0 Universal public domain dedication
License: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: CC0 1.0 Universal public domain dedication
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Expand All @@ -29,8 +29,8 @@ Tax-Calculator
Tax-Calculator is an open-source microsimulation model for static
analysis of USA federal income and payroll taxes.

We are seeking contributors and maintainers. If you are interested in joining the project as a contributor or maintainer,
contact [email protected] or jump right in.
We are seeking contributors and maintainers. If you are interested in joining the project as a contributor or maintainer,
open a new [issue](https://github.com/PSLmodels/Tax-Calculator/issues) and ping @MattHJensen or @jdebacker -- or just jump right in.

Complete documentation is available
[here](https://PSLmodels.github.io/Tax-Calculator/).
62 changes: 36 additions & 26 deletions taxcalc/calcfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def UBI(nu18, n1820, n21, UBI_u18, UBI_1820, UBI_21, UBI_ecrt,
@iterate_jit(nopython=True)
def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
II_em, II_em_ps, II_prt, II_no_em_nu18,
c00100, pre_c04600, c04600):
e02300, UI_thd, UI_em, c00100, pre_c04600, c04600):
"""
Computes Adjusted Gross Income (AGI), c00100, and
compute personal exemption amount, c04600.
Expand Down Expand Up @@ -699,12 +699,19 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
Personal exemption phaseout rate
II_no_em_nu18: float
Repeal personal exemptions for dependents under age 18
e02300: float
Unemployment compensation
UI_thd: list
AGI threshold for unemployment compensation exclusion
UI_em: float
Amount of unemployment compensation excluded from AGI
c00100: float
Adjusted Gross Income (AGI)
pre_c04600: float
Personal exemption before phase-out
c04600: float
Personal exemptions after phase-out
Returns
-------
c00100: float
Expand All @@ -716,6 +723,12 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
"""
# calculate AGI assuming no foreign earned income exclusion
c00100 = ymod1 + c02500 - c02900 + taxable_ubi
# calculate UI exclusion (e.g., from 2020 AGI due to ARPA)
if (c00100 - e02300) <= UI_thd[MARS - 1]:
ui_excluded = min(e02300, UI_em)
else:
ui_excluded = 0.
c00100 -= ui_excluded
# calculate personal exemption amount
if II_no_em_nu18: # repeal of personal exemptions for deps. under 18
pre_c04600 = max(0, XTOT - nu18) * II_em
Expand Down Expand Up @@ -1183,12 +1196,11 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,

@iterate_jit(nopython=True)
def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, e26270,
e02100, e27200, e00650, c01000, e02300, PT_SSTB_income,
e02100, e27200, e00650, c01000, PT_SSTB_income,
PT_binc_w2_wages, PT_ubia_property, PT_qbid_rt,
PT_qbid_taxinc_thd, PT_qbid_taxinc_gap, PT_qbid_w2_wages_rt,
PT_qbid_alt_w2_wages_rt, PT_qbid_alt_property_rt, c04800,
PT_qbid_ps, PT_qbid_prt, qbided, PT_qbid_limit_switch,
UI_em, UI_thd):
PT_qbid_ps, PT_qbid_prt, qbided, PT_qbid_limit_switch):
"""
Calculates taxable income, c04800, and
qualified business income deduction, qbided.
Expand Down Expand Up @@ -1254,14 +1266,8 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, e26270,
qbided: float
Qualified Business Income (QBI) deduction
"""
# calculate UI excluded from taxable income
if (c00100 - e02300) <= UI_thd[MARS - 1]:
ui_excluded = min(e02300, UI_em)
else:
ui_excluded = 0.
# calculate taxable income before qualified business income deduction
pre_qbid_taxinc = max(0., c00100 - max(c04470, standard) - c04600 -
ui_excluded)
pre_qbid_taxinc = max(0., c00100 - max(c04470, standard) - c04600)
# calculate qualified business income deduction
qbided = 0.
qbinc = max(0., e00900 + e26270 + e02100 + e27200)
Expand Down Expand Up @@ -2209,26 +2215,27 @@ def EITCamount(basic_frac, phasein_rate, earnings, max_amount,
Parameters
----------
basic_frac: list
basic_frac: float
Fraction of maximum earned income credit paid at zero earnings
phasein_rate: list
phasein_rate: float
Earned income credit phasein rate
earnings: float
Earned income for filing unit
max_amount: list
max_amount: float
Maximum earned income credit
phaseout_start: list
phaseout_start: float
Earned income credit phaseout start AGI
agi: float
Adjusted Gross Income (AGI)
phaseout_rate: list
phaseout_rate: float
Earned income credit phaseout rate
Returns
-------
eitc: float
Earned Income Credit
"""
# calculate qualified business income de
eitc = min((basic_frac * max_amount +
(1.0 - basic_frac) * phasein_rate * earnings), max_amount)
if earnings > phaseout_start or agi > phaseout_start:
Expand All @@ -2244,8 +2251,7 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000,
EITC_ps, EITC_MinEligAge, EITC_MaxEligAge, EITC_ps_MarriedJ,
EITC_rt, EITC_c, EITC_prt, EITC_basic_frac,
EITC_InvestIncome_c, EITC_excess_InvestIncome_rt,
EITC_indiv, EITC_sep_filers_elig,
c59660):
EITC_indiv, EITC_sep_filers_elig, c59660):
"""
Computes EITC amount, c59660.
Expand Down Expand Up @@ -2521,7 +2527,7 @@ def ChildDepTaxCredit(age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num,
line15 = max(0., line13 - line14)
if CTC_refundable:
c07220 = line10 * line1 / line3
odc = min(max(0., line10 - c07220), line15)
odc = max(0., line10 - c07220)
codtc_limited = max(0., line10 - c07220 - odc)
else:
line16 = min(line10, line15) # credit is capped by tax liability
Expand Down Expand Up @@ -3000,9 +3006,9 @@ def NonrefundableCredits(c05800, e07240, e07260, e07300, e07400,
if not CTC_refundable:
c07220 = min(c07220, avail)
avail = avail - c07220
# Other dependent credit
odc = min(odc, avail)
avail = avail - odc
# Other dependent credit
odc = min(odc, avail)
avail = avail - odc
# Residential energy credit - Form 5695
c07260 = min(e07260 * (1. - CR_ResidentialEnergy_hc), avail)
avail = avail - c07260
Expand Down Expand Up @@ -3031,7 +3037,7 @@ def NonrefundableCredits(c05800, e07240, e07260, e07300, e07400,
@iterate_jit(nopython=True)
def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd,
ACTC_rt, nu06, ACTC_rt_bonus_under6family, ACTC_ChildNum,
CTC_refundable, CTC_include17, XTOT, n21, n1820, num,
CTC_refundable, CTC_include17, age_head, age_spouse, MARS, nu18,
ptax_was, c03260, e09800, c59660, e11200,
c11070):
"""
Expand Down Expand Up @@ -3083,7 +3089,9 @@ def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd,
line4 = 0.
else:
if CTC_include17:
childnum = n24 + max(0, XTOT - n21 - n1820 - n24 - num)
tu18 = int(age_head < 18) # taxpayer is under age 18
su18 = int(MARS == 2 and age_spouse < 18) # spouse is under age 18
childnum = n24 + max(0, nu18 - tu18 - su18 - n24)
else:
childnum = n24
line4 = ACTC_c * childnum
Expand Down Expand Up @@ -3195,7 +3203,7 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
CTC_new_ps, CTC_new_prt, CTC_new_for_all, CTC_include17,
CTC_new_refund_limited, CTC_new_refund_limit_payroll_rt,
CTC_new_refund_limited_all_payroll, payrolltax,
n24, nu06, XTOT, n21, n1820, num, c00100, MARS, ptax_oasdi,
n24, nu06, age_head, age_spouse, nu18, c00100, MARS, ptax_oasdi,
c09200, ctc_new):
"""
Computes new refundable child tax credit using specified parameters.
Expand Down Expand Up @@ -3244,7 +3252,9 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
New refundable child tax credit
"""
if CTC_include17:
childnum = n24 + max(0, XTOT - n21 - n1820 - n24 - num)
tu18 = int(age_head < 18) # taxpayer is under age 18
su18 = int(MARS == 2 and age_spouse < 18) # spouse is under age 18
childnum = n24 + max(0, nu18 - tu18 - su18 - n24)
else:
childnum = n24
if childnum > 0:
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/consumption.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"validators": {
"range": {
"min": 2013,
"max": 2031
"max": 2032
}
}
},
Expand Down
Binary file modified taxcalc/cps_weights.csv.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion taxcalc/growdiff.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"validators": {
"range": {
"min": 2013,
"max": 2031
"max": 2032
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/growdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class instance: GrowDiff
"""

JSON_START_YEAR = 2013 # must be same as Policy.JSON_START_YEAR
DEFAULT_NUM_YEARS = 19 # must be same as Policy.DEFAULT_NUM_YEARS
DEFAULT_NUM_YEARS = 20 # must be same as Policy.DEFAULT_NUM_YEARS
DEFAULTS_FILE_NAME = 'growdiff.json'
DEFAULTS_FILE_PATH = os.path.abspath(os.path.dirname(__file__))

Expand Down
Loading

0 comments on commit 01ebe83

Please sign in to comment.