{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Basic Recipe: Static Analysis of a Simple Reform\n",
"\n",
"This is the recipe you should follow first.\n",
"Mastering this recipe is a prerequisite for all the other recipes in this cookbook.\n",
"\n",
"## Imports"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# Install taxcalc if not already installed\n",
"import sys\n",
"if 'taxcalc' not in sys.modules:\n",
" %pip install taxcalc &> /dev/null # dev/null suppresses output"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"import taxcalc as tc\n",
"import pandas as pd\n",
"from bokeh.io import show, output_notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"Use publicly-available CPS input file.\n",
"\n",
"NOTE: if you have access to the restricted-use IRS-SOI PUF-based input file\n",
"and you have that file (named ‘puf.csv’) located in the directory\n",
"where this script is located, then you can substitute the following\n",
"statement for the prior statement:\n",
"\n",
"``\n",
"recs = tc.Records()\n",
"``"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"recs = tc.Records.cps_constructor()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Specify Calculator object for static analysis of current-law policy."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"pol = tc.Policy()\n",
"calc1 = tc.Calculator(policy=pol, records=recs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"NOTE: calc1 now contains a PRIVATE COPY of pol and a PRIVATE COPY of recs,\n",
"so we can continue to use pol and recs in this script without any\n",
"concern about side effects from Calculator method calls on calc1."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"CYR = 2020"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calculate aggregate current-law income tax liabilities for CYR."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"calc1.advance_to_year(CYR)\n",
"calc1.calc_all()\n",
"itax_rev1 = calc1.weighted_total('iitax')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Read JSON reform file and use (the default) static analysis assumptions."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"reform_filename = 'github://PSLmodels:Tax-Calculator@master/docs/recipes/_static/reformA.json'\n",
"params = tc.Calculator.read_json_param_objects(reform_filename, None)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Specify Calculator object for static analysis of reform policy."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"pol.implement_reform(params['policy'])\n",
"calc2 = tc.Calculator(policy=pol, records=recs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Calculate\n",
"\n",
"Calculate reform income tax liabilities for CYR."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"calc2.advance_to_year(CYR)\n",
"calc2.calc_all()\n",
"itax_rev2 = calc2.weighted_total('iitax')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Results\n",
"\n",
"Print total revenue estimates for 2018.\n",
"\n",
"*Estimates in billons of dollars rounded to nearest hundredth of a billion.*"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"hide-output": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2020_CLP_itax_rev($B)= 764.170\n",
"2020_REF_itax_rev($B)= 766.855\n"
]
}
],
"source": [
"print('{}_CLP_itax_rev($B)= {:.3f}'.format(CYR, itax_rev1 * 1e-9))\n",
"print('{}_REF_itax_rev($B)= {:.3f}'.format(CYR, itax_rev2 * 1e-9))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Generate several other standard results tables."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"hide-output": false
},
"outputs": [],
"source": [
"# Aggregate diagnostic tables for CYR.\n",
"clp_diagnostic_table = calc1.diagnostic_table(1)\n",
"ref_diagnostic_table = calc2.diagnostic_table(1)\n",
"\n",
"# Income-tax distribution for CYR with CLP and REF results side-by-side.\n",
"dist_table1, dist_table2 = calc1.distribution_tables(calc2, 'weighted_deciles')\n",
"assert isinstance(dist_table1, pd.DataFrame)\n",
"assert isinstance(dist_table2, pd.DataFrame)\n",
"dist_extract = pd.DataFrame()\n",
"dist_extract['funits(#m)'] = dist_table1['count']\n",
"dist_extract['itax1($b)'] = dist_table1['iitax']\n",
"dist_extract['itax2($b)'] = dist_table2['iitax']\n",
"dist_extract['aftertax_inc1($b)'] = dist_table1['aftertax_income']\n",
"dist_extract['aftertax_inc2($b)'] = dist_table2['aftertax_income']\n",
"\n",
"# Income-tax difference table by expanded-income decile for CYR.\n",
"diff_table = calc1.difference_table(calc2, 'weighted_deciles', 'iitax')\n",
"assert isinstance(diff_table, pd.DataFrame)\n",
"diff_extract = pd.DataFrame()\n",
"dif_colnames = ['count', 'tot_change', 'mean', 'pc_aftertaxinc']\n",
"ext_colnames = ['funits(#m)', 'agg_diff($b)', 'mean_diff($)', 'aftertaxinc_diff(%)']\n",
"for dname, ename in zip(dif_colnames, ext_colnames):\n",
" diff_extract[ename] = diff_table[dname]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plotting\n",
"\n",
"Generate a decile graph and display it using Bokeh (will render in Jupyter, not in webpage)."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"hide-output": false
},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"
\n",
"
Loading BokehJS ...\n",
"
\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n\n if (typeof root._bokeh_onload_callbacks === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\nconst JS_MIME_TYPE = 'application/javascript';\n const HTML_MIME_TYPE = 'text/html';\n const EXEC_MIME_TYPE = 'application/vnd.bokehjs_exec.v0+json';\n const CLASS_NAME = 'output_bokeh rendered_html';\n\n /**\n * Render data to the DOM node\n */\n function render(props, node) {\n const script = document.createElement(\"script\");\n node.appendChild(script);\n }\n\n /**\n * Handle when an output is cleared or removed\n */\n function handleClearOutput(event, handle) {\n const cell = handle.cell;\n\n const id = cell.output_area._bokeh_element_id;\n const server_id = cell.output_area._bokeh_server_id;\n // Clean up Bokeh references\n if (id != null && id in Bokeh.index) {\n Bokeh.index[id].model.document.clear();\n delete Bokeh.index[id];\n }\n\n if (server_id !== undefined) {\n // Clean up Bokeh references\n const cmd_clean = \"from bokeh.io.state import curstate; print(curstate().uuid_to_server['\" + server_id + \"'].get_sessions()[0].document.roots[0]._id)\";\n cell.notebook.kernel.execute(cmd_clean, {\n iopub: {\n output: function(msg) {\n const id = msg.content.text.trim();\n if (id in Bokeh.index) {\n Bokeh.index[id].model.document.clear();\n delete Bokeh.index[id];\n }\n }\n }\n });\n // Destroy server and session\n const cmd_destroy = \"import bokeh.io.notebook as ion; ion.destroy_server('\" + server_id + \"')\";\n cell.notebook.kernel.execute(cmd_destroy);\n }\n }\n\n /**\n * Handle when a new output is added\n */\n function handleAddOutput(event, handle) {\n const output_area = handle.output_area;\n const output = handle.output;\n\n // limit handleAddOutput to display_data with EXEC_MIME_TYPE content only\n if ((output.output_type != \"display_data\") || (!Object.prototype.hasOwnProperty.call(output.data, EXEC_MIME_TYPE))) {\n return\n }\n\n const toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n\n if (output.metadata[EXEC_MIME_TYPE][\"id\"] !== undefined) {\n toinsert[toinsert.length - 1].firstChild.textContent = output.data[JS_MIME_TYPE];\n // store reference to embed id on output_area\n output_area._bokeh_element_id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n }\n if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n const bk_div = document.createElement(\"div\");\n bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n const script_attrs = bk_div.children[0].attributes;\n for (let i = 0; i < script_attrs.length; i++) {\n toinsert[toinsert.length - 1].firstChild.setAttribute(script_attrs[i].name, script_attrs[i].value);\n toinsert[toinsert.length - 1].firstChild.textContent = bk_div.children[0].textContent\n }\n // store reference to server id on output_area\n output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n }\n }\n\n function register_renderer(events, OutputArea) {\n\n function append_mime(data, metadata, element) {\n // create a DOM node to render to\n const toinsert = this.create_output_subarea(\n metadata,\n CLASS_NAME,\n EXEC_MIME_TYPE\n );\n this.keyboard_manager.register_events(toinsert);\n // Render to node\n const props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n render(props, toinsert[toinsert.length - 1]);\n element.append(toinsert);\n return toinsert\n }\n\n /* Handle when an output is cleared or removed */\n events.on('clear_output.CodeCell', handleClearOutput);\n events.on('delete.Cell', handleClearOutput);\n\n /* Handle when a new output is added */\n events.on('output_added.OutputArea', handleAddOutput);\n\n /**\n * Register the mime type and append_mime function with output_area\n */\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n /* Is output safe? */\n safe: true,\n /* Index of renderer in `output_area.display_order` */\n index: 0\n });\n }\n\n // register the mime type if in Jupyter Notebook environment and previously unregistered\n if (root.Jupyter !== undefined) {\n const events = require('base/js/events');\n const OutputArea = require('notebook/js/outputarea').OutputArea;\n\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n }\n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n const NB_LOAD_WARNING = {'data': {'text/html':\n \"\\n\"+\n \"
\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"- re-rerun `output_notebook()` to attempt to load from CDN again, or
\\n\"+\n \"- use INLINE resources instead, as so:
\\n\"+\n \"
\\n\"+\n \"
\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"
\\n\"+\n \"
\"}};\n\n function display_loaded() {\n const el = document.getElementById(\"1055\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = css_urls.length + js_urls.length;\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n\n function on_error(url) {\n console.error(\"failed to load \" + url);\n }\n\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n }\n\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error.bind(null, url);\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-2.4.3.min.js\"];\n const css_urls = [];\n\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {\n }\n ];\n\n function run_inline_js() {\n if (root.Bokeh !== undefined || force === true) {\n for (let i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }\nif (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n const cell = $(document.getElementById(\"1055\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n }\n\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(css_urls, js_urls, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));",
"application/vnd.bokehjs_load.v0+json": ""
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
" \n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/javascript": "(function(root) {\n function embed_document(root) {\n const docs_json = {\"b4e7db24-33d9-48db-a78f-613a20b224ed\":{\"defs\":[],\"roots\":{\"references\":[{\"attributes\":{\"below\":[{\"id\":\"1013\"}],\"center\":[{\"id\":\"1016\"},{\"id\":\"1020\"}],\"height\":500,\"left\":[{\"id\":\"1017\"}],\"renderers\":[{\"id\":\"1039\"},{\"id\":\"1045\"},{\"id\":\"1051\"}],\"title\":{\"id\":\"1003\"},\"toolbar\":{\"id\":\"1028\"},\"width\":850,\"x_range\":{\"id\":\"1005\"},\"x_scale\":{\"id\":\"1009\"},\"y_range\":{\"id\":\"1007\"},\"y_scale\":{\"id\":\"1011\"}},\"id\":\"1002\",\"subtype\":\"Figure\",\"type\":\"Plot\"},{\"attributes\":{},\"id\":\"1024\",\"type\":\"SaveTool\"},{\"attributes\":{\"axis\":{\"id\":\"1013\"},\"coordinates\":null,\"group\":null,\"ticker\":null},\"id\":\"1016\",\"type\":\"Grid\"},{\"attributes\":{\"source\":{\"id\":\"1047\"}},\"id\":\"1052\",\"type\":\"CDSView\"},{\"attributes\":{\"overlay\":{\"id\":\"1027\"}},\"id\":\"1023\",\"type\":\"BoxZoomTool\"},{\"attributes\":{},\"id\":\"1009\",\"type\":\"LinearScale\"},{\"attributes\":{},\"id\":\"1014\",\"type\":\"BasicTicker\"},{\"attributes\":{},\"id\":\"1066\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"source\":{\"id\":\"1041\"}},\"id\":\"1046\",\"type\":\"CDSView\"},{\"attributes\":{\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1048\",\"type\":\"Line\"},{\"attributes\":{\"axis\":{\"id\":\"1017\"},\"coordinates\":null,\"dimension\":1,\"group\":null,\"ticker\":null},\"id\":\"1020\",\"type\":\"Grid\"},{\"attributes\":{},\"id\":\"1060\",\"type\":\"BasicTickFormatter\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.2},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.2},\"line_alpha\":{\"value\":0.2},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"1044\",\"type\":\"Circle\"},{\"attributes\":{\"line_alpha\":0.1,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1049\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1058\",\"type\":\"AllLabels\"},{\"attributes\":{\"line_alpha\":0.2,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1050\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1063\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1025\",\"type\":\"ResetTool\"},{\"attributes\":{\"tools\":[{\"id\":\"1021\"},{\"id\":\"1022\"},{\"id\":\"1023\"},{\"id\":\"1024\"},{\"id\":\"1025\"},{\"id\":\"1026\"}]},\"id\":\"1028\",\"type\":\"Toolbar\"},{\"attributes\":{\"data\":{\"x\":[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99],\"y\":{\"__ndarray__\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC7pAUaHxB0/nKHNERleVD/aBfTa5GK5P0zVkWhx9Mo/MyzH8YQWzD+pINmUkOTMP3OFqn2Lms0/8iIBCWq5zT9f49UIBzzMP06jPnzVuco/sfpwiWyyyj/cE/Pit0DIP4vjF9+tRMY/kk6lUKONxj9ZJ3Qv7GPIP/ywLEChx8c/uODkTw+Pwz//QpOmUxbHP+XSbuRmcsc/Yp1E8a8pwz/oPImT0KvFPxd9SDHizcY/vikqmuJdxT/4hylo1YvEP5Y1FnRwa8k/5e2syIN+xD/EzeGu4orJPxuGg09wIMU/rJm32UV5xj+PMOMRN+jGP3grYWRFv8Y/bX4Rdzn/xT9ZKtV4GxfHPzt7leYNTMs/XIVwz8fUyz9QPgO7qOfIPyqUsGwcrco/sAJAhxqPyT9kd/bygD3KP1TD+k2huM4/s6CWjY/Syj+BGQbOkyjMP8FmY0BjSc0/MMluZ0Vpzz9dkUVK2PzQP9E+WDIaQ88/mGf4APw+0D+Q2p3dchfQPyYJamTK6tA/LU7i+eGLzj9/DTFYturPP5SyL35DVdA/nSfrgGr4zz8FGxAeEujPP9nJc7aGLdA/bkbBxEHg0D9WlqbgMDTQP9QitksiYdA/fJg9erjT0D+WnxAqc4fQP6gDqOTq6s8/XstJZQWc0D9yFUr7DbXQP4Ys1hLqMtA/WPgvsM3J0D/PinNa9L3PP72HEQlkjM8/xb6Fgr3Dzz/MWdGtJUjQP4AIGIUljdI/HCzGFTn+1D8CkKaBv1/VPyhwUjJ6FNU/ZARpdk+O1T+PskAqb2jVPwVodjLZztU/goIrFgTq1D/6Vb29u4PUP1iFtqAKbtQ/QSPAM0z80z9oEEwZCNPSP0Gi0h0sStE/cZXjQS5gzj++dActio/GPw9LdrOlN7o/lacgTUsLor+sBLR9Caf7vw==\",\"dtype\":\"float64\",\"order\":\"little\",\"shape\":[95]}},\"selected\":{\"id\":\"1063\"},\"selection_policy\":{\"id\":\"1062\"}},\"id\":\"1035\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"fill_alpha\":{\"value\":0.1},\"fill_color\":{\"value\":\"#1f77b4\"},\"hatch_alpha\":{\"value\":0.1},\"line_alpha\":{\"value\":0.1},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"1043\",\"type\":\"Circle\"},{\"attributes\":{\"bottom_units\":\"screen\",\"coordinates\":null,\"fill_alpha\":0.5,\"fill_color\":\"lightgrey\",\"group\":null,\"left_units\":\"screen\",\"level\":\"overlay\",\"line_alpha\":1.0,\"line_color\":\"black\",\"line_dash\":[4,4],\"line_width\":2,\"right_units\":\"screen\",\"syncable\":false,\"top_units\":\"screen\"},\"id\":\"1027\",\"type\":\"BoxAnnotation\"},{\"attributes\":{\"line_alpha\":0.1,\"line_color\":\"blue\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1037\",\"type\":\"Line\"},{\"attributes\":{\"line_color\":\"blue\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1036\",\"type\":\"Line\"},{\"attributes\":{\"data\":{},\"selected\":{\"id\":\"1065\"},\"selection_policy\":{\"id\":\"1064\"}},\"id\":\"1041\",\"type\":\"ColumnDataSource\"},{\"attributes\":{},\"id\":\"1026\",\"type\":\"HelpTool\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1035\"},\"glyph\":{\"id\":\"1036\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1038\"},\"nonselection_glyph\":{\"id\":\"1037\"},\"view\":{\"id\":\"1040\"}},\"id\":\"1039\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"fill_color\":{\"value\":\"#1f77b4\"},\"line_color\":{\"value\":\"#1f77b4\"},\"x\":{\"value\":0},\"y\":{\"value\":0}},\"id\":\"1042\",\"type\":\"Circle\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1047\"},\"glyph\":{\"id\":\"1048\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1050\"},\"nonselection_glyph\":{\"id\":\"1049\"},\"view\":{\"id\":\"1052\"}},\"id\":\"1051\",\"type\":\"GlyphRenderer\"},{\"attributes\":{},\"id\":\"1021\",\"type\":\"PanTool\"},{\"attributes\":{},\"id\":\"1018\",\"type\":\"BasicTicker\"},{\"attributes\":{\"format\":\"%+.1f%%\"},\"id\":\"1053\",\"type\":\"PrintfTickFormatter\"},{\"attributes\":{\"coordinates\":null,\"data_source\":{\"id\":\"1041\"},\"glyph\":{\"id\":\"1042\"},\"group\":null,\"hover_glyph\":null,\"muted_glyph\":{\"id\":\"1044\"},\"nonselection_glyph\":{\"id\":\"1043\"},\"view\":{\"id\":\"1046\"},\"visible\":false},\"id\":\"1045\",\"type\":\"GlyphRenderer\"},{\"attributes\":{\"axis_label\":\"Change in After-Tax Expanded Income\",\"axis_label_text_font_size\":\"12pt\",\"axis_label_text_font_style\":\"normal\",\"coordinates\":null,\"formatter\":{\"id\":\"1053\"},\"group\":null,\"major_label_policy\":{\"id\":\"1058\"},\"ticker\":{\"id\":\"1018\"}},\"id\":\"1017\",\"type\":\"LinearAxis\"},{\"attributes\":{\"axis_label\":\"Baseline Expanded-Income Percentile\",\"axis_label_text_font_size\":\"12pt\",\"axis_label_text_font_style\":\"normal\",\"coordinates\":null,\"formatter\":{\"id\":\"1060\"},\"group\":null,\"major_label_policy\":{\"id\":\"1061\"},\"ticker\":{\"id\":\"1014\"}},\"id\":\"1013\",\"type\":\"LinearAxis\"},{\"attributes\":{},\"id\":\"1007\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1065\",\"type\":\"Selection\"},{\"attributes\":{},\"id\":\"1005\",\"type\":\"DataRange1d\"},{\"attributes\":{},\"id\":\"1061\",\"type\":\"AllLabels\"},{\"attributes\":{},\"id\":\"1022\",\"type\":\"WheelZoomTool\"},{\"attributes\":{},\"id\":\"1067\",\"type\":\"Selection\"},{\"attributes\":{\"source\":{\"id\":\"1035\"}},\"id\":\"1040\",\"type\":\"CDSView\"},{\"attributes\":{},\"id\":\"1011\",\"type\":\"LinearScale\"},{\"attributes\":{\"line_alpha\":0.2,\"line_color\":\"blue\",\"line_width\":3,\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}},\"id\":\"1038\",\"type\":\"Line\"},{\"attributes\":{},\"id\":\"1064\",\"type\":\"UnionRenderers\"},{\"attributes\":{\"data\":{\"x\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100],\"y\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},\"selected\":{\"id\":\"1067\"},\"selection_policy\":{\"id\":\"1066\"}},\"id\":\"1047\",\"type\":\"ColumnDataSource\"},{\"attributes\":{\"coordinates\":null,\"group\":null,\"text\":\"Percentage Change in After-Tax Expanded Income by Income Percentile for 2020\",\"text_font_size\":\"12pt\"},\"id\":\"1003\",\"type\":\"Title\"},{\"attributes\":{},\"id\":\"1062\",\"type\":\"UnionRenderers\"}],\"root_ids\":[\"1002\"]},\"title\":\"Bokeh Application\",\"version\":\"2.4.3\"}};\n const render_items = [{\"docid\":\"b4e7db24-33d9-48db-a78f-613a20b224ed\",\"root_ids\":[\"1002\"],\"roots\":{\"1002\":\"8ecf2c89-2d75-43f2-8d5a-e5caa0f4c91c\"}}];\n root.Bokeh.embed.embed_items_notebook(docs_json, render_items);\n }\n if (root.Bokeh !== undefined) {\n embed_document(root);\n } else {\n let attempts = 0;\n const timer = setInterval(function(root) {\n if (root.Bokeh !== undefined) {\n clearInterval(timer);\n embed_document(root);\n } else {\n attempts++;\n if (attempts > 100) {\n clearInterval(timer);\n console.log(\"Bokeh: ERROR: Unable to run BokehJS code because BokehJS library is missing\");\n }\n }\n }, 10, root)\n }\n})(window);",
"application/vnd.bokehjs_exec.v0+json": ""
},
"metadata": {
"application/vnd.bokehjs_exec.v0+json": {
"id": "1002"
}
},
"output_type": "display_data"
}
],
"source": [
"fig = calc1.pch_graph(calc2)\n",
"output_notebook()\n",
"show(fig)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Print tables\n",
"\n",
"CLP diagnostic table for CYR."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"hide-output": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" 2020 | \n",
"
\n",
" \n",
" \n",
" \n",
" Returns (#m) | \n",
" 204.480 | \n",
"
\n",
" \n",
" AGI ($b) | \n",
" 11573.238 | \n",
"
\n",
" \n",
" Itemizers (#m) | \n",
" 27.730 | \n",
"
\n",
" \n",
" Itemized Deduction ($b) | \n",
" 752.189 | \n",
"
\n",
" \n",
" Standard Deduction Filers (#m) | \n",
" 176.750 | \n",
"
\n",
" \n",
" Standard Deduction ($b) | \n",
" 3075.468 | \n",
"
\n",
" \n",
" Personal Exemption ($b) | \n",
" 0.000 | \n",
"
\n",
" \n",
" Taxable Income ($b) | \n",
" 8617.397 | \n",
"
\n",
" \n",
" Regular Tax ($b) | \n",
" 1505.274 | \n",
"
\n",
" \n",
" AMT Income ($b) | \n",
" 11012.668 | \n",
"
\n",
" \n",
" AMT Liability ($b) | \n",
" 0.568 | \n",
"
\n",
" \n",
" AMT Filers (#m) | \n",
" 0.090 | \n",
"
\n",
" \n",
" Tax before Credits ($b) | \n",
" 1505.841 | \n",
"
\n",
" \n",
" Refundable Credits ($b) | \n",
" 654.861 | \n",
"
\n",
" \n",
" Nonrefundable Credits ($b) | \n",
" 99.385 | \n",
"
\n",
" \n",
" Reform Surtaxes ($b) | \n",
" 0.000 | \n",
"
\n",
" \n",
" Other Taxes ($b) | \n",
" 12.575 | \n",
"
\n",
" \n",
" Ind Income Tax ($b) | \n",
" 764.170 | \n",
"
\n",
" \n",
" Payroll Taxes ($b) | \n",
" 1217.941 | \n",
"
\n",
" \n",
" Combined Liability ($b) | \n",
" 1982.111 | \n",
"
\n",
" \n",
" With Income Tax <= 0 (#m) | \n",
" 135.170 | \n",
"
\n",
" \n",
" With Combined Tax <= 0 (#m) | \n",
" 98.150 | \n",
"
\n",
" \n",
" UBI Benefits ($b) | \n",
" 0.000 | \n",
"
\n",
" \n",
" Total Benefits, Consumption Value ($b) | \n",
" 3617.042 | \n",
"
\n",
" \n",
" Total Benefits Cost ($b) | \n",
" 3617.042 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" 2020\n",
"Returns (#m) 204.480\n",
"AGI ($b) 11573.238\n",
"Itemizers (#m) 27.730\n",
"Itemized Deduction ($b) 752.189\n",
"Standard Deduction Filers (#m) 176.750\n",
"Standard Deduction ($b) 3075.468\n",
"Personal Exemption ($b) 0.000\n",
"Taxable Income ($b) 8617.397\n",
"Regular Tax ($b) 1505.274\n",
"AMT Income ($b) 11012.668\n",
"AMT Liability ($b) 0.568\n",
"AMT Filers (#m) 0.090\n",
"Tax before Credits ($b) 1505.841\n",
"Refundable Credits ($b) 654.861\n",
"Nonrefundable Credits ($b) 99.385\n",
"Reform Surtaxes ($b) 0.000\n",
"Other Taxes ($b) 12.575\n",
"Ind Income Tax ($b) 764.170\n",
"Payroll Taxes ($b) 1217.941\n",
"Combined Liability ($b) 1982.111\n",
"With Income Tax <= 0 (#m) 135.170\n",
"With Combined Tax <= 0 (#m) 98.150\n",
"UBI Benefits ($b) 0.000\n",
"Total Benefits, Consumption Value ($b) 3617.042\n",
"Total Benefits Cost ($b) 3617.042"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"clp_diagnostic_table"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"REF diagnostic table for CYR."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"hide-output": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" 2020 | \n",
"
\n",
" \n",
" \n",
" \n",
" Returns (#m) | \n",
" 204.480 | \n",
"
\n",
" \n",
" AGI ($b) | \n",
" 11573.238 | \n",
"
\n",
" \n",
" Itemizers (#m) | \n",
" 27.660 | \n",
"
\n",
" \n",
" Itemized Deduction ($b) | \n",
" 749.755 | \n",
"
\n",
" \n",
" Standard Deduction Filers (#m) | \n",
" 176.820 | \n",
"
\n",
" \n",
" Standard Deduction ($b) | \n",
" 3076.756 | \n",
"
\n",
" \n",
" Personal Exemption ($b) | \n",
" 375.177 | \n",
"
\n",
" \n",
" Taxable Income ($b) | \n",
" 8369.678 | \n",
"
\n",
" \n",
" Regular Tax ($b) | \n",
" 1505.595 | \n",
"
\n",
" \n",
" AMT Income ($b) | \n",
" 11014.938 | \n",
"
\n",
" \n",
" AMT Liability ($b) | \n",
" 0.585 | \n",
"
\n",
" \n",
" AMT Filers (#m) | \n",
" 0.090 | \n",
"
\n",
" \n",
" Tax before Credits ($b) | \n",
" 1506.180 | \n",
"
\n",
" \n",
" Refundable Credits ($b) | \n",
" 658.196 | \n",
"
\n",
" \n",
" Nonrefundable Credits ($b) | \n",
" 93.705 | \n",
"
\n",
" \n",
" Reform Surtaxes ($b) | \n",
" 0.000 | \n",
"
\n",
" \n",
" Other Taxes ($b) | \n",
" 12.575 | \n",
"
\n",
" \n",
" Ind Income Tax ($b) | \n",
" 766.855 | \n",
"
\n",
" \n",
" Payroll Taxes ($b) | \n",
" 1217.941 | \n",
"
\n",
" \n",
" Combined Liability ($b) | \n",
" 1984.796 | \n",
"
\n",
" \n",
" With Income Tax <= 0 (#m) | \n",
" 137.340 | \n",
"
\n",
" \n",
" With Combined Tax <= 0 (#m) | \n",
" 98.910 | \n",
"
\n",
" \n",
" UBI Benefits ($b) | \n",
" 0.000 | \n",
"
\n",
" \n",
" Total Benefits, Consumption Value ($b) | \n",
" 3617.042 | \n",
"
\n",
" \n",
" Total Benefits Cost ($b) | \n",
" 3617.042 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" 2020\n",
"Returns (#m) 204.480\n",
"AGI ($b) 11573.238\n",
"Itemizers (#m) 27.660\n",
"Itemized Deduction ($b) 749.755\n",
"Standard Deduction Filers (#m) 176.820\n",
"Standard Deduction ($b) 3076.756\n",
"Personal Exemption ($b) 375.177\n",
"Taxable Income ($b) 8369.678\n",
"Regular Tax ($b) 1505.595\n",
"AMT Income ($b) 11014.938\n",
"AMT Liability ($b) 0.585\n",
"AMT Filers (#m) 0.090\n",
"Tax before Credits ($b) 1506.180\n",
"Refundable Credits ($b) 658.196\n",
"Nonrefundable Credits ($b) 93.705\n",
"Reform Surtaxes ($b) 0.000\n",
"Other Taxes ($b) 12.575\n",
"Ind Income Tax ($b) 766.855\n",
"Payroll Taxes ($b) 1217.941\n",
"Combined Liability ($b) 1984.796\n",
"With Income Tax <= 0 (#m) 137.340\n",
"With Combined Tax <= 0 (#m) 98.910\n",
"UBI Benefits ($b) 0.000\n",
"Total Benefits, Consumption Value ($b) 3617.042\n",
"Total Benefits Cost ($b) 3617.042"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ref_diagnostic_table"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Extract of CYR distribution tables by baseline expanded-income decile."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"hide-output": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" funits(#m) | \n",
" itax1($b) | \n",
" itax2($b) | \n",
" aftertax_inc1($b) | \n",
" aftertax_inc2($b) | \n",
"
\n",
" \n",
" \n",
" \n",
" 0-10n | \n",
" 0.103662 | \n",
" -0.292423 | \n",
" -0.292423 | \n",
" -6.364313 | \n",
" -6.364313 | \n",
"
\n",
" \n",
" 0-10z | \n",
" 8.289516 | \n",
" -17.339037 | \n",
" -17.339037 | \n",
" 17.339037 | \n",
" 17.339037 | \n",
"
\n",
" \n",
" 0-10p | \n",
" 12.054710 | \n",
" -25.583473 | \n",
" -25.583473 | \n",
" 66.416417 | \n",
" 66.416417 | \n",
"
\n",
" \n",
" 10-20 | \n",
" 20.448902 | \n",
" -52.554387 | \n",
" -52.900799 | \n",
" 308.444021 | \n",
" 308.790433 | \n",
"
\n",
" \n",
" 20-30 | \n",
" 20.447972 | \n",
" -53.636240 | \n",
" -54.653772 | \n",
" 542.850180 | \n",
" 543.867712 | \n",
"
\n",
" \n",
" 30-40 | \n",
" 20.448551 | \n",
" -46.759061 | \n",
" -48.021038 | \n",
" 718.059905 | \n",
" 719.321882 | \n",
"
\n",
" \n",
" 40-50 | \n",
" 20.448614 | \n",
" -44.573176 | \n",
" -46.294368 | \n",
" 888.228515 | \n",
" 889.949708 | \n",
"
\n",
" \n",
" 50-60 | \n",
" 20.448520 | \n",
" -39.736886 | \n",
" -42.405082 | \n",
" 1100.805232 | \n",
" 1103.473428 | \n",
"
\n",
" \n",
" 60-70 | \n",
" 20.448182 | \n",
" -30.590266 | \n",
" -34.290827 | \n",
" 1381.854900 | \n",
" 1385.555461 | \n",
"
\n",
" \n",
" 70-80 | \n",
" 20.448218 | \n",
" 2.337068 | \n",
" -2.517134 | \n",
" 1742.953419 | \n",
" 1747.807621 | \n",
"
\n",
" \n",
" 80-90 | \n",
" 20.447460 | \n",
" 85.024868 | \n",
" 76.807708 | \n",
" 2292.728158 | \n",
" 2300.945318 | \n",
"
\n",
" \n",
" 90-100 | \n",
" 20.449858 | \n",
" 987.873311 | \n",
" 1014.344944 | \n",
" 4737.770572 | \n",
" 4711.298939 | \n",
"
\n",
" \n",
" ALL | \n",
" 204.484164 | \n",
" 764.170298 | \n",
" 766.854698 | \n",
" 13791.086043 | \n",
" 13788.401642 | \n",
"
\n",
" \n",
" 90-95 | \n",
" 10.225611 | \n",
" 142.001368 | \n",
" 136.439568 | \n",
" 1532.001747 | \n",
" 1537.563546 | \n",
"
\n",
" \n",
" 95-99 | \n",
" 8.177219 | \n",
" 322.467707 | \n",
" 320.116774 | \n",
" 1821.899805 | \n",
" 1824.250737 | \n",
"
\n",
" \n",
" Top 1% | \n",
" 2.047027 | \n",
" 523.404237 | \n",
" 557.788601 | \n",
" 1383.869020 | \n",
" 1349.484656 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" funits(#m) itax1($b) itax2($b) aftertax_inc1($b) \\\n",
"0-10n 0.103662 -0.292423 -0.292423 -6.364313 \n",
"0-10z 8.289516 -17.339037 -17.339037 17.339037 \n",
"0-10p 12.054710 -25.583473 -25.583473 66.416417 \n",
"10-20 20.448902 -52.554387 -52.900799 308.444021 \n",
"20-30 20.447972 -53.636240 -54.653772 542.850180 \n",
"30-40 20.448551 -46.759061 -48.021038 718.059905 \n",
"40-50 20.448614 -44.573176 -46.294368 888.228515 \n",
"50-60 20.448520 -39.736886 -42.405082 1100.805232 \n",
"60-70 20.448182 -30.590266 -34.290827 1381.854900 \n",
"70-80 20.448218 2.337068 -2.517134 1742.953419 \n",
"80-90 20.447460 85.024868 76.807708 2292.728158 \n",
"90-100 20.449858 987.873311 1014.344944 4737.770572 \n",
"ALL 204.484164 764.170298 766.854698 13791.086043 \n",
"90-95 10.225611 142.001368 136.439568 1532.001747 \n",
"95-99 8.177219 322.467707 320.116774 1821.899805 \n",
"Top 1% 2.047027 523.404237 557.788601 1383.869020 \n",
"\n",
" aftertax_inc2($b) \n",
"0-10n -6.364313 \n",
"0-10z 17.339037 \n",
"0-10p 66.416417 \n",
"10-20 308.790433 \n",
"20-30 543.867712 \n",
"30-40 719.321882 \n",
"40-50 889.949708 \n",
"50-60 1103.473428 \n",
"60-70 1385.555461 \n",
"70-80 1747.807621 \n",
"80-90 2300.945318 \n",
"90-100 4711.298939 \n",
"ALL 13788.401642 \n",
"90-95 1537.563546 \n",
"95-99 1824.250737 \n",
"Top 1% 1349.484656 "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dist_extract"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Extract of CYR income-tax difference table by expanded-income decile."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"hide-output": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" funits(#m) | \n",
" agg_diff($b) | \n",
" mean_diff($) | \n",
" aftertaxinc_diff(%) | \n",
"
\n",
" \n",
" \n",
" \n",
" 0-10n | \n",
" 0.103662 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" 0-10z | \n",
" 8.289516 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" 0-10p | \n",
" 12.054710 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" 10-20 | \n",
" 20.448902 | \n",
" -0.346412 | \n",
" -16.940394 | \n",
" 0.112310 | \n",
"
\n",
" \n",
" 20-30 | \n",
" 20.447972 | \n",
" -1.017532 | \n",
" -49.762006 | \n",
" 0.187443 | \n",
"
\n",
" \n",
" 30-40 | \n",
" 20.448551 | \n",
" -1.261977 | \n",
" -61.714742 | \n",
" 0.175748 | \n",
"
\n",
" \n",
" 40-50 | \n",
" 20.448614 | \n",
" -1.721193 | \n",
" -84.171605 | \n",
" 0.193778 | \n",
"
\n",
" \n",
" 50-60 | \n",
" 20.448520 | \n",
" -2.668196 | \n",
" -130.483583 | \n",
" 0.242386 | \n",
"
\n",
" \n",
" 60-70 | \n",
" 20.448182 | \n",
" -3.700560 | \n",
" -180.972592 | \n",
" 0.267797 | \n",
"
\n",
" \n",
" 70-80 | \n",
" 20.448218 | \n",
" -4.854202 | \n",
" -237.389972 | \n",
" 0.278504 | \n",
"
\n",
" \n",
" 80-90 | \n",
" 20.447460 | \n",
" -8.217160 | \n",
" -401.867019 | \n",
" 0.358401 | \n",
"
\n",
" \n",
" 90-100 | \n",
" 20.449858 | \n",
" 26.471633 | \n",
" 1294.465375 | \n",
" -0.558736 | \n",
"
\n",
" \n",
" ALL | \n",
" 204.484164 | \n",
" 2.684400 | \n",
" 13.127667 | \n",
" -0.019465 | \n",
"
\n",
" \n",
" 90-95 | \n",
" 10.225611 | \n",
" -5.561800 | \n",
" -543.908766 | \n",
" 0.363041 | \n",
"
\n",
" \n",
" 95-99 | \n",
" 8.177219 | \n",
" -2.350932 | \n",
" -287.497784 | \n",
" 0.129037 | \n",
"
\n",
" \n",
" Top 1% | \n",
" 2.047027 | \n",
" 34.384364 | \n",
" 16797.217391 | \n",
" -2.484655 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" funits(#m) agg_diff($b) mean_diff($) aftertaxinc_diff(%)\n",
"0-10n 0.103662 0.000000 0.000000 0.000000\n",
"0-10z 8.289516 0.000000 0.000000 0.000000\n",
"0-10p 12.054710 0.000000 0.000000 0.000000\n",
"10-20 20.448902 -0.346412 -16.940394 0.112310\n",
"20-30 20.447972 -1.017532 -49.762006 0.187443\n",
"30-40 20.448551 -1.261977 -61.714742 0.175748\n",
"40-50 20.448614 -1.721193 -84.171605 0.193778\n",
"50-60 20.448520 -2.668196 -130.483583 0.242386\n",
"60-70 20.448182 -3.700560 -180.972592 0.267797\n",
"70-80 20.448218 -4.854202 -237.389972 0.278504\n",
"80-90 20.447460 -8.217160 -401.867019 0.358401\n",
"90-100 20.449858 26.471633 1294.465375 -0.558736\n",
"ALL 204.484164 2.684400 13.127667 -0.019465\n",
"90-95 10.225611 -5.561800 -543.908766 0.363041\n",
"95-99 8.177219 -2.350932 -287.497784 0.129037\n",
"Top 1% 2.047027 34.384364 16797.217391 -2.484655"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"diff_extract"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Tags",
"date": 1592702193.2055042,
"download_nb": false,
"filename": "recipe00.rst",
"filename_with_path": "recipe00",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
},
"title": "Basic Recipe: Static Analysis of a Simple Reform"
},
"nbformat": 4,
"nbformat_minor": 4
}