diff --git a/RELEASES.md b/RELEASES.md index ce0302364..9fc3fa39f 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,6 +4,39 @@ Go [here](https://github.com/open-source-economics/Tax-Calculator/pulls?q=is%3Ap for a complete commit history. +2018-10-24 Release 0.22.0 +------------------------------------------------------------------------- +(last merged pull request is +[#2087](https://github.com/open-source-economics/Tax-Calculator/pull/2087)) + +**API Changes** +- Refactor `tbi` functions so that other models in the Policy Simulation Library (PSL) collection of USA tax models can easily produce the tables expected by TaxBrain + [[#2087](https://github.com/open-source-economics/Tax-Calculator/pull/2087) + by Martin Holmer] + +**New Features** +- Add more detailed pull-request work-flow documentation + [[#2071](https://github.com/open-source-economics/Tax-Calculator/pull/2071) + by Martin Holmer] +- Add Travis-CI-build badge to `README.md` file + [[#2078](https://github.com/open-source-economics/Tax-Calculator/pull/2078) + by Philipp Kats] +- Add ability to read online JSON reform/assumption files located at URLs beginning with `http` + [[#2079](https://github.com/open-source-economics/Tax-Calculator/pull/2079) + by Anderson Frailey] +- Add Python-version and code-coverage badges to `README.md` file + [[#2080](https://github.com/open-source-economics/Tax-Calculator/pull/2080) + by Martin Holmer] + +**Bug Fixes** +- Fix syntax error in `gitpr.bat` Windows batch script + [[#2084](https://github.com/open-source-economics/Tax-Calculator/pull/2084) + by Martin Holmer] +- Fix bug in create_difference_table utility function that affected the `ubi` and `benefit_*_total` variables + [[#2087](https://github.com/open-source-economics/Tax-Calculator/pull/2087) + by Martin Holmer] + + 2018-09-11 Release 0.21.0 : first release compatible only with Python 3.6 ------------------------------------------------------------------------- (last merged pull request is diff --git a/docs/cookbook.html b/docs/cookbook.html index 56b3447df..6f122d0e2 100644 --- a/docs/cookbook.html +++ b/docs/cookbook.html @@ -15,7 +15,7 @@

Cookbook of Tested Recipes for Python Programming with

This document tells you how to use Tax-Calculator, an open-source federal income and payroll tax simulation model, in Python scripts that you can run on your own computer. Note that these recipes -require Tax-Calculator release 0.21.0 or higher running on Python 3.6. +require Tax-Calculator release 0.22.0 or higher running on Python 3.6. For other ways of using Tax-Calculator, see the user documentation, which this Cookbook assumes you have read.

diff --git a/docs/cookbook/recipe00.py b/docs/cookbook/recipe00.py index 0702400ae..8a6965e4d 100644 --- a/docs/cookbook/recipe00.py +++ b/docs/cookbook/recipe00.py @@ -1,3 +1,4 @@ +import pandas as pd from taxcalc import * # use publicly-available CPS input file including benefits @@ -43,8 +44,8 @@ # print total revenue estimates for cyr # (estimates in billons of dollars rounded to nearest hundredth of a billion) -print('{}_CLP_itax_rev($B)= {:.2f}'.format(cyr, itax_rev1 * 1e-9)) -print('{}_REF_itax_rev($B)= {:.2f}'.format(cyr, itax_rev2 * 1e-9)) +print('{}_CLP_itax_rev($B)= {:.3f}'.format(cyr, itax_rev1 * 1e-9)) +print('{}_REF_itax_rev($B)= {:.3f}'.format(cyr, itax_rev2 * 1e-9)) print('') # generate several other standard results tables: @@ -58,11 +59,11 @@ assert isinstance(dist_table1, pd.DataFrame) assert isinstance(dist_table2, pd.DataFrame) dist_extract = pd.DataFrame() -dist_extract['funits(#m)'] = dist_table1['s006'] * 1e-6 -dist_extract['itax1($b)'] = dist_table1['iitax'] * 1e-9 -dist_extract['itax2($b)'] = dist_table2['iitax'] * 1e-9 -dist_extract['aftertax_inc1($b)'] = dist_table1['aftertax_income'] * 1e-9 -dist_extract['aftertax_inc2($b)'] = dist_table2['aftertax_income'] * 1e-9 +dist_extract['funits(#m)'] = dist_table1['s006'] +dist_extract['itax1($b)'] = dist_table1['iitax'] +dist_extract['itax2($b)'] = dist_table2['iitax'] +dist_extract['aftertax_inc1($b)'] = dist_table1['aftertax_income'] +dist_extract['aftertax_inc2($b)'] = dist_table2['aftertax_income'] # income-tax difference table by expanded-income decile for cyr diff_table = calc1.difference_table(calc2, 'weighted_deciles', 'iitax') @@ -72,9 +73,8 @@ 'pc_aftertaxinc'] ext_colnames = ['funits(#m)', 'agg_diff($b)', 'mean_diff($)', 'aftertaxinc_diff(%)'] -scaling_factors = [1e-6, 1e-9, 1e0, 1e0, 1e0] -for dname, ename, sfactor in zip(dif_colnames, ext_colnames, scaling_factors): - diff_extract[ename] = diff_table[dname] * sfactor +for dname, ename in zip(dif_colnames, ext_colnames): + diff_extract[ename] = diff_table[dname] # generate percentage-change-in-aftertax-income graph and save in an HTML file fig = calc1.pch_graph(calc2) diff --git a/docs/cookbook/recipe00.res b/docs/cookbook/recipe00.res index 6374da5f3..b28853474 100644 --- a/docs/cookbook/recipe00.res +++ b/docs/cookbook/recipe00.res @@ -47,93 +47,93 @@ Policy Reform Parameter Values by Year: and above tax bracket 6. baseline_value: 0.37 -2020_CLP_itax_rev($B)= 1413.43 -2020_REF_itax_rev($B)= 1410.78 +2020_CLP_itax_rev($B)= 1413.428 +2020_REF_itax_rev($B)= 1410.783 CLP diagnostic table: 2020 -Returns (#m) 167.51 -AGI ($b) 11,946.47 -Itemizers (#m) 31.03 -Itemized Deduction ($b) 872.79 -Standard Deduction Filers (#m) 136.48 -Standard Deduction ($b) 2,438.38 -Personal Exemption ($b) 0.00 -Taxable Income ($b) 9,126.24 -Regular Tax ($b) 1,574.26 -AMT Income ($b) 11,332.09 -AMT Liability ($b) 1.83 -AMT Filers (#m) 0.42 -Tax before Credits ($b) 1,576.08 -Refundable Credits ($b) 78.60 -Nonrefundable Credits ($b) 93.69 -Reform Surtaxes ($b) 0.00 -Other Taxes ($b) 9.63 -Ind Income Tax ($b) 1,413.43 -Payroll Taxes ($b) 1,316.61 -Combined Liability ($b) 2,730.03 -With Income Tax <= 0 (#m) 60.37 -With Combined Tax <= 0 (#m) 39.23 +Returns (#m) 167.510 +AGI ($b) 11946.468 +Itemizers (#m) 31.030 +Itemized Deduction ($b) 872.795 +Standard Deduction Filers (#m) 136.480 +Standard Deduction ($b) 2438.381 +Personal Exemption ($b) 0.000 +Taxable Income ($b) 9126.239 +Regular Tax ($b) 1574.257 +AMT Income ($b) 11332.086 +AMT Liability ($b) 1.827 +AMT Filers (#m) 0.420 +Tax before Credits ($b) 1576.084 +Refundable Credits ($b) 78.598 +Nonrefundable Credits ($b) 93.685 +Reform Surtaxes ($b) 0.000 +Other Taxes ($b) 9.627 +Ind Income Tax ($b) 1413.428 +Payroll Taxes ($b) 1316.606 +Combined Liability ($b) 2730.034 +With Income Tax <= 0 (#m) 60.370 +With Combined Tax <= 0 (#m) 39.230 REF diagnostic table: 2020 -Returns (#m) 167.51 -AGI ($b) 11,946.47 -Itemizers (#m) 30.95 -Itemized Deduction ($b) 870.48 -Standard Deduction Filers (#m) 136.56 -Standard Deduction ($b) 2,439.80 -Personal Exemption ($b) 327.45 -Taxable Income ($b) 8,879.74 -Regular Tax ($b) 1,569.19 -AMT Income ($b) 11,334.04 -AMT Liability ($b) 1.79 -AMT Filers (#m) 0.42 -Tax before Credits ($b) 1,570.97 -Refundable Credits ($b) 81.35 -Nonrefundable Credits ($b) 88.47 -Reform Surtaxes ($b) 0.00 -Other Taxes ($b) 9.63 -Ind Income Tax ($b) 1,410.78 -Payroll Taxes ($b) 1,316.61 -Combined Liability ($b) 2,727.39 -With Income Tax <= 0 (#m) 62.57 -With Combined Tax <= 0 (#m) 39.56 +Returns (#m) 167.510 +AGI ($b) 11946.468 +Itemizers (#m) 30.950 +Itemized Deduction ($b) 870.479 +Standard Deduction Filers (#m) 136.560 +Standard Deduction ($b) 2439.801 +Personal Exemption ($b) 327.446 +Taxable Income ($b) 8879.741 +Regular Tax ($b) 1569.188 +AMT Income ($b) 11334.037 +AMT Liability ($b) 1.785 +AMT Filers (#m) 0.420 +Tax before Credits ($b) 1570.973 +Refundable Credits ($b) 81.346 +Nonrefundable Credits ($b) 88.471 +Reform Surtaxes ($b) 0.000 +Other Taxes ($b) 9.627 +Ind Income Tax ($b) 1410.783 +Payroll Taxes ($b) 1316.606 +Combined Liability ($b) 2727.388 +With Income Tax <= 0 (#m) 62.570 +With Combined Tax <= 0 (#m) 39.560 Extract of 2020 distribution table by baseline expanded-income decile: funits(#m) itax1($b) itax2($b) aftertax_inc1($b) aftertax_inc2($b) -0-10n 0.00 0.00 0.00 0.00 0.00 -0-10z 0.00 0.00 0.00 0.00 0.00 -0-10p 16.75 -4.25 -4.61 162.91 163.27 -10-20 16.75 -1.72 -2.80 413.27 414.35 -20-30 16.75 3.49 2.26 551.40 552.63 -30-40 16.75 9.90 8.22 679.03 680.72 -40-50 16.75 18.88 16.55 836.85 839.18 -50-60 16.75 32.45 29.39 1,028.48 1,031.54 -60-70 16.75 61.43 57.51 1,263.59 1,267.52 -70-80 16.75 106.69 101.38 1,583.96 1,589.27 -80-90 16.75 213.76 205.51 2,108.73 2,116.98 -90-100 16.75 972.80 997.39 4,309.80 4,285.21 -ALL 167.51 1,413.43 1,410.78 12,938.02 12,940.66 -90-95 8.38 214.47 210.15 1,438.22 1,442.54 -95-99 6.70 327.05 326.02 1,668.49 1,669.52 -Top 1% 1.68 431.28 461.22 1,203.09 1,173.15 +0-10n 0.00 0.000 0.000 0.000 0.000 +0-10z 0.00 0.000 0.000 0.000 0.000 +0-10p 16.75 -4.245 -4.611 162.909 163.274 +10-20 16.75 -1.719 -2.795 413.273 414.349 +20-30 16.75 3.487 2.255 551.395 552.627 +30-40 16.75 9.901 8.217 679.030 680.715 +40-50 16.75 18.877 16.549 836.851 839.180 +50-60 16.75 32.449 29.390 1028.479 1031.538 +60-70 16.75 61.434 57.505 1263.591 1267.519 +70-80 16.75 106.685 101.378 1583.962 1589.269 +80-90 16.75 213.758 205.507 2108.727 2116.977 +90-100 16.75 972.801 997.387 4309.799 4285.212 +ALL 167.51 1413.428 1410.783 12938.017 12940.662 +90-95 8.38 214.466 210.146 1438.220 1442.539 +95-99 6.70 327.052 326.021 1668.488 1669.519 +Top 1% 1.68 431.283 461.220 1203.091 1173.155 Extract of 2020 income-tax difference table by expanded-income decile: funits(#m) agg_diff($b) mean_diff($) aftertaxinc_diff(%) -0-10n 0.00 0.00 0.00 nan -0-10z 0.00 0.00 0.00 nan -0-10p 16.75 -0.37 -21.82 0.22 -10-20 16.75 -1.08 -64.24 0.26 -20-30 16.75 -1.23 -73.54 0.22 -30-40 16.75 -1.68 -100.58 0.25 -40-50 16.75 -2.33 -139.01 0.28 -50-60 16.75 -3.06 -182.61 0.30 -60-70 16.75 -3.93 -234.50 0.31 -70-80 16.75 -5.31 -316.82 0.34 -80-90 16.75 -8.25 -492.52 0.39 -90-100 16.75 24.59 1,467.69 -0.57 -ALL 167.51 -2.65 -15.79 0.02 -90-95 8.38 -4.32 -515.68 0.30 -95-99 6.70 -1.03 -153.88 0.06 -Top 1% 1.68 29.94 17,871.04 -2.49 +0-10n 0.00 0.000 0.0 NaN +0-10z 0.00 0.000 0.0 NaN +0-10p 16.75 -0.365 -21.8 0.2 +10-20 16.75 -1.076 -64.2 0.3 +20-30 16.75 -1.232 -73.5 0.2 +30-40 16.75 -1.685 -100.6 0.2 +40-50 16.75 -2.329 -139.0 0.3 +50-60 16.75 -3.059 -182.6 0.3 +60-70 16.75 -3.928 -234.5 0.3 +70-80 16.75 -5.307 -316.8 0.3 +80-90 16.75 -8.250 -492.5 0.4 +90-100 16.75 24.586 1467.7 -0.6 +ALL 167.51 -2.645 -15.8 0.0 +90-95 8.38 -4.319 -515.7 0.3 +95-99 6.70 -1.031 -153.9 0.1 +Top 1% 1.68 29.936 17871.0 -2.5 diff --git a/docs/cookbook/recipe01.py b/docs/cookbook/recipe01.py index 39dd76986..d705c8c45 100644 --- a/docs/cookbook/recipe01.py +++ b/docs/cookbook/recipe01.py @@ -1,4 +1,5 @@ from urllib.request import urlopen +import pandas as pd from taxcalc import * # read two "old" reform files from Tax-Calculator website @@ -53,14 +54,13 @@ 'tot_change', 'mean', 'pc_aftertaxinc'] ext_colnames = ['funits(#m)', 'taxfall(#m)', 'taxrise(#m)', 'agg_diff($b)', 'mean_diff($)', 'aftertax_income_diff(%)'] -scaling_factors = [1e-6, 1e-6, 1e-6, 1e-9, 1e0, 1e0, 1e0] -for dname, ename, sfactor in zip(dif_colnames, ext_colnames, scaling_factors): - diff_extract[ename] = diff_table[dname] * sfactor +for dname, ename in zip(dif_colnames, ext_colnames): + diff_extract[ename] = diff_table[dname] # print total revenue estimates for cyr # (estimates in billons of dollars rounded to nearest tenth of a billion) -print('{}_REFORM1_iitax_rev($B)= {:.1f}'.format(cyr, iitax_rev1 * 1e-9)) -print('{}_REFORM2_iitax_rev($B)= {:.1f}'.format(cyr, iitax_rev2 * 1e-9)) +print('{}_REFORM1_iitax_rev($B)= {:.3f}'.format(cyr, iitax_rev1 * 1e-9)) +print('{}_REFORM2_iitax_rev($B)= {:.3f}'.format(cyr, iitax_rev2 * 1e-9)) print('') title = 'Extract of {} income-tax difference table by expanded-income decile' diff --git a/docs/cookbook/recipe01.res b/docs/cookbook/recipe01.res index 297584835..8e0a5cd2a 100644 --- a/docs/cookbook/recipe01.res +++ b/docs/cookbook/recipe01.res @@ -2,26 +2,26 @@ You loaded data for 2014. Tax-Calculator startup automatically extrapolated your data to 2014. You loaded data for 2014. Tax-Calculator startup automatically extrapolated your data to 2014. -2018_REFORM1_iitax_rev($B)= 1422.1 -2018_REFORM2_iitax_rev($B)= 1267.4 +2018_REFORM1_iitax_rev($B)= 1422.082 +2018_REFORM2_iitax_rev($B)= 1267.362 Extract of 2018 income-tax difference table by expanded-income decile (taxfall is count of funits with cut in income tax in reform 2 vs 1) (taxrise is count of funits with rise in income tax in reform 2 vs 1) funits(#m) taxfall(#m) taxrise(#m) agg_diff($b) mean_diff($) aftertax_income_diff(%) -0-10n 0.00 0.00 0.00 0.00 0.00 nan -0-10z 0.00 0.00 0.00 0.00 0.00 nan -0-10p 16.29 4.86 1.68 -0.67 -40.84 0.45 -10-20 16.29 9.19 1.74 -2.05 -125.91 0.55 -20-30 16.29 8.64 1.45 -3.63 -222.64 0.73 -30-40 16.29 9.82 1.73 -5.41 -332.35 0.88 -40-50 16.29 10.98 1.63 -7.03 -431.53 0.93 -50-60 16.29 10.92 1.97 -8.35 -512.77 0.90 -60-70 16.29 12.04 1.87 -11.01 -675.73 0.96 -70-80 16.29 13.37 1.64 -15.72 -965.18 1.09 -80-90 16.29 13.63 2.17 -23.42 -1,438.26 1.22 -90-100 16.29 14.55 1.63 -77.44 -4,754.65 2.01 -ALL 162.86 108.00 17.51 -154.72 -950.00 1.32 -90-95 8.14 7.15 0.90 -18.24 -2,239.31 1.40 -95-99 6.51 5.97 0.52 -35.13 -5,393.93 2.35 -Top 1% 1.63 1.42 0.21 -24.07 -14,766.78 2.27 +0-10n 0.00 0.000 0.000 0.000 0.0 NaN +0-10z 0.00 0.000 0.000 0.000 0.0 NaN +0-10p 16.29 0.005 0.002 -0.665 -40.8 0.4 +10-20 16.29 0.009 0.002 -2.051 -125.9 0.5 +20-30 16.29 0.009 0.001 -3.626 -222.6 0.7 +30-40 16.29 0.010 0.002 -5.413 -332.4 0.9 +40-50 16.29 0.011 0.002 -7.028 -431.5 0.9 +50-60 16.29 0.011 0.002 -8.351 -512.8 0.9 +60-70 16.29 0.012 0.002 -11.005 -675.7 1.0 +70-80 16.29 0.013 0.002 -15.719 -965.2 1.1 +80-90 16.29 0.014 0.002 -23.423 -1438.3 1.2 +90-100 16.29 0.015 0.002 -77.439 -4754.6 2.0 +ALL 162.86 0.108 0.018 -154.720 -950.0 1.3 +90-95 8.14 0.007 0.001 -18.236 -2239.3 1.4 +95-99 6.51 0.006 0.001 -35.134 -5393.9 2.4 +Top 1% 1.63 0.001 0.000 -24.069 -14766.8 2.3 diff --git a/docs/index.html b/docs/index.html index b82d3ab0f..878fae03b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -41,25 +41,25 @@

What's New

than an older version that your browser has saved in its cache of previously visited pages.

+

Add automatic scaling of table results +so that Python scripts (and Cookbook recipes) do not need to change +dollars into billions of dollars and filing units into millions of +filing units

+

Code changes so works only with Python 3.6 plus minor PUF data change are available in Tax-Calculator release 0.21.0 and higher. Note that release 0.21.0 is the first -release that is compatible with only Python 3.6. +release that is compatible with only Python 3.6.

Both CPS and PUF data improvements are available in Tax-Calculator release 0.20.3 and higher. Note that release 0.20.3 is the last release that will be compatible -with Python 2.7; subsequest releases will run only with Python 3.6. +with Python 2.7; subsequest releases will run only with Python 3.6.

Flexible quantity_response utility function is available in Tax-Calculator release 0.20.0 and -higher, and there is a new Cookbook recipe to illustrate its use +higher, and there is a new Cookbook recipe to illustrate its use

-

Fix data and logic bugs -so that the Child Tax Credit for those with kids age 17 is now lower -and so that the income tax liability for those with large business -losses is now lower in Tax-Calculator release 0.19.0 and higher -

To upgrade to the newest version of the Tax-Calculator package, execute this command:
conda update -c ospc taxcalc

diff --git a/docs/index.htmx b/docs/index.htmx index 88bfb60dc..e2f4b2a3c 100644 --- a/docs/index.htmx +++ b/docs/index.htmx @@ -40,25 +40,25 @@ ensure you are viewing the most recent version of this page rather than an older version that your browser has saved in its cache of previously visited pages.

+

Add automatic scaling of table results +so that Python scripts (and Cookbook recipes) do not need to change +dollars into billions of dollars and filing units into millions of +filing units

+

Code changes so works only with Python 3.6 plus minor PUF data change are available in Tax-Calculator release 0.21.0 and higher. Note that release 0.21.0 is the first -release that is compatible with only Python 3.6. +release that is compatible with only Python 3.6.

Both CPS and PUF data improvements are available in Tax-Calculator release 0.20.3 and higher. Note that release 0.20.3 is the last release that will be compatible -with Python 2.7; subsequest releases will run only with Python 3.6. +with Python 2.7; subsequest releases will run only with Python 3.6.

Flexible quantity_response utility function is available in Tax-Calculator release 0.20.0 and -higher, and there is a new Cookbook recipe to illustrate its use +higher, and there is a new Cookbook recipe to illustrate its use

-

Fix data and logic bugs -so that the Child Tax Credit for those with kids age 17 is now lower -and so that the income tax liability for those with large business -losses is now lower in Tax-Calculator release 0.19.0 and higher -

To upgrade to the newest version of the Tax-Calculator package, execute this command:
conda update -c ospc taxcalc

diff --git a/docs/recipe00.graph.html b/docs/recipe00.graph.html index 047103d1c..4aabd81fd 100644 --- a/docs/recipe00.graph.html +++ b/docs/recipe00.graph.html @@ -15,11 +15,11 @@
-
+
-