Skip to content

Commit

Permalink
Merge pull request #2444 from Peter-Metz/cps_weights
Browse files Browse the repository at this point in the history
Update Tax-Calculator with latest CPS file and CPS weights
  • Loading branch information
MattHJensen authored Aug 19, 2020
2 parents 30ae259 + 6d20ebd commit 5cb7504
Show file tree
Hide file tree
Showing 15 changed files with 321 additions and 391 deletions.
40 changes: 19 additions & 21 deletions docs/recipes/recipe05.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,29 +59,27 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2018_REFORM1_iitax_rev($B)= 1422.968\n",
"2018_REFORM2_iitax_rev($B)= 1272.649\n",
"2018_REFORM1_iitax_rev($B)= 1490.621\n",
"2018_REFORM2_iitax_rev($B)= 1318.628\n",
"\n",
"Extract of 2018 income-tax difference table by expanded-income decile\n",
"(taxfall is count of funits with cut in income tax in reform 2 vs 1)\n",
"(taxrise is count of funits with rise in income tax in reform 2 vs 1)\n",
" funits(#m) taxfall(#m) taxrise(#m) agg_diff($b) mean_diff($) aftertax_income_diff(%)\n",
"0-10n 0.07 0.00 0.00 0.006 94.0 0.0\n",
"0-10z 15.87 0.00 0.01 -0.000 -0.0 -10.1\n",
"0-10p 0.34 0.00 0.00 0.000 0.0 0.0\n",
"10-20 16.29 1.08 0.68 -0.075 -4.6 0.1\n",
"20-30 16.29 9.95 2.66 -1.531 -94.0 0.6\n",
"30-40 16.29 12.77 2.12 -3.741 -229.7 1.0\n",
"40-50 16.29 13.55 2.17 -7.217 -443.1 1.5\n",
"50-60 16.29 13.78 2.22 -10.153 -623.4 1.6\n",
"60-70 16.28 13.64 2.45 -12.430 -763.3 1.5\n",
"70-80 16.29 14.00 2.13 -16.511 -1013.7 1.5\n",
"80-90 16.29 13.84 2.35 -23.084 -1417.4 1.4\n",
"90-100 16.29 14.54 1.71 -75.584 -4640.8 2.1\n",
"ALL 162.86 107.16 18.49 -150.319 -923.0 1.7\n",
"90-95 8.14 7.15 0.96 -18.297 -2246.9 1.6\n",
"95-99 6.51 5.97 0.54 -34.982 -5369.6 2.5\n",
"Top 1% 1.63 1.42 0.20 -22.305 -13695.2 2.1\n"
" funits(#m) taxfall(#m) taxrise(#m) agg_diff($b) mean_diff($) aftertax_income_diff(%)\n",
"<$0K 0.139124 0 0 0 0 0\n",
"=$0K 29.361 0.00398284 0.00256599 -0.000287359 -0.00978711 -10.9947\n",
"$0-10K 32.6342 2.4395 1.48106 -0.192404 -5.89577 0.153202\n",
"$10-20K 21.2155 11.4005 3.74961 -1.57495 -74.2359 0.523949\n",
"$20-30K 18.4881 13.4157 3.11783 -3.83301 -207.323 0.911481\n",
"$30-40K 16.8463 13.3099 2.78059 -7.11432 -422.308 1.39848\n",
"$40-50K 13.3335 11.0923 1.91614 -8.32639 -624.471 1.66377\n",
"$50-75K 22.9225 20.2617 2.36473 -20.2522 -883.508 1.78165\n",
"$75-100K 13.7307 12.3925 1.2298 -16.2928 -1186.6 1.73044\n",
"$100-200K 21.7543 19.7221 1.93615 -41.9197 -1926.96 1.8326\n",
"$200-500K 7.84776 7.23654 0.604507 -43.9066 -5594.79 2.66207\n",
"$500-1000K 1.14915 1.07263 0.0765177 -15.3413 -13350.1 2.85443\n",
">$1000K 0.514758 0.428676 0.0860823 -13.2397 -25720.2 1.98472\n",
"ALL 199.937 112.776 19.3456 -171.994 -860.24 1.89689\n"
]
}
],
Expand Down Expand Up @@ -200,7 +198,7 @@
"iitax_rev2 = calc2.weighted_total('iitax')\n",
"\n",
"# construct reform-vs-baseline difference table with results for income deciles\n",
"diff_table = calc1.difference_table(calc2, 'weighted_deciles', 'iitax')\n",
"diff_table = calc1.difference_table(calc2, 'standard_income_bins', 'iitax')\n",
"assert isinstance(diff_table, pd.DataFrame)\n",
"diff_extract = pd.DataFrame()\n",
"dif_colnames = ['count', 'tax_cut', 'tax_inc',\n",
Expand Down Expand Up @@ -246,7 +244,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.6.7"
},
"title": "Recipe 5: Redefining Expanded Income"
},
Expand Down
16 changes: 8 additions & 8 deletions taxcalc/calcfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1298,15 +1298,15 @@ def ChildDepTaxCredit(n24, MARS, c00100, XTOT, num, c05800,
e07240, CR_RetirementSavings_hc,
c07200,
CTC_c, CTC_ps, CTC_prt, exact, ODC_c,
CTC_c_under5_bonus, nu05,
CTC_c_under6_bonus, nu06,
c07220, odc, codtc_limited):
"""
Computes amounts on "Child Tax Credit and Credit for Other Dependents
Worksheet" in 2018 Publication 972, which pertain to these two
nonrefundable tax credits.
"""
# Worksheet Part 1
line1 = CTC_c * n24 + CTC_c_under5_bonus * nu05
line1 = CTC_c * n24 + CTC_c_under6_bonus * nu06
line2 = ODC_c * max(0, XTOT - n24 - num)
line3 = line1 + line2
modAGI = c00100 # no foreign earned income exclusion to add to AGI (line6)
Expand Down Expand Up @@ -1627,7 +1627,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, nu05, ACTC_rt_bonus_under5family, ACTC_ChildNum,
ACTC_rt, nu06, ACTC_rt_bonus_under6family, ACTC_ChildNum,
ptax_was, c03260, e09800, c59660, e11200,
c11070):
"""
Expand All @@ -1642,10 +1642,10 @@ def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd,
line5 = min(line3, line4)
line7 = max(0., earned - ACTC_Income_thd)
# accommodate ACTC rate bonus for families with children under 5
if nu05 == 0:
if nu06 == 0:
ACTC_rate = ACTC_rt
else:
ACTC_rate = ACTC_rt + ACTC_rt_bonus_under5family
ACTC_rate = ACTC_rt + ACTC_rt_bonus_under6family
line8 = ACTC_rate * line7
if n24 < ACTC_ChildNum:
if line8 > 0.:
Expand Down Expand Up @@ -1686,18 +1686,18 @@ def C1040(c05800, c07180, c07200, c07220, c07230, c07240, c07260, c07300,


@iterate_jit(nopython=True)
def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under5_bonus,
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_new_refund_limited, CTC_new_refund_limit_payroll_rt,
CTC_new_refund_limited_all_payroll, payrolltax,
n24, nu05, c00100, MARS, ptax_oasdi, c09200,
n24, nu06, c00100, MARS, ptax_oasdi, c09200,
ctc_new):
"""
Computes new refundable child tax credit using specified parameters.
"""
if n24 > 0:
posagi = max(c00100, 0.)
ctc_new = CTC_new_c * n24 + CTC_new_c_under5_bonus * nu05
ctc_new = CTC_new_c * n24 + CTC_new_c_under6_bonus * nu06
if not CTC_new_for_all:
ctc_new = min(CTC_new_rt * posagi, ctc_new)
ymax = CTC_new_ps[MARS - 1]
Expand Down
Binary file modified taxcalc/cps.csv.gz
Binary file not shown.
Binary file modified taxcalc/cps_weights.csv.gz
Binary file not shown.
6 changes: 5 additions & 1 deletion taxcalc/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ class instance: Policy
'PT_excl_wagelim_prt':
'was renamed PT_qbid_taxinc_gap in release 2.4.0',
'PT_excl_wagelim_rt':
'was renamed PT_qbid_w2_wages_rt in release 2.4.0'
'was renamed PT_qbid_w2_wages_rt in release 2.4.0',
'CTC_c_under5_bonus': 'was renamed CTC_c_under6_bonus.',
'ACTC_rt_bonus_under5family':
'was renamed ACTC_rt_bonus_under6family.',
'CTC_new_c_under5_bonus': 'was renamed CTC_new_c_under6_bonus.'
}
# (2) specify which Policy parameters have been redefined recently
REDEFINED_PARAMS = {}
Expand Down
18 changes: 9 additions & 9 deletions taxcalc/policy_current_law.json
Original file line number Diff line number Diff line change
Expand Up @@ -13192,9 +13192,9 @@
"cps": true
}
},
"CTC_c_under5_bonus": {
"title": "Bonus child tax credit maximum for qualifying children under five",
"description": "The maximum amount of child tax credit allowed for each child is increased by this amount for qualifying children under 5 years old.",
"CTC_c_under6_bonus": {
"title": "Bonus child tax credit maximum for qualifying children under six",
"description": "The maximum amount of child tax credit allowed for each child is increased by this amount for qualifying children under 6 years old.",
"notes": "",
"section_1": "Child/Dependent Credits",
"section_2": "Child Tax Credit",
Expand Down Expand Up @@ -14725,9 +14725,9 @@
"cps": true
}
},
"ACTC_rt_bonus_under5family": {
"title": "Bonus additional child tax credit rate for families with qualifying children under 5",
"description": "For families with qualifying children under 5 years old, this bonus rate is added to the fraction of earnings (additional child tax credit rate) used in calculating the ACTC.",
"ACTC_rt_bonus_under6family": {
"title": "Bonus additional child tax credit rate for families with qualifying children under 6",
"description": "For families with qualifying children under 6 years old, this bonus rate is added to the fraction of earnings (additional child tax credit rate) used in calculating the ACTC.",
"notes": "",
"section_1": "Child/Dependent Credits",
"section_2": "Additional Child Tax Credit",
Expand Down Expand Up @@ -14857,9 +14857,9 @@
"cps": true
}
},
"CTC_new_c_under5_bonus": {
"title": "Bonus new refundable child tax credit maximum for qualifying children under five",
"description": "The maximum amount of the new refundable child tax credit allowed for each child is increased by this amount for qualifying children under 5 years old.",
"CTC_new_c_under6_bonus": {
"title": "Bonus new refundable child tax credit maximum for qualifying children under six",
"description": "The maximum amount of the new refundable child tax credit allowed for each child is increased by this amount for qualifying children under 6 years old.",
"notes": "",
"section_1": "Refundable Credits",
"section_2": "New Refundable Child Tax Credit",
Expand Down
8 changes: 1 addition & 7 deletions taxcalc/records_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,11 @@
"form": {"2013-2016": "imputed from CPS data"},
"availability": "taxdata_puf, taxdata_cps"
},
"nu05": {
"type": "int",
"desc": "Number of dependents under 5 years old",
"form": {"2013-2016": "imputed from CPS data"},
"availability": "taxdata_cps"
},
"nu06": {
"type": "int",
"desc": "Number of dependents under 6 years old",
"form": {"2013-2016": "imputed from CPS data"},
"availability": "taxdata_puf"
"availability": "taxdata_puf, taxdata_cps"
},
"nu13": {
"type": "int",
Expand Down
56 changes: 0 additions & 56 deletions taxcalc/reforms/Clinton2016.json

This file was deleted.

10 changes: 0 additions & 10 deletions taxcalc/reforms/Clinton2016.out.csv

This file was deleted.

Loading

0 comments on commit 5cb7504

Please sign in to comment.