Skip to content

Commit

Permalink
update to account for arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Apr 18, 2024
1 parent 8585a98 commit 3cfd20a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
23 changes: 20 additions & 3 deletions ccc/calcfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,20 @@ def npv_tax_depr(df, r, pi, land_expensing):
return z


def eq_coc(delta, z, w, u, u_d, inv_tax_credit, psi, nu, pi, r, re_credit=None, asset_type="None"):
def eq_coc(
delta,
z,
w,
u,
u_d,
inv_tax_credit,
psi,
nu,
pi,
r,
re_credit=None,
asset_code="None",
):
r"""
Compute the cost of capital
Expand Down Expand Up @@ -250,8 +263,12 @@ def eq_coc(delta, z, w, u, u_d, inv_tax_credit, psi, nu, pi, r, re_credit=None,
"""
# case for assets eligible for R&E credit
if (asset_type in RE_ASSETS) and (re_credit is not None):
inv_tax_credit += re_credit
if (asset_code is not None) and (re_credit is not None) & isinstance(
delta, np.ndarray
):
idx = [element in RE_ASSETS for element in asset_code]
inv_tax_credit = np.ones_like(delta)
inv_tax_credit[idx] += re_credit
rho = (
((r - pi + delta) / (1 - u))
* (1 - inv_tax_credit * nu - u_d * z * (1 - psi * inv_tax_credit))
Expand Down
2 changes: 1 addition & 1 deletion ccc/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def calc_base(self):
self.__p.inflation_rate,
self.__p.r[t][f],
self.__p.re_credit,
dfs[t]["asset_type"] #TODO: check that this is consistent with list if constants
dfs[t]["bea_asset_code"],
)
if not self.__p.inventory_expensing:
idx = dfs[t]["asset_name"] == "Inventories"
Expand Down
8 changes: 4 additions & 4 deletions ccc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
# TODO: perhaps make as a dict so that can vary across years?
# And if policy variant, maybe move to default params?
RE_ASSETS = [
"Credit-eligible own account software",
"Credit-eligible research and development",
"Wind and solar power structures",
"ENS3", # "Credit-eligible own account software",
"RD70", # "Credit-eligible research and development",
"SU60", # "Wind and solar power structures",
]

RE_INDUSTRIES = [
"Computer_and_Electronic_Product_Manufacturing",
"3340", # "Computer_and_Electronic_Product_Manufacturing",
]

MAJOR_IND_ORDERED = [
Expand Down

0 comments on commit 3cfd20a

Please sign in to comment.