Cost of Capital Calculator#

calculator

ccc.calculator#

class ccc.calculator.Calculator(p=None, dp=None, assets=None, verbose=True)[source]#

Constructor for the Calculator class.

Parameters:
  • p (CCC Specifications class object) – contains parameters, this argument must be specified and object is copied for internal use

  • dp (CCC Depreciation Parameters class object) – contains parameters descripting depreciation rules for each asset, this argument must be specified and object is copied for internal use

  • assets (CCC Assets class object) – contains asset data, this argument must be specified and object is copied for internal use

  • verbose (bool) – specifies whether or not to write to stdout data-loaded and data-extrapolated progress reports; default value is True.

Raises:

ValueError – if parameters are not the appropriate type.

Returns:

class instance

Return type:

Calculator

Notes

All calculations are done on the internal copies of the Specifications and Assets objects passed to each of the two Calculator constructors.

Example

The most efficient way to specify current-law and reform Calculator
objects is as follows::
>>> `params = Specifications()``
>>> `rec = Assets()``
>>> `calc1 = Calculator(p=params, assets=rec)  # current-law`
>>> `params2 = Specifications(...reform parameters...)``
>>> `calc2 = Calculator(p=params2, assets=rec)  # reform`
asset_bubble(calc, output_variable='mettr_mix', include_inventories=False, include_land=False, include_IP=False, include_title=False, path='')[source]#

Create a bubble plot showing the value of the output variable along the x-axis, asset type groupings on the y-axis, and bubbles whose size represent the total assets of a specific type.

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr_mix).

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to False

  • include_land (bool) – whether to include land in calculations. Defaults to False

  • include_IP (bool) – whether to include intellectual property in calculations. Defaults to False

  • include_title (bool) – whether to include a title on the plot

  • path (string) – path to save file to

Returns:

bubble plots

Return type:

tabs (Bokeh Tabs object)

asset_share_table(include_land=True, include_inventories=True, output_type=None, path=None)[source]#

Create table summarizing the output_variable under the baseline and reform policies.

Parameters:
  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

  • output_type (string) – specifies the type of file to save table to: ‘csv’, ‘tex’, ‘excel’, ‘json’. If ‘None’ a DataFrame is returned. Default is None.

  • path (string) – specifies path to save file with table to. If None, then returns DataFrame or string object, depending on output_type. Default is None.

Returns:

table

Return type:

table_df (Pandas DataFrame)

asset_summary_table(calc, output_variable='mettr', financing='mix', include_land=True, include_inventories=True, output_type=None, path=None)[source]#

Create table summarizing the output_variable under the baseline and reform policies by major asset grouping.

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr).

  • financing (string) – marginal source of finance for the new investment: ‘mix’ for mix of debt and equity, ‘d’ for debt, or ‘e’ for equity.

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

  • output_type (string) – specifies the type of file to save table to: ‘csv’, ‘tex’, ‘excel’, ‘json’. If ‘None’ a DataFrame is returned. Default is None.

  • path (string) – specifies path to save file with table to. If None, then returns DataFrame or string object, depending on output_type. Default is None.

Returns:

table

Return type:

table_df (Pandas DataFrame)

bubble_widget(calc, output_variable='mettr', include_land=False, include_inventories=False, include_IP=False)[source]#

Create a bubble plot widget. The x-axis shows the value of the output variable, the y are groups (e.g., asset type or industry). The widget allows for one to click buttons to view the values for different output variables, choose to look at the baseline policy values, the reform policy values, or the difference, switch between values for the corporate and non-corporate sector. The bubbles’ size represent the total assets of a specific type.

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr)

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to False

  • include_land (bool) – whether to include land in calculations. Defaults to False

  • include_IP (bool) – whether to include intellectual property in calculations. Defaults to False

Returns:

widget

Return type:

layout (Bokeh Layout object)

calc_all()[source]#

Calculates all CCC variables for some CCC Assets object.

calc_base()[source]#

Call functions for the current_year. This involves updating depreciation methods, computing the npv of depreciation (z), and computing the cost of capital (rho) and then calling the calc_all() function to do computations that dependon rho and z.

calc_by_asset(include_inventories=True, include_land=True)[source]#

Calculates all variables by asset, including overall, and by major asset categories.

Parameters:
  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

Returns:

rows are assets and major asset

groupings with columns for all output variables

Return type:

df (pandas DataFrame)

calc_by_industry(include_inventories=True, include_land=True)[source]#

Calculates all variables by industry, including overall, and by major asset categories.

Parameters:
  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

Returns:

rows are minor industries and major

industry groupings with columns for all output variables

Return type:

df (Pandas DataFrame)

calc_other(df)[source]#

Calculates variables that depend on z and rho such as metr, ucc

Parameters:

df (Pandas DataFrame) – assets by industry and tax_treatment with depreciation rates, cost of capital, etc.

Returns:

input dataframe, but with additional

columns (ucc, metr, mettr, tax_wedge, eatr)

Return type:

df (Pandas DataFrame)

property current_year#

Calculator class current calendar year property.

property data_year#

Calculator class initial (i.e., first) assets data year property.

grouped_bar(calc, output_variable='mettr', financing='mix', group_by_asset=True, corporate=True, include_land=True, include_inventories=True, include_title=False)[source]#

Create a grouped bar plot (grouped by major industry or major asset group).

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr).

  • financing (string) – marginal source of finance for the new investment: ‘mix’ for mix of debt and equity, ‘d’ for debt, or ‘e’ for equity.

  • group_by_asset (bool) – whether to group by major asset group. If False, then grouping is by major industry. Defaults to True.

  • corporate (bool) – whether to use data for corporate entities. If False, then uses data for pass-through entities. Defaults to True.

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

  • include_title (bool) – whether to include a title on the plot

Returns:

bar plot

Return type:

p (Bokeh plot object)

industry_summary_table(calc, output_variable='mettr', financing='mix', include_land=True, include_inventories=True, output_type=None, path=None)[source]#

Create table summarizing the output_variable under the baseline and reform policies by major asset grouping.

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr).

  • financing (string) – marginal source of finance for the new investment: ‘mix’ for mix of debt and equity, ‘d’ for debt, or ‘e’ for equity.

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

  • output_type (string) – specifies the type of file to save table to: ‘csv’, ‘tex’, ‘excel’, ‘json’. If ‘None’ a DataFrame is returned. Default is None.

  • path (string) – specifies path to save file with table to. If None, then returns DataFrame or string object, depending on output_type. Default is None.

Returns:

table

Return type:

table_df (Pandas DataFrame)

p_param(param_name, param_value=None)[source]#
If param_value is None, return named parameter in

embedded Specification object.

If param_value is not None, set named parameter in

embedded Specification object to specified param_value and return None (which can be ignored).

Args:

param_name (string): parameter name param_value (python object): value to set parameter to

Returns:

None

range_plot(calc, output_variable='mettr', corporate=True, include_land=True, include_inventories=True, include_title=False)[source]#

Create a range plot.

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr)

  • corporate (bool) – whether to use data for corporate entities If False, then uses data for pass-through entities Defaults to True

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True

  • include_land (bool) – whether to include land in calculations. Defaults to True

  • include_title (bool) – whether to include a title on the plot

Returns:

bar plot

Return type:

p (Bokeh plot object)

restore_assets()[source]#

Set the embedded Assets object to the stored Assets object that was saved in the last call to the store_assets() method.

store_assets()[source]#

Make internal copy of embedded Assets object that can then be restored after interim calculations that make temporary changes to the embedded Assets object.

summary_table(calc, output_variable='mettr', include_land=True, include_inventories=True, output_type=None, path=None)[source]#

Create table summarizing the output_variable under the baseline and reform policies.

Parameters:
  • calc (CCC Calculator object) – calc represents the reform while self represents the baseline

  • output_variable (string) – specifies which output variable to summarize in the table. Default is the marginal effective total tax rate (mettr).

  • include_inventories (bool) – whether to include inventories in calculations. Defaults to True.

  • include_land (bool) – whether to include land in calculations. Defaults to True.

  • output_type (string) – specifies the type of file to save table to: ‘csv’, ‘tex’, ‘excel’, ‘json’. If ‘None’ a DataFrame is returned. Default is None.

  • path (string) – specifies path to save file with table to. If None, then returns DataFrame or string object, depending on output_type. Default is None.

Returns:

table

Return type:

table_df (Pandas DataFrame)