Args: baseline (bool): `True` if baseline tax policy calculator_start_year (integer): first year of budget window
+ baseline_policy (dictionary): IIT baseline parameters reform (dictionary): IIT reform parameters data (string or Pandas DataFrame): path to file or DataFrame for Tax-Calculator Records object (optional)
@@ -430,10 +432,14 @@
Source code for ccc.get_taxcalc_rates
records1=Records()# pragma: no coverifbaseline:
- # Should not be a reform if baseline is True
- assertnotreform
+ if(
+ baseline_policy
+ ):# if something other than current law policy baseline
+ update_policy(policy1,baseline_policy)ifnotbaseline:
+ ifbaseline_policy:# update baseline policy to layer reform on top
+ update_policy(policy1,baseline_policy)update_policy(policy1,reform)# the default set up increments year to 2013
@@ -454,7 +460,11 @@
Source code for ccc.get_taxcalc_rates
[docs]defget_rates(
- baseline=False,start_year=DEFAULT_START_YEAR,reform={},data="cps"
+ baseline=False,
+ start_year=DEFAULT_START_YEAR,
+ baseline_policy=None,
+ reform={},
+ data="cps",):""" This function computes weighted average marginal tax rates using
@@ -473,6 +483,7 @@
ifcall_tc:# Find individual income tax rates from Tax-Calculatorindiv_rates=get_rates(
- self.baseline,self.year,self.iit_reform,self.data
+ self.baseline,
+ self.year,
+ self.baseline_policy,
+ self.iit_reform,
+ self.data,)self.tau_pt=indiv_rates["tau_pt"]self.tau_div=indiv_rates["tau_div"]
diff --git a/_sources/content/examples/TCJA_extension.ipynb b/_sources/content/examples/TCJA_extension.ipynb
new file mode 100644
index 00000000..77dea940
--- /dev/null
+++ b/_sources/content/examples/TCJA_extension.ipynb
@@ -0,0 +1,341 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Using the Cost-of-Capital-Calculator (CCC) with an alternative baseline\n",
+ "\n",
+ "This notebook provides an illustration of using the Cost-of-Capital-Calculator (CCC) with an alternative baseline. In particular, it will simulate and compare results using a current law baseline and a current policy baseline (i.e., TCJA permanence).\n",
+ "\n",
+ "To run this notebook on your machine, you will need to follow the instructions to install CCC as described in the CCC README [here](https://github.com/PSLmodels/Cost-of-Capital-Calculator). In particular, you need to:\n",
+ "\n",
+ "* Install the [Anaconda distribution](https://www.anaconda.com/distribution/) of Python\n",
+ "* Install the CCC package by typing `conda install -c conda-forge ccc` (or `pip install cost-of-captial-calculator`) in the command prompt.\n",
+ "\n",
+ "Once you follow the above, you will be ready to work with this Jupyter Notebook.\n",
+ "\n",
+ "## First things first, import necessary packages"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# To install ccc package (if not already):\n",
+ "import sys\n",
+ "if 'ccc' not in sys.modules:\n",
+ " !pip install cost-of-capital-calculator"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ " \n",
+ "
\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 function drop(id) {\n const view = Bokeh.index.get_by_id(id)\n if (view != null) {\n view.model.document.clear()\n Bokeh.index.delete(view)\n }\n }\n\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\n // Clean up Bokeh references\n if (id != null) {\n drop(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 drop(id)\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
Using the Cost-of-Capital-Calculator (CCC) with an alternative baseline
+
+
+
+
+
+
Contents
+
+
+
+
+
+
+
+
+
+
+
+
+
Using the Cost-of-Capital-Calculator (CCC) with an alternative baseline#
+
This notebook provides an illustration of using the Cost-of-Capital-Calculator (CCC) with an alternative baseline. In particular, it will simulate and compare results using a current law baseline and a current policy baseline (i.e., TCJA permanence).
+
To run this notebook on your machine, you will need to follow the instructions to install CCC as described in the CCC README here. In particular, you need to:
# To install ccc package (if not already):
+importsys
+if'ccc'notinsys.modules:
+ !pipinstallcost-of-capital-calculator
+
+
+
+
+
Requirement already satisfied: cost-of-capital-calculator in /home/runner/work/Cost-of-Capital-Calculator/Cost-of-Capital-Calculator (1.3.0)
+Requirement already satisfied: taxcalc in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from cost-of-capital-calculator) (3.5.3)
+Requirement already satisfied: pandas in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from cost-of-capital-calculator) (2.2.2)
+Requirement already satisfied: bokeh in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from cost-of-capital-calculator) (3.4.1)
+Requirement already satisfied: numpy in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from cost-of-capital-calculator) (1.26.4)
+Requirement already satisfied: paramtools in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from cost-of-capital-calculator) (0.0.0)
+
+
+
Requirement already satisfied: Jinja2>=2.9 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (3.1.3)
+Requirement already satisfied: contourpy>=1.2 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (1.2.1)
+Requirement already satisfied: packaging>=16.8 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (24.0)
+Requirement already satisfied: pillow>=7.1.0 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (10.3.0)
+Requirement already satisfied: PyYAML>=3.10 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (6.0.1)
+Requirement already satisfied: tornado>=6.2 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (6.4)
+Requirement already satisfied: xyzservices>=2021.09.1 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from bokeh->cost-of-capital-calculator) (2024.4.0)
+
+
+
Requirement already satisfied: python-dateutil>=2.8.2 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from pandas->cost-of-capital-calculator) (2.9.0)
+Requirement already satisfied: pytz>=2020.1 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from pandas->cost-of-capital-calculator) (2024.1)
+Requirement already satisfied: tzdata>=2022.7 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from pandas->cost-of-capital-calculator) (2024.1)
+Requirement already satisfied: marshmallow>=3.0.0 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from paramtools->cost-of-capital-calculator) (3.21.1)
+Requirement already satisfied: fsspec in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from paramtools->cost-of-capital-calculator) (2024.3.1)
+Requirement already satisfied: sortedcontainers in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from paramtools->cost-of-capital-calculator) (2.4.0)
+Requirement already satisfied: setuptools in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from taxcalc->cost-of-capital-calculator) (69.5.1)
+Requirement already satisfied: numba in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from taxcalc->cost-of-capital-calculator) (0.59.1)
+Requirement already satisfied: requests in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from taxcalc->cost-of-capital-calculator) (2.31.0)
+Requirement already satisfied: MarkupSafe>=2.0 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from Jinja2>=2.9->bokeh->cost-of-capital-calculator) (2.1.5)
+
+
+
Requirement already satisfied: six>=1.5 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas->cost-of-capital-calculator) (1.16.0)
+
+
+
Requirement already satisfied: llvmlite<0.43,>=0.42.0dev0 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from numba->taxcalc->cost-of-capital-calculator) (0.42.0)
+Requirement already satisfied: charset-normalizer<4,>=2 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from requests->taxcalc->cost-of-capital-calculator) (3.3.2)
+Requirement already satisfied: idna<4,>=2.5 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from requests->taxcalc->cost-of-capital-calculator) (3.7)
+Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from requests->taxcalc->cost-of-capital-calculator) (2.2.1)
+Requirement already satisfied: certifi>=2017.4.17 in /usr/share/miniconda3/envs/ccc-dev/lib/python3.9/site-packages (from requests->taxcalc->cost-of-capital-calculator) (2024.2.2)
+
+
+
+
+
+
+
# import packages
+importpandasaspd
+importnumpyasnp
+importos
+frombokeh.plottingimportfigure,show
+frombokeh.ioimportoutput_notebook
+# import CCC classes that we'll work with
+fromccc.dataimportAssets
+fromccc.parametersimportSpecification,DepreciationParams
+fromccc.calculatorimportCalculator
+# to print bokeh plots inline
+output_notebook()
+
+
+
+
+
+
+
+ Loading BokehJS ...
+
+
+
+
+
+
Create instance of the calculator class with a current law baseline#
+
+
+
# Create an instance of the Assets class
+assets=Assets()
+# Create an instance of the Specification class
+p=Specification(call_tc=False,year=2026)# choose year after TCJA expires
+# Create an instance of the DepreciationParams class
+dp=DepreciationParams()
+# Create an instance of the Calculator class
+calc1=Calculator(p,dp,assets)
+calc1.calc_all()
+
+
+
+
+
+
+
Create instance of the calculator class with a current policy baseline (i.e., TCJA permanence)#
+
+
+
# Create an instance of the Assets class
+assets=Assets()
+# Create an instance of the Specification class
+p2=Specification(call_tc=False,year=2026)# choose year after TCJA expires
+p2.update_specification(os.path.join("..","..","..","..",'ccc','tcja_extension.json'))
+# Create an instance of the DepreciationParams class
+dp=DepreciationParams()
+# Create an instance of the Calculator class
+calc2=Calculator(p2,dp,assets)
+calc2.calc_all()
+
Now with two Calculator objects named calc1 and calc2 (representing the current law baseline and current policy baseline), we can compare the two.
+
We start with an overall summary table showing the marginal effective total tax rates (METTRs) for all investments, corporate investments, and pass-through investments under varying financing assumptions. This is done through the summary_table function. It takes a calculator object as an argument.
+
+
+
# Look at differences in METTRs between the two policies
+calc1.summary_table(calc2)# calc1 is the current law baseline, calc2 the current policy baseline
+# NOTE: in the table below, the current law baseline will be referred to as the "baseline"
+# and the current policy baseline will be referred to as the "reform"
+
+
+
+
+
+
+
+
+
+
+
+
Marginal Effective Total Tax Rate Under Baseline Policy
+
Marginal Effective Total Tax Rate Under Reform Policy