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

Employer side Payroll Tax Offset function #2674

Closed
wants to merge 75 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
1ecd79f
add test of TaxInc function
jdebacker Aug 18, 2021
e5a4d4b
update comment
jdebacker Aug 23, 2021
5e24a60
fix test taxable income amount to reflect 0 QBID
jdebacker Aug 25, 2021
c8c3f1f
Update test benchmark 2022-03-29
invalid-email-address Mar 29, 2022
dd5e3a0
Merge remote-tracking branch 'upstream/master' into qbided_test
jdebacker May 26, 2022
aae32e5
update benchmark stats
jdebacker Dec 17, 2022
a7094e1
update license description text to be consistent with new PyPI language
jdebacker Dec 17, 2022
ab95997
update instructions for inquries
jdebacker Dec 17, 2022
7b63d2a
sync latesets benchmark
jdebacker Dec 17, 2022
9dc0583
update other license statement
jdebacker Dec 17, 2022
2b2ba81
update pkg info
jdebacker Dec 17, 2022
cb3cb41
update benchmark stats
jdebacker Jan 19, 2023
85c832a
Update test benchmark 2023-01-19
invalid-email-address Jan 19, 2023
830ce0f
fix max eitc 2022, 2kids val
jdebacker Jan 25, 2023
1c61264
Merge pull request #2668 from jdebacker/pypi3.0
jdebacker Jan 25, 2023
54eeb86
Merge remote-tracking branch 'upstream/master' into eitc_fix
jdebacker Jan 25, 2023
d7f1643
Merge remote-tracking branch 'origin' into eitc_fix
jdebacker Jan 25, 2023
49c6c3f
Update test benchmark 2023-01-25
invalid-email-address Jan 25, 2023
d585b37
update eitc value in rounding json file
jdebacker Jan 26, 2023
e505e3b
update stats
jdebacker Jan 26, 2023
6ba7147
update cached files for param change
jdebacker Jan 26, 2023
dff99a1
update codecov version
jdebacker Jan 31, 2023
d1c144b
merge
Feb 10, 2023
d3e9799
initial commit of offset script
Feb 17, 2023
9888579
update puf expected for 2022 puf file
jdebacker Mar 1, 2023
f793601
compare values per new pandas
jdebacker Mar 1, 2023
9cc55f8
update EITC calculation for modified AGI following ARPA
jdebacker Mar 6, 2023
67af827
Merge branch 'master' into ui_eitc_fix
jdebacker Mar 8, 2023
6662867
Merge pull request #2673 from jdebacker/eitc_fix
jdebacker Mar 8, 2023
b1de7fa
Update test benchmark 2023-03-08
invalid-email-address Mar 8, 2023
8f81281
update object type in EITCamount
jdebacker Mar 8, 2023
e1c52f5
add unit test of EITCamount
jdebacker Mar 8, 2023
20b5197
add unit test of EITC function
jdebacker Mar 8, 2023
ec2af11
Merge branch 'ui_eitc_fix' of https://github.com/jdebacker/tax-calcul…
jdebacker Mar 8, 2023
d0acbaa
update benchmark stats
jdebacker Mar 8, 2023
049e37e
Merge pull request #2618 from jdebacker/qbided_test
jdebacker Mar 8, 2023
252ec1c
Update test benchmark 2023-03-08
invalid-email-address Mar 8, 2023
1b27b1c
update expected agg results
jdebacker Mar 8, 2023
bc7c9bc
fix conflicts
jdebacker Mar 9, 2023
f9bee79
add tests of CTC func
jdebacker Mar 9, 2023
225affa
update entry points
jdebacker Mar 9, 2023
169e3f8
move UI exclusion to AGI func
jdebacker Mar 9, 2023
bef3286
update tests of EITC, TaxInc
jdebacker Mar 9, 2023
89e222f
remove ui exclude from taxinc
jdebacker Mar 9, 2023
feea12a
change agi for eitc test
jdebacker Mar 9, 2023
f780184
write test of agi function
jdebacker Mar 9, 2023
6b2c8e9
update expected files
jdebacker Mar 9, 2023
4c85758
Merge pull request #2675 from jdebacker/ui_eitc_fix
jdebacker Mar 13, 2023
3fb66e3
Update test benchmark 2023-03-13
invalid-email-address Mar 13, 2023
44f0ffd
sync w master
jdebacker Mar 15, 2023
4acf220
merge update
Mar 16, 2023
4589cba
update budget years
Mar 17, 2023
1b530b9
restore changes
Mar 17, 2023
939b4dc
update budget year
Mar 17, 2023
6a81f40
update files from taxdata
Mar 17, 2023
236e2af
generate parameter changes by running ppp.py
Mar 17, 2023
ff1c0cc
update year in policy current law
Mar 21, 2023
2324fe4
update to pass the test
Mar 22, 2023
6e74df4
fix odc and ctc in 2021
MattHJensen Mar 22, 2023
4f04a30
restore package info
Mar 27, 2023
0168d27
revert the incorrect changes of package info
bodiyang Mar 27, 2023
3573f09
Merge branch 'CBO-feb-2023' of github.com:bodiyang/Tax-Calculator int…
Mar 27, 2023
f2262cd
Delete cpscsv_agg_actual.csv
MattHJensen Mar 28, 2023
fea471b
add 2022 tests
MattHJensen Mar 29, 2023
d51a1e9
Merge pull request #2677 from MattHJensen/ctc_odc_fix
jdebacker Mar 30, 2023
98a290b
Update test benchmark 2023-03-30
invalid-email-address Mar 30, 2023
d5da0de
update test stat benchmark file from PSL repo to avoid testing failure
Apr 3, 2023
4858fef
Merge branch 'master' into CBO-feb-2023
bodiyang Apr 3, 2023
6bdf93c
solve merge conflict
Apr 3, 2023
3cdac3a
update testing expect files from merge
Apr 3, 2023
f407cb5
replace deprecated pandas append() method
Apr 12, 2023
fc8dd25
Merge pull request #2676 from bodiyang/CBO-feb-2023
jdebacker Apr 14, 2023
1a0ac7a
Update test benchmark 2023-04-14
invalid-email-address Apr 14, 2023
827d015
Merge pull request #20 from PSLmodels/master
bodiyang Apr 27, 2023
9fb85b0
Delete taxcalc/payrolloffset.py
bodiyang Feb 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -2200,26 +2206,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 @@ -2235,8 +2242,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 @@ -2512,7 +2518,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 @@ -2991,9 +2997,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 @@ -3022,7 +3028,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 @@ -3074,7 +3080,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 @@ -3186,7 +3194,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 @@ -3235,7 +3243,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
Loading