Skip to content

Commit

Permalink
Merge pull request #2592 from jdebacker/recipes
Browse files Browse the repository at this point in the history
Updates to documentation
  • Loading branch information
MattHJensen authored Jun 19, 2021
2 parents dcb0f3c + f03a19c commit 714006b
Show file tree
Hide file tree
Showing 17 changed files with 865 additions and 836 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
- name: Build
shell: bash -l {0}
run: |
pip install -e .
pip install pytest-cov
pip install pytest-pycodestyle
pip install -e . --user
pip install pytest-cov --user
pip install pytest-pycodestyle --user
- name: Test
shell: bash -l {0}
working-directory: ./
Expand Down
2 changes: 2 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ requirements:
- requests
- numba
- "paramtools>=0.18.0"
- behresp
- aiohttp

run:
Expand All @@ -25,6 +26,7 @@ requirements:
- requests
- numba
- "paramtools>=0.18.0"
- behresp
- aiohttp

test:
Expand Down
4 changes: 4 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ html:
use_edit_page_button: true
use_repository_button: true
use_issues_button: true
launch_buttons:
colab_url: "https://colab.research.google.com"
binderhub_url: "https://mybinder.org"
notebook_interface: "classic" # or "jupyterlab"

#######################################################################################
# Advanced and power-user settings
Expand Down
94 changes: 0 additions & 94 deletions docs/about/upgrading.md

This file was deleted.

675 changes: 362 additions & 313 deletions docs/recipes/recipe00.ipynb

Large diffs are not rendered by default.

63 changes: 31 additions & 32 deletions docs/recipes/recipe01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 4,
"metadata": {
"tags": [
"remove-cell"
Expand All @@ -23,21 +23,22 @@
"outputs": [],
"source": [
"# Install conda and taxcalc if in Google Colab.\n",
"# the `&> /dev/null` silences output except for errors\n",
"import sys\n",
"if 'google.colab' in sys.modules and 'taxcalc' not in sys.modules:\n",
" !wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\n",
" !bash Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local\n",
"if 'google.colab' in sys.modules and 'taxbrain' not in sys.modules:\n",
" !wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh &> /dev/null\n",
" !bash Miniconda3-latest-Linux-x86_64.sh -bfp /usr/local &> /dev/null\n",
" # Append path to be able to run packages installed with conda\n",
" # This must correspond to the conda Python version, which may differ from\n",
" # the base Colab Python installation.\n",
" sys.path.append('/usr/local/lib/python3.7/site-packages')\n",
" # Install PSL packages from Anaconda\n",
" !yes | conda install -c PSLmodels taxcalc behresp"
" sys.path.append('/usr/local/lib/python3.8/site-packages')\n",
" # Install taxbrain\n",
" !yes | conda install -c conda-forge taxcalc &> /dev/null"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {
"hide-output": false
},
Expand All @@ -46,8 +47,8 @@
"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.622\n",
"2018_REFORM2_iitax_rev($B)= 1318.628\n",
"\n"
]
}
Expand All @@ -58,13 +59,11 @@
"\n",
"# read an \"old\" reform file\n",
"# (\"old\" means the reform file is defined relative to pre-TCJA policy)\n",
"REFORMS_PATH = '../../taxcalc/reforms/'\n",
"\n",
"# specify reform dictionary for pre-TCJA policy\n",
"reform1 = tc.Policy.read_json_reform(REFORMS_PATH + '2017_law.json')\n",
"reform1 = tc.Policy.read_json_reform('github://PSLmodels:examples@main/psl_examples/taxcalc/2017_law.json')\n",
"\n",
"# specify reform dictionary for TCJA as passed by Congress in late 2017\n",
"reform2 = tc.Policy.read_json_reform(REFORMS_PATH + 'TCJA.json')\n",
"reform2 = tc.Policy.read_json_reform('github://PSLmodels:examples@main/psl_examples/taxcalc/TCJA.json')\n",
"\n",
"# specify Policy object for pre-TCJA policy\n",
"bpolicy = tc.Policy()\n",
Expand Down Expand Up @@ -122,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {
"hide-output": false
},
Expand All @@ -135,22 +134,22 @@
"(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.05 0.00 0.00 0.006 131.3 0.0\n",
"0-10z 0.91 0.00 0.00 0.000 0.0 NaN\n",
"0-10p 15.33 4.86 1.69 -0.655 -42.7 0.4\n",
"10-20 16.29 9.07 1.87 -1.894 -116.3 0.5\n",
"20-30 16.29 8.56 1.62 -3.339 -205.0 0.7\n",
"30-40 16.29 9.70 1.85 -5.138 -315.5 0.8\n",
"40-50 16.29 10.84 1.75 -6.737 -413.6 0.9\n",
"50-60 16.29 10.86 2.05 -8.111 -498.1 0.9\n",
"60-70 16.29 11.94 1.98 -10.640 -653.4 0.9\n",
"70-80 16.29 13.28 1.75 -15.309 -940.0 1.1\n",
"80-90 16.29 13.55 2.24 -22.922 -1407.5 1.2\n",
"90-100 16.29 14.50 1.68 -75.581 -4640.4 1.9\n",
"ALL 162.86 107.16 18.49 -150.319 -923.0 1.3\n",
"90-95 8.14 7.13 0.93 -18.071 -2218.8 1.4\n",
"95-99 6.51 5.95 0.54 -35.267 -5413.7 2.3\n",
"Top 1% 1.63 1.42 0.20 -22.243 -13655.5 2.0\n"
"0-10n 0.106585 0.000000 0.000000 0.000000 0.000000 0.000000\n",
"0-10z 8.200964 0.000000 0.000000 0.000000 0.000000 NaN\n",
"0-10p 11.685544 0.145729 0.017773 -0.010031 -0.858403 0.026886\n",
"10-20 19.993379 6.131286 2.879208 -0.737282 -36.876308 0.307117\n",
"20-30 19.992590 9.819025 2.904122 -1.767789 -88.422187 0.388099\n",
"30-40 19.995314 8.928170 2.495154 -3.420389 -171.059528 0.551945\n",
"40-50 19.993436 10.540007 2.490796 -5.754637 -287.826313 0.746778\n",
"50-60 19.994152 12.663991 2.070555 -8.569910 -428.620835 0.894647\n",
"60-70 19.992890 13.910415 1.784819 -11.604895 -580.451123 0.964668\n",
"70-80 19.994268 15.376689 1.552446 -16.537168 -827.095476 1.080738\n",
"80-90 19.993895 17.040071 1.620336 -26.070610 -1303.928552 1.277742\n",
"90-100 19.993808 18.220631 1.530360 -97.520960 -4877.557973 2.180188\n",
"ALL 199.936825 112.776014 19.345569 -171.993672 -860.240085 1.396031\n",
"90-95 9.996300 9.017015 0.757695 -23.229363 -2323.796032 1.660532\n",
"95-99 7.997983 7.390026 0.586730 -41.609762 -5202.531695 2.400130\n",
"Top 1% 1.999525 1.813590 0.185935 -32.681835 -16344.800972 2.438041\n"
]
}
],
Expand Down Expand Up @@ -184,7 +183,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.8.8"
},
"title": "Recipe 1: Directly Comparing Two Reforms"
},
Expand Down
Loading

0 comments on commit 714006b

Please sign in to comment.