Skip to content

Commit

Permalink
Merge pull request #1983 from martinholmer/0-20-0
Browse files Browse the repository at this point in the history
Update documentation for pending release 0.20.0
  • Loading branch information
martinholmer authored May 18, 2018
2 parents 7088300 + b675c9e commit 64e2e23
Show file tree
Hide file tree
Showing 12 changed files with 269 additions and 54 deletions.
50 changes: 50 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,56 @@ Go [here](https://github.com/open-source-economics/Tax-Calculator/pulls?q=is%3Ap
for a complete commit history.


2018-05-18 Release 0.20.0
-------------------------
(last merged pull request is
[#2003](https://github.com/open-source-economics/Tax-Calculator/pull/2003))

**API Changes**
- Simplify table-creation Calculator methods and related utility functions
[[#1984](https://github.com/open-source-economics/Tax-Calculator/pull/1984)
by Martin Holmer]
- Rename `Growfactors` class as `GrowFactors` and rename `Growdiff` class as `GrowDiff`
[[#1996](https://github.com/open-source-economics/Tax-Calculator/pull/1996)
by Martin Holmer]
- Add `quantity_response` utility function and remove obsolete charity and earnings response logic from Behavior class
[[#1997](https://github.com/open-source-economics/Tax-Calculator/pull/1997)
by Martin Holmer]
- Add empty shell of `GrowModel` class that will eventually contain a simple macroeconomic growth model with annual feedback to the microeconomic simulation
[[#1998](https://github.com/open-source-economics/Tax-Calculator/pull/1998)
by Martin Holmer]

**New Features**
- Streamline logic that prevents disclosure of details of PUF filing units
[[#1979](https://github.com/open-source-economics/Tax-Calculator/pull/1979)
by Martin Holmer]
- Add option to not include benefits in a Records object that uses CPS data
[[#1985](https://github.com/open-source-economics/Tax-Calculator/pull/1985)
and
[[#1988](https://github.com/open-source-economics/Tax-Calculator/pull/1988)
by Martin Holmer]
- Update CODING and TESTING documentation to reflect recommended usage of `pycodestyle` in place of `pep8`
[[#1989](https://github.com/open-source-economics/Tax-Calculator/pull/1989)
by Martin Holmer]
- Add validity checking for non-behavior assumption parameters
[[#1992](https://github.com/open-source-economics/Tax-Calculator/pull/1992)
by Martin Holmer]
- Add Tax-Calculator Cookbook recipe using Behavior class and its `response` method
[[#1993](https://github.com/open-source-economics/Tax-Calculator/pull/1993)
by Martin Holmer]
- Add Tax-Calculator Cookbook recipe showing how to create a custom table
[[#1994](https://github.com/open-source-economics/Tax-Calculator/pull/1994)
by Martin Holmer]
- Add Tax-Calculator Cookbook recipe showing how to use new `quantity_response` utility function
[[#2002](https://github.com/open-source-economics/Tax-Calculator/pull/2002)
by Martin Holmer]

**Bug Fixes**
- Fix mishandling of boolean policy parameters
[[#1982](https://github.com/open-source-economics/Tax-Calculator/pull/1982)
by Hank Doupe]


2018-04-19 Release 0.19.0
-------------------------
(last merged pull request is
Expand Down
9 changes: 5 additions & 4 deletions docs/assumpA.json.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<title>assumpA.json</title><pre>
// NEVER SPECIFY BOTH behavior AND growdiff_response IN SAME RUN
// This JSON economic assumption file specifies a non-zero substitution
// elasticity for taxable income, which causes a response in taxable income
// to a reform-induced change in marginal tax rates
{
"consumption": {
},
"behavior": {
// specify non-zero substitution elasticity of taxable income,
// which is response of taxable income to change in marginal tax rate
"_BE_sub": {"2013": [0.25]}
},
"growdiff_baseline": {
},
"growdiff_response": {
// MUST BE EMPTY BECAUSE ASSUMING BEHAVIORAL RESPONSE
},
"growmodel": {
}
}
</pre>
9 changes: 5 additions & 4 deletions docs/cookbook/ingredients/assumpA.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// NEVER SPECIFY BOTH behavior AND growdiff_response IN SAME RUN
// This JSON economic assumption file specifies a non-zero substitution
// elasticity for taxable income, which causes a response in taxable income
// to a reform-induced change in marginal tax rates
{
"consumption": {
},
"behavior": {
// specify non-zero substitution elasticity of taxable income,
// which is response of taxable income to change in marginal tax rate
"_BE_sub": {"2013": [0.25]}
},
"growdiff_baseline": {
},
"growdiff_response": {
// MUST BE EMPTY BECAUSE ASSUMING BEHAVIORAL RESPONSE
},
"growmodel": {
}
}
4 changes: 2 additions & 2 deletions docs/cookbook/recipe03.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ WARNING: Tax-Calculator packages for Python 2.7 will
no longer be provided beginning in 2019
because Pandas is stopping development for 2.7
SOLUTION: upgrade to Python 3.6 now
Filing Units Receiving EITC and Average Positive EITC by AGI category
AGI category Num(#M) Avg($K)
Filing Units Receiving EITC and Average Positive EITC by AGI Category
AGI Category Num(#M) Avg($K)
[-9e+99, 1.0) 0.059 1.340
[1.0, 5000.0) 1.772 0.711
[5000.0, 10000.0) 3.672 1.638
Expand Down
75 changes: 40 additions & 35 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/index.htmx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ 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.</i></p>

<p><a href="https://github.com/open-source-economics/Tax-Calculator/blob/master/RELEASES.md#2018-05-18-release-0200">Flexible <kbd>quantity_response</kbd>
utility function</a> is available in Tax-Calculator release 0.20.0 and
higher, and there is a new Cookbook recipe to illustrate its use

<p><a href="https://github.com/open-source-economics/Tax-Calculator/blob/master/RELEASES.md#2018-04-19-release-0190">Fix data and logic bugs</a>
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
Expand Down
10 changes: 5 additions & 5 deletions docs/recipe00.graph.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/recipe03.py.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
gbydf = vardf.groupby('table_row', as_index=False)

# print AGI table with ALL row at bottom
print('Filing Units Receiving EITC and Average Positive EITC by AGI category')
print('Filing Units Receiving EITC and Average Positive EITC by AGI Category')
results = '{:23s}\t{:8.3f}\t{:8.3f}'
colhead = '{:23s}\t{:>8s}\t{:>8s}'
print(colhead.format('AGI category', 'Num(#M)', 'Avg($K)'))
print(colhead.format('AGI Category', 'Num(#M)', 'Avg($K)'))
tot_recips = 0.
tot_amount = 0.
idx = 0
Expand Down
4 changes: 2 additions & 2 deletions docs/recipe03.res.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
no longer be provided beginning in 2019
because Pandas is stopping development for 2.7
SOLUTION: upgrade to Python 3.6 now
Filing Units Receiving EITC and Average Positive EITC by AGI category
AGI category Num(#M) Avg($K)
Filing Units Receiving EITC and Average Positive EITC by AGI Category
AGI Category Num(#M) Avg($K)
[-9e+99, 1.0) 0.059 1.340
[1.0, 5000.0) 1.772 0.711
[5000.0, 10000.0) 3.672 1.638
Expand Down
84 changes: 84 additions & 0 deletions docs/recipe04.py.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<title>recipe04.py</title><pre>
from __future__ import print_function # necessary only if using Python 2.7
from taxcalc import *

# use publicly-available CPS input file without including benefits
recs = Records.cps_constructor(no_benefits=True)

# specify Calculator object for static analysis of current-law policy
pol = Policy()
calc1 = Calculator(policy=pol, records=recs)

cyr = 2020

# calculate current-law tax liabilities for cyr
calc1.advance_to_year(cyr)
calc1.calc_all()

# calculate marginal tax rate wrt cash charitable giving
(_, _, mtr1) = calc1.mtr('e19800', calc_all_already_called=True,
wrt_full_compensation=False)

# read JSON reform file and use (the default) static analysis assumptions
reform_filename = './ingredients/reformB.json'
params = Calculator.read_json_param_objects(reform=reform_filename,
assump=None)

# specify Calculator object for static analysis of reform policy
pol.implement_reform(params['policy'])
calc2 = Calculator(policy=pol, records=recs)

# calculate reform tax liabilities for cyr
calc2.advance_to_year(cyr)
calc2.calc_all()

# calculate marginal tax rate wrt cash charitable giving
(_, _, mtr2) = calc2.mtr('e19800', calc_all_already_called=True,
wrt_full_compensation=False)

# extract variables needed for quantity_response utility function
# (note the aftertax price is 1+mtr because mtr wrt charity is non-positive)
vdf = calc1.dataframe(['s006', 'e19800', 'e00200'])
vdf['price1'] = 1.0 + mtr1
vdf['price2'] = 1.0 + mtr2
vdf['atinc1'] = calc1.array('aftertax_income')
vdf['atinc2'] = calc2.array('aftertax_income')

# group filing units into earnings groups with different response elasticities
# (note earnings groups are just an example based on no empirical results)
earnings_bins = [-9e99, 50e3, 9e99] # two groups: below and above $50,000
vdf = add_income_table_row_variable(vdf, 'e00200', earnings_bins)
gbydf = vdf.groupby('table_row', as_index=False)

# compute percentage response in charitable giving
# (note elasticity values are just an example based on no empirical results)
price_elasticity = [-0.1, -0.4]
income_elasticity = [0.1, 0.1]
print('\nResponse in Charitable Giving by Earnings Group')
results = '{:18s}\t{:8.3f}\t{:8.3f}\t{:8.2f}'
colhead = '{:18s}\t{:>8s}\t{:>8s}\t{:>8s}'
print(colhead.format('Earnings Group', 'Num(#M)', 'Resp($B)', 'Resp(%)'))
tot_funits = 0.
tot_response = 0.
tot_baseline = 0.
idx = 0
for gname, grp in gbydf:
funits = grp['s006'].sum() * 1e-6
tot_funits += funits
response = quantity_response(grp['e19800'],
price_elasticity[idx],
grp['price1'],
grp['price2'],
income_elasticity[idx],
grp['atinc1'],
grp['atinc2'])
grp_response = (response * grp['s006']).sum() * 1e-9
tot_response += grp_response
grp_baseline = (grp['e19800'] * grp['s006']).sum() * 1e-9
tot_baseline += grp_baseline
pct_response = 100. * grp_response / grp_baseline
print(results.format(gname, funits, grp_response, pct_response))
idx += 1
pct_response = 100. * tot_response / tot_baseline
print(results.format('ALL', tot_funits, tot_response, pct_response))
</pre>
61 changes: 61 additions & 0 deletions docs/recipe04.res.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<title>recipe04.res</title><pre>
You loaded data for 2014.
Tax-Calculator startup automatically extrapolated your data to 2014.
WARNING: Tax-Calculator packages for Python 2.7 will
no longer be provided beginning in 2019
because Pandas is stopping development for 2.7
SOLUTION: upgrade to Python 3.6 now
WARNING: 2020 _STD_0 value 6000.0 < min value 12390.92
WARNING: 2020 _STD_1 value 12000.0 < min value 24881.84
WARNING: 2020 _STD_2 value 6000.0 < min value 12390.92
WARNING: 2020 _STD_3 value 9000.0 < min value 18636.38
WARNING: 2020 _STD_4 value 12000.0 < min value 24881.84
WARNING: 2021 _STD_0 value 6127.8 < min value 12656.98
WARNING: 2021 _STD_1 value 12255.6 < min value 25413.95
WARNING: 2021 _STD_2 value 6127.8 < min value 12656.98
WARNING: 2021 _STD_3 value 9191.7 < min value 19035.46
WARNING: 2021 _STD_4 value 12255.6 < min value 25413.95
WARNING: 2022 _STD_0 value 6261.39 < min value 12935.08
WARNING: 2022 _STD_1 value 12522.77 < min value 25970.15
WARNING: 2022 _STD_2 value 6261.39 < min value 12935.08
WARNING: 2022 _STD_3 value 9392.08 < min value 19452.61
WARNING: 2022 _STD_4 value 12522.77 < min value 25970.15
WARNING: 2023 _STD_0 value 6394.13 < min value 13211.42
WARNING: 2023 _STD_1 value 12788.25 < min value 26522.84
WARNING: 2023 _STD_2 value 6394.13 < min value 13211.42
WARNING: 2023 _STD_3 value 9591.19 < min value 19867.13
WARNING: 2023 _STD_4 value 12788.25 < min value 26522.84
WARNING: 2024 _STD_0 value 6531.6 < min value 13497.62
WARNING: 2024 _STD_1 value 13063.2 < min value 27095.23
WARNING: 2024 _STD_2 value 6531.6 < min value 13497.62
WARNING: 2024 _STD_3 value 9797.4 < min value 20296.42
WARNING: 2024 _STD_4 value 13063.2 < min value 27095.23
WARNING: 2025 _STD_0 value 6670.72 < min value 13787.25
WARNING: 2025 _STD_1 value 13341.45 < min value 27674.49
WARNING: 2025 _STD_2 value 6670.72 < min value 13787.25
WARNING: 2025 _STD_3 value 10006.08 < min value 20730.86
WARNING: 2025 _STD_4 value 13341.45 < min value 27674.49
WARNING: 2026 _STD_0 value 6812.81 < min value 7555.0
WARNING: 2026 _STD_1 value 13625.62 < min value 15211.0
WARNING: 2026 _STD_2 value 6812.81 < min value 7555.0
WARNING: 2026 _STD_3 value 10219.21 < min value 11172.0
WARNING: 2026 _STD_4 value 13625.62 < min value 15211.0
WARNING: 2027 _STD_0 value 6959.29 < min value 7719.58
WARNING: 2027 _STD_1 value 13918.57 < min value 15540.19
WARNING: 2027 _STD_2 value 6959.29 < min value 7719.58
WARNING: 2027 _STD_3 value 10438.92 < min value 11414.35
WARNING: 2027 _STD_4 value 13918.57 < min value 15540.19

You loaded data for 2014.
Tax-Calculator startup automatically extrapolated your data to 2014.
WARNING: Tax-Calculator packages for Python 2.7 will
no longer be provided beginning in 2019
because Pandas is stopping development for 2.7
SOLUTION: upgrade to Python 3.6 now

Response in Charitable Giving by Earnings Group
Earnings Group Num(#M) Resp($B) Resp(%)
[-9e+99, 50000.0) 115.196 0.641 0.59
[50000.0, 9e+99) 59.317 3.478 2.05
ALL 174.513 4.118 1.48
</pre>
9 changes: 9 additions & 0 deletions docs/reformB.json.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<title>reformB.json</title><pre>
// Raise personal exemption and lower standard deduction beginning in 2020.
{
"policy": {
"_II_em": {"2020": [2000]},
"_STD": {"2020": [[6000, 12000, 6000, 9000, 12000]]}
}
}
</pre>

0 comments on commit 64e2e23

Please sign in to comment.