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

Clarify the three components of the _payrolltax total #909

Merged
merged 8 commits into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions taxcalc/comparison/reform_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Tax-Calculator,80.4,87.7,94.5,101.3
Tax Expenditure,75,82,88,93
""
Both real estate and state and local
Tax-Calculator,99.3,105.6,111.4,117.6
Tax-Calculator,99.3,105.6,111.4,117.5
Tax Expenditure,75,82,88,93
""
State & Local
Expand All @@ -93,7 +93,7 @@ Tax-Calculator,0.4,0.5,0.5,0.5
Tax Expenditure,0,0,0,0
""
Charitable
Tax-Calculator,43.2,45.8,48.2,50.9
Tax-Calculator,43.2,45.7,48.2,50.9
Tax Expenditure,46,47,48,50
""
Decrease AGI floor for miscellaneous expenses by 1 pts
Expand Down Expand Up @@ -124,7 +124,7 @@ Budget Options,5,5,5,6
REGULAR TAXES
""
Increase each bracket rate by 1%
Tax-Calculator,56.3,58.8,61.5,64.0
Tax-Calculator,56.2,58.7,61.5,64.0
Budget Options,56,60,65,69
""
Increase top 4 rates by 1%
Expand Down Expand Up @@ -166,7 +166,7 @@ Tax-Calculator,-0.4,-0.5,-0.5,-0.5
NONREFUNDABLE CREDIT
""
Total expenditure from child tax credit
Tax-Calculator,51.6,51.2,50.8,50.2
Tax-Calculator,51.5,51.1,50.7,50.1
Tax Expenditure,57,57,57,57
""
Increase Child Tax Credit phaseout rate by 1 pts
Expand Down
100 changes: 49 additions & 51 deletions taxcalc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def EI_PayrollTax(SS_Earnings_c, e00200, e00200p, e00200s,
FICA_ss_trt, FICA_mc_trt,
e00900p, e00900s, e02100p, e02100s,
_payrolltax, _ptax_was, c03260, c09400,
_payrolltax, ptax_was, ptax_sey, c03260,
_sey, _earned, _earned_p, _earned_s):
"""
EI_PayrollTax function: computes total earned income and some part of
Expand Down Expand Up @@ -52,17 +52,15 @@ def EI_PayrollTax(SS_Earnings_c, e00200, e00200p, e00200s,
ptax_mc_sey_p = FICA_mc_trt * max(0., sey_p * sey_frac)
ptax_mc_sey_s = FICA_mc_trt * max(0., sey_s * sey_frac)

# compute total regular payroll taxes for filing unit
ptax_ss = ptax_ss_was_p + ptax_ss_was_s + ptax_ss_sey_p + ptax_ss_sey_s
ptax_mc = ptax_mc_was_p + ptax_mc_was_s + ptax_mc_sey_p + ptax_mc_sey_s
_payrolltax = ptax_ss + ptax_mc
# compute regular payroll taxes on wage-and-salary and on sey earnings
ptax_was = ptax_ss_was_p + ptax_ss_was_s + ptax_mc_was_p + ptax_mc_was_s
ptax_sey = ptax_ss_sey_p + ptax_ss_sey_s + ptax_mc_sey_p + ptax_mc_sey_s

# compute regular payroll taxes on wage-and-salary income
_ptax_was = ptax_ss_was_p + ptax_ss_was_s + ptax_mc_was_p + ptax_mc_was_s
# compute total regular payroll taxes for filing unit
_payrolltax = ptax_was + ptax_sey

# compute AGI deduction for "employer share" of self-employment FICA taxes
c09400 = ptax_ss_sey_p + ptax_ss_sey_s + ptax_mc_sey_p + ptax_mc_sey_s
c03260 = 0.5 * c09400 # half of c09400 represents the "employer share"
# compute AGI deduction for "employer share" of self-employment taxes
c03260 = 0.5 * ptax_sey # half of ptax_sey represents the "employer share"

# compute _earned and its individual components
_earned = max(0., e00200 + _sey - c03260)
Expand All @@ -71,7 +69,7 @@ def EI_PayrollTax(SS_Earnings_c, e00200, e00200p, e00200s,
_earned_s = max(0., e00200s + sey_s -
0.5 * (ptax_ss_sey_s + ptax_mc_sey_s))

return (_sey, _payrolltax, _ptax_was, c09400, c03260,
return (_sey, _payrolltax, ptax_was, ptax_sey, c03260,
_earned, _earned_p, _earned_s)


Expand Down Expand Up @@ -327,17 +325,19 @@ def ItemDed(_posagi, e17500, e18400, e18500,


@iterate_jit(nopython=True)
def AdditionalMedicareTax(e00200, MARS, AMED_thd, _sey, AMED_trt,
FICA_mc_trt, FICA_ss_trt, _payrolltax):
def AdditionalMedicareTax(e00200, MARS,
AMED_thd, _sey, AMED_trt,
FICA_mc_trt, FICA_ss_trt,
ptax_amc, _payrolltax):
"""
AMED function: computes additional Medicare Tax as a part of payroll taxes

Notes
-----
Tax Law Parameters:
AMED_thd : Additional medicare threshold
AMED_thd : Additional Medicare Tax earnings threshold

AMED_trt : Additional medicare tax rate
AMED_trt : Additional Medicare Tax rate

FICA_ss_trt : FICA Social Security tax rate

Expand All @@ -350,16 +350,17 @@ def AdditionalMedicareTax(e00200, MARS, AMED_thd, _sey, AMED_trt,

Returns
-------
_payrolltax : payroll tax augmented by Additional Medicare Tax, amed
ptax_amc : Additional Medicare Tax

_payrolltax : payroll tax augmented by Additional Medicare Tax
"""
# ratio of income subject to AMED tax = (1 - 0.5*(FICA_mc_trt+FICA_ss_trt)
amed = AMED_trt * (max(0., e00200 - AMED_thd[MARS - 1]) +
max(0., max(0., _sey) *
(1. - 0.5 * (FICA_mc_trt + FICA_ss_trt)) -
max(0., AMED_thd[MARS - 1] - e00200)))
_payrolltax = _payrolltax + amed
return _payrolltax
ptax_amc = AMED_trt * (max(0., e00200 - AMED_thd[MARS - 1]) +
max(0., max(0., _sey) *
(1. - 0.5 * (FICA_mc_trt + FICA_ss_trt)) -
max(0., AMED_thd[MARS - 1] - e00200)))
_payrolltax = _payrolltax + ptax_amc
return (ptax_amc, _payrolltax)


@iterate_jit(nopython=True)
Expand Down Expand Up @@ -796,18 +797,18 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000,

@iterate_jit(nopython=True)
def ChildTaxCredit(n24, MARS, c00100, _feided, _exact,
CTC_c, CTC_ps, CTC_prt, pre_ctc):
CTC_c, CTC_ps, CTC_prt, prectc):
"""
ChildTaxCredit function computes pre_ctc amount
ChildTaxCredit function computes prectc amount
"""
pre_ctc = CTC_c * n24
prectc = CTC_c * n24
ctc_agi = c00100 + _feided
if ctc_agi > CTC_ps[MARS - 1]:
excess = ctc_agi - CTC_ps[MARS - 1]
if _exact == 1:
excess = 1000. * math.ceil(excess / 1000.)
pre_ctc = max(0., pre_ctc - CTC_prt * excess)
return pre_ctc
prectc = max(0., prectc - CTC_prt * excess)
return prectc


@iterate_jit(nopython=True)
Expand Down Expand Up @@ -1016,36 +1017,33 @@ def EducationTaxCredit(c87550, MARS, c00100, _num, c05800,
@iterate_jit(nopython=True)
def NonrefundableCredits(c05800, e07240, e07260, e07300, e07600,
c07180, c07200, c07220, c07230, c07240,
pre_ctc, c07300, c07600, _avail):
prectc, c07300, c07600, _avail):
"""
NonRefundableCredits function serially applies credits to tax liability
"""
# reduce nonrefundable child tax credit, c07220
c07220 = min(pre_ctc, max(0., c05800 - (c07180 + c07200 + c07230 +
e07240 + e07260 + e07300)))
# apply tax credits to tax liability in order on tax form
# apply tax credits to tax liability in order they are on 2015 1040 form
_avail = c05800
c07180 = min(c07180, _avail) # child & dependent care expense credit
_avail = _avail - c07180
c07200 = min(c07200, _avail) # Schedule R credit
_avail = _avail - c07200
c07300 = min(e07300, _avail) # Foreign tax credit - Form 1116
_avail = _avail - c07300
c07180 = min(c07180, _avail) # Child & dependent care expense credit
_avail = _avail - c07180
c07230 = min(c07230, _avail) # Education tax credit
_avail = _avail - c07230
c07240 = min(e07240, _avail) # Retirement savings contribution credit
c07240 = min(e07240, _avail) # Retirement savings credit - Form 8880
_avail = _avail - c07240
c07260 = min(e07260, _avail) # Residential energy credit
c07220 = min(prectc, _avail) # Child tax credit
_avail = _avail - c07220
c07260 = min(e07260, _avail) # Residential energy credit - Form 5695
_avail = _avail - c07260
c07600 = min(e07600, _avail) # Prior year minimum tax credit
c07600 = min(e07600, _avail) # Prior year minimum tax credit - Form 8801
_avail = _avail - c07600
c07220 = min(c07220, _avail) # Nonrefundable child tax credit
_avail = _avail - c07220
c07200 = min(c07200, _avail) # Schedule R credit
_avail = _avail - c07200
return (c07220, c07230, c07240, c07300, c07600, _avail)


@iterate_jit(nopython=True)
def AdditionalCTC(n24, pre_ctc, _earned, c07220, _ptax_was,
def AdditionalCTC(n24, prectc, _earned, c07220, ptax_was,
ACTC_Income_thd, ACTC_rt, ACTC_ChildNum,
ALD_SelfEmploymentTax_HC,
c03260, e09800, c59660, e11200, c11070):
Expand All @@ -1066,24 +1064,24 @@ def AdditionalCTC(n24, pre_ctc, _earned, c07220, _ptax_was,
c82937 = 0.
c82940 = 0.
c11070 = 0.
# Part I of 2005 form 8812
# Part I of 2005 Form 8812
if n24 > 0:
c82925 = pre_ctc
c82925 = prectc
c82930 = c07220
c82935 = c82925 - c82930
# CTC not applied to tax
c82880 = max(0., _earned)
c82885 = max(0., c82880 - ACTC_Income_thd)
c82890 = ACTC_rt * c82885
# Part II of 2005 form 8812
# Part II of 2005 Form 8812
if n24 >= ACTC_ChildNum and c82890 < c82935:
c82900 = 0.5 * _ptax_was
c82900 = 0.5 * ptax_was
c82905 = (1. - ALD_SelfEmploymentTax_HC) * c03260 + e09800
c82910 = c82900 + c82905
c82915 = c59660 + e11200
c82920 = max(0., c82910 - c82915)
c82937 = max(c82890, c82920)
# Part II of 2005 form 8812
# Part II of 2005 Form 8812
if n24 > 0 and n24 <= 2 and c82890 > 0:
c82940 = min(c82890, c82935)
if n24 > 2:
Expand All @@ -1106,7 +1104,7 @@ def F5405(e11580, c11580):

@iterate_jit(nopython=True)
def C1040(e07400, c07200, c07220, c07230, c07300, c07240,
e07260, c07600, p08000, c05800, e09900, c09400, e09800,
e07260, c07600, p08000, c05800, e09900, ptax_sey, e09800,
e09700, c07180, NIIT, _othertax, c07100, c09200):
"""
C1040 function: ...
Expand All @@ -1118,7 +1116,7 @@ def C1040(e07400, c07200, c07220, c07230, c07300, c07240,
# Tax After credits 1040 line 52
c08795 = max(0., c05800 - c07100)
# Tax before refundable credits
_othertax = e09900 + c09400 + e09800 + NIIT
_othertax = e09900 + ptax_sey + e09800 + NIIT
c09200 = _othertax + c08795
c09200 += e09700 # assuming year tax year is after 2009
return (c07100, c09200, _othertax)
Expand Down Expand Up @@ -1184,14 +1182,14 @@ def Taxer_i(inc_in, MARS,


@iterate_jit(nopython=True)
def ExpandIncome(_ptax_was, e02400, c02500, c00100, e00400, _expanded_income):
def ExpandIncome(ptax_was, e02400, c02500, c00100, e00400, _expanded_income):
"""
ExpandIncome function: calculates and returns _expanded_income.

Note: if behavioral responses to a policy reform are specified, then be
sure this function is called after the behavioral responses are calculated.
"""
employer_share = 0.5 * _ptax_was # share of payroll tax on wages & salary
employer_share = 0.5 * ptax_was # share of payroll tax on wages & salary
non_taxable_ss_benefits = e02400 - c02500
_expanded_income = (c00100 + # adjusted gross income
e00400 + # non-taxable interest income
Expand Down
6 changes: 3 additions & 3 deletions taxcalc/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ class instance: Records
'c01000', 'c02500',
'c11580',
'_sey', '_earned', '_earned_p', '_earned_s',
'c09400', '_feided', 'ymod', 'ymod1', '_posagi',
'_feided', 'ymod', 'ymod1', '_posagi',
'_xyztax', '_avail',
'_taxinc', 'c04800', '_feitax',
'_taxbc', '_standard', 'c24516', 'c24517', 'c24520',
'c05700', 'c32880', 'c32890', 'c32800',
'c05800',
'c87521', 'c87550', 'c07180',
'c07230', 'pre_ctc', 'c07220', 'c59660',
'c07230', 'prectc', 'c07220', 'c59660',
'c09200', 'c07100', '_eitc',
'_prexmp',
'_payrolltax', '_ptax_was', 'c03260',
'_payrolltax', 'ptax_was', 'ptax_sey', 'c03260', 'ptax_amc',
'_sep', '_num',
'c04500', 'c05200',
'c62100',
Expand Down
6 changes: 3 additions & 3 deletions taxcalc/tests/pufcsv_agg_expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ AMT income ($b) 8,571.7 9,081.5 9,428.1 9,814.9 10,233.6 10,6
AMT amount ($b) 31.3 32.9 34.6 36.8 38.9 41.1 43.3 45.7 48.2 51.1
AMT number (#m) 4.2 4.4 4.6 4.9 5.1 5.2 5.4 5.6 5.7 5.9
Tax before credits ($b) 1,338.3 1,437.1 1,491.2 1,562.6 1,639.5 1,705.5 1,765.8 1,831.4 1,908.5 1,992.9
refundable credits ($b) 111.5 112.5 113.9 113.6 114.5 116.0 117.6 119.3 120.9 122.5
refundable credits ($b) 111.4 112.4 113.8 113.5 114.4 116.0 117.5 119.3 120.8 122.5
nonrefundable credits ($b) 71.6 71.7 72.1 72.7 74.1 74.9 75.3 76.2 77.1 78.0
Misc. Surtax ($b) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Ind inc tax ($b) 1,226.1 1,331.0 1,384.7 1,458.5 1,536.2 1,602.5 1,663.2 1,729.2 1,807.3 1,893.0
Ind inc tax ($b) 1,226.2 1,331.1 1,384.7 1,458.5 1,536.3 1,602.6 1,663.3 1,729.3 1,807.4 1,893.0
Payroll tax ($b) 919.6 961.9 1,003.7 1,045.3 1,093.9 1,141.4 1,186.7 1,233.7 1,284.4 1,338.8
Combined liability ($b) 2,145.7 2,292.9 2,388.3 2,503.7 2,630.1 2,743.8 2,849.9 2,962.9 3,091.7 3,231.8
Combined liability ($b) 2,145.8 2,293.0 2,388.4 2,503.8 2,630.2 2,743.9 2,849.9 2,962.9 3,091.8 3,231.8
26 changes: 13 additions & 13 deletions taxcalc/tests/pufcsv_mtr_expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,43 @@ ITAX mtr histogram bin edges:
[-1.0, -0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 1.0]
PTAX and ITAX mtr histogram bin counts for e00200p:
219814 : 0 31950 0 0 0 0 0 183680 4184 0
219814 : 4596 91 1979 8882 45492 63313 48579 25793 20430 659
219814 : 4596 91 1978 8876 45584 63246 48589 25767 20428 659
PTAX and ITAX mtr histogram bin counts for e00900p:
219814 : 14116 29235 0 0 0 0 0 176463 0 0
219814 : 3328 524 795 164 15289 35307 69924 47704 36767 10012
219814 : 3328 524 794 164 15287 35394 69858 47714 36741 10010
PTAX and ITAX mtr histogram bin counts for e00300:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 60271 62943 44131 26138 25642 689
219814 : 0 0 0 0 60365 62865 44142 26113 25640 689
PTAX and ITAX mtr histogram bin counts for e00400:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 205699 7875 6101 102 29 8
PTAX and ITAX mtr histogram bin counts for e00600:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 60269 62960 44303 25956 25637 689
219814 : 0 0 0 0 60366 62879 44314 25931 25635 689
PTAX and ITAX mtr histogram bin counts for e00650:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 6 20577 103638 44365 50201 614 389 24
219814 : 0 0 6 20573 103644 44365 50201 612 389 24
PTAX and ITAX mtr histogram bin counts for e01400:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 60219 63053 47685 26433 21750 674
219814 : 0 0 0 0 60317 62971 47696 26408 21748 674
PTAX and ITAX mtr histogram bin counts for e01700:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 60222 63050 47666 26452 21750 674
219814 : 0 0 0 0 60320 62968 47677 26427 21748 674
PTAX and ITAX mtr histogram bin counts for e02000:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 60239 63005 44356 25888 25637 689
219814 : 0 0 0 0 60337 62923 44367 25863 25635 689
PTAX and ITAX mtr histogram bin counts for e02400:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 0 96303 41050 52047 29535 773 106
219814 : 0 0 0 0 96405 40966 52036 29528 773 106
PTAX and ITAX mtr histogram bin counts for p22250:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 0 20 82515 60793 42459 18898 14721 408
219814 : 0 0 0 20 82611 60712 42471 18873 14719 408
PTAX and ITAX mtr histogram bin counts for p23250:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 0 0 2 19803 122228 38607 33938 2156 3033 47
219814 : 0 0 2 19798 122240 38602 33938 2154 3033 47
PTAX and ITAX mtr histogram bin counts for e18500:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 22942 23256 20771 5936 146909 0 0 0 0 0
219814 : 22942 23254 20704 5937 146977 0 0 0 0 0
PTAX and ITAX mtr histogram bin counts for e19200:
219814 : 219814 0 0 0 0 0 0 0 0 0
219814 : 32345 27676 20732 3141 135920 0 0 0 0 0
219814 : 32345 27674 20664 3143 135988 0 0 0 0 0
2 changes: 1 addition & 1 deletion taxcalc/validation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ provides a free Tcl interpreter for Windows (tclsh.exe).

The `make_in.tcl` and `more_in.py` scripts are used to randomly
generate INPUT files, which have increasingly longer sets of filing
unit attributes and typically contain 100,000 filing units. Read the
unit attributes and contain as many as 100,000 filing units. Read the
source code of the scripts for additional details on how to use them.

The `taxdiffs.tcl` script calls the `taxdiff.awk` script to compute
Expand Down
Loading