Skip to content

Commit bbac4c7

Browse files
authored
Merge pull request #62 from martinholmer/dataframe
Simplify extraction of non-dump variables from Calculator objects in response function
2 parents e886865 + 9e50714 commit bbac4c7

3 files changed

Lines changed: 52 additions & 29 deletions

File tree

RELEASES.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ Go [here](https://github.com/PSLmodels/Behavioral-Responses/pulls?q=is%3Apr+is%3
44
for a complete commit history.
55

66

7+
2019-05-13 Release 0.8.0
8+
------------------------
9+
(last merged pull request is
10+
[#62](https://github.com/PSLmodels/Behavioral-Responses/pull/62))
11+
12+
**API Changes**
13+
- None
14+
15+
**New Features**
16+
- Simplify extraction of variables from Calculator objects in `response` function
17+
[[#62](https://github.com/PSLmodels/Behavioral-Responses/pull/62)
18+
by Martin Holmer]
19+
20+
**Bug Fixes**
21+
- None
22+
23+
724
2019-03-17 Release 0.7.0
825
------------------------
926
(last merged pull request is

behresp/behavior.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def _mtr12(calc__1, calc__2, mtr_of='e00200p', tax_type='combined'):
218218
df1.drop('mtr_paytax', axis='columns', inplace=True)
219219
df1['mtr_combined'] = wage_mtr1 * 100
220220
else:
221-
df1 = calc1.distribution_table_dataframe()
221+
df1 = calc1.dataframe(tc.DIST_VARIABLES)
222222
del calc1
223223
# Add behavioral-response changes to income sources
224224
calc2_behv = copy.deepcopy(calc2)
@@ -235,7 +235,7 @@ def _mtr12(calc__1, calc__2, mtr_of='e00200p', tax_type='combined'):
235235
df2.drop('mtr_paytax', axis='columns', inplace=True)
236236
df2['mtr_combined'] = wage_mtr2 * 100
237237
else:
238-
df2 = calc2_behv.distribution_table_dataframe()
238+
df2 = calc2_behv.dataframe(tc.DIST_VARIABLES)
239239
del calc2_behv
240240
# Return the two dataframes
241241
return (df1, df2)

docs/index.html

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,26 @@ <h1 id="top">Using Behavioral-Responses</h1>
1616

1717
<p>This document tells you how to use Behavioral-Responses, an
1818
open-source model in the Policy Simulation Library (PSL) collection of
19-
USA tax models. It assumes that you have already read the
20-
<a href="https://github.com/PSLmodels/Behavioral-Responses#behavioral-responses">
21-
documentation introduction</a>. You always use Behavioral-Responses
22-
in conjunction with the latest version of
23-
<a href="https://PSLmodels.github.io/Tax-Calculator/">
19+
USA tax models, the <b>lastest release</b> of which is:
20+
<a href="https://github.com/PSLmodels/Behavioral-Responses/blob/master/RELEASES.md#2019-05-13-release-080"
21+
target="_blank">0.8.0 (2019-05-13)</a>.</p>
22+
23+
<p>This documentation assumes that you have already read the
24+
<a href="https://github.com/PSLmodels/Behavioral-Responses#behavioral-responses"
25+
target="_blank">documentation introduction</a>.
26+
You always use Behavioral-Responses in conjunction with the latest version
27+
of <a href="https://PSLmodels.github.io/Tax-Calculator/" target="_blank">
2428
Tax-Calculator</a>, the static-analysis model in the PSL collection of
2529
USA tax models, by writing and executing a Python program. For an
2630
introduction to writing Python programs using Tax-Calculator, read the
2731
tested recipes in our
28-
<a href="https://PSLmodels.github.io/Tax-Calculator/cookbook.html">
29-
Tax-Calculator cookbook</a>. If you want to participate in the
30-
development of Behavioral-Responses &mdash; by asking a question,
31-
reporting a bug, improving the documentation or making an enhancement
32-
to the Python source code &mdash; you should go to
33-
the <a href="https://github.com/PSLmodels/Behavioral-Responses">
34-
developer website</a>.</p>
32+
<a href="https://PSLmodels.github.io/Tax-Calculator/cookbook.html"
33+
target="_blank">Tax-Calculator cookbook</a>. If you want to
34+
participate in the development of Behavioral-Responses &mdash; by
35+
asking a question, reporting a bug, improving the documentation or
36+
making an enhancement to the Python source code &mdash; you should go
37+
to the <a href="https://github.com/PSLmodels/Behavioral-Responses"
38+
target="_blank">developer website</a>.</p>
3539

3640
<p>Please cite the source of your analysis as <q>Behavioral-Responses
3741
release #.#.#, author's calculations.</q> If you wish to link to
@@ -45,8 +49,8 @@ <h3 id="paramlogic">Response Parameters and Logic</h3>
4549

4650
<p>The Behavioral-Responses elasticity parameters and logic are
4751
described in the
48-
<a href="https://github.com/PSLmodels/Behavioral-Responses/blob/master/behresp/behavior.py">
49-
behavior.py</a> file, where the <kbd>response</kbd> function
52+
<a href="https://github.com/PSLmodels/Behavioral-Responses/blob/master/behresp/behavior.py"
53+
target="_blank">behavior.py</a> file, where the <kbd>response</kbd> function
5054
elasticities are defined in its docstring and the logic of how those
5155
elasticities are used along with Tax-Calculator results is defined in the
5256
higher-level <kbd>response</kbd> function. The lower-level
@@ -56,11 +60,12 @@ <h3 id="paramlogic">Response Parameters and Logic</h3>
5660
<h3 id="pyrecipe">Basic Python Recipe</h3>
5761

5862
<p>A tested recipe for using the Behavioral-Responses parameters and
59-
<kbd>response</kbd> function is contained in recipe 2 of the
60-
<a href="https://PSLmodels.github.io/Tax-Calculator/cookbook.html">
61-
Tax-Calculator cookbook</a> and in the <kbd>test_response_function</kbd> in the
62-
<a href="https://github.com/PSLmodels/Behavioral-Responses/blob/master/behresp/tests/test_behavior.py">
63-
test_behavior.py</a> file.</p>
63+
<kbd>response</kbd> function is contained in Tax-Calculator Python Cookbook
64+
<a href="https://PSLmodels.github.io/Tax-Calculator/cookbook.html#recipe02"
65+
target="_blank">recipe 2</a> and
66+
in the <kbd>test_response_function</kbd> in the
67+
<a href="https://github.com/PSLmodels/Behavioral-Responses/blob/master/behresp/tests/test_behavior.py"
68+
target="_blank">test_behavior.py</a> file.</p>
6469

6570
<p>Notice that when writing a program like this you must import both
6671
the <kbd>taxcalc</kbd> package (to access Tax-Calculator) and
@@ -83,14 +88,15 @@ <h3 id="pyrecipe">Basic Python Recipe</h3>
8388
parameters apply to all filing units. If you want to estimate
8489
responses where the value of the elasticity parameters vary across
8590
(say, earnings) groups, you can use the <kbd>quantity_response</kbd>
86-
function. A recipe for doing this is contained in recipe 4 of the
87-
<a href="https://PSLmodels.github.io/Tax-Calculator/cookbook.html">
88-
Tax-Calculator cookbook</a>. That recipe simply estimates the
89-
responses. But the techniques used in the Behavioral-Responses
90-
<kbd>response</kbd> function can be used to apply the estimated
91-
responses to the post-reform Tax-Calculator object and recompute
92-
tax liabilities, producing tax liability estimates that include the
93-
partial-equilibrium effects of the estimated behavioral responses.
91+
function. A recipe for doing this is contained in
92+
<a href="https://PSLmodels.github.io/Tax-Calculator/cookbook.html#recipe04"
93+
target="_blank">recipe 4</a> of the Tax-Calculator Python Cookbook.
94+
That recipe simply estimates the responses. But the techniques used
95+
in the Behavioral-Responses <kbd>response</kbd> function can be used
96+
to apply the estimated responses to the post-reform Tax-Calculator
97+
object and recompute tax liabilities, producing tax liability
98+
estimates that include the partial-equilibrium effects of the
99+
estimated behavioral responses.</p>
94100

95101
</body>
96102
</html>

0 commit comments

Comments
 (0)