Skip to content

Corporate finance

Cost of capital and beta

CAPM, WACC with preferred equity, Hamada unlevering/relevering, and country risk premium.

Model id
corporate.cost_of_capital, version 1
Domain
Corporate finance
Evidence
standard
Cost class
instant: A closed-form calculation; a hosted run may take up to 2 seconds.

Formula

ke=rf+βERPk_e=r_f+\beta ERPWACC=Eke+Dkd(1−t)+PkpE+D+PWACC=\frac{Ek_e+Dk_d(1-t)+Pk_p}{E+D+P}βL=βU[1+(1−t)D/E]\beta_L=\beta_U[1+(1-t)D/E]CRP=sσe/σbCRP=s\sigma_e/\sigma_b

Where

kek_e
Cost of equity cost_of_equity
rfr_f
Risk-free rate risk_free_rate
β\beta
Equity beta to the market portfolio beta
ERPERP
Equity risk premium: the expected market return less the risk-free rate equity_risk_premium
WACCWACC
Weighted average cost of capital, after tax wacc
EE
Market value of common equity equity
DD
Market value of debt debt
PP
Market value of preferred stock preferred
kdk_d
Pretax cost of debt cost_of_debt
kpk_p
Cost of preferred stock cost_of_preferred
tt
Marginal tax rate tax_rate
βL\beta_L
Levered (equity) beta
βU\beta_U
Unlevered (asset) beta
D/ED/E
Debt-to-equity ratio at market values debt_to_equity
CRPCRP
Country risk premium premium
ss
Sovereign default spread sovereign_spread
σe\sigma_e
Volatility of the country's equity market equity_volatility
σb\sigma_b
Volatility of the country's sovereign bond bond_volatility

Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.

Variables

Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.

Inputs

Capital asset pricing model (capm): 4 inputs
Inputs of the calculation capm
NameDescription
CalculationcalculationtextCapital asset pricing model
Risk free raterisk_free_raterate · [-0.05, 0.5]Annual risk-free rate
Equity risk premiumequity_risk_premiumrate · [-0.5, 0.5]Expected market return less risk-free rate
Betabetaratio · [-5, 5]Equity beta to the market portfolio
Weighted average cost of capital (wacc): 8 inputs
Inputs of the calculation wacc
NameDescription
CalculationcalculationtextWeighted average cost of capital
Equityequitymoney · [0, 1e+12]Market value of common equity
Debtdebtmoney · [0, 1e+12]Market value of debt
Preferredpreferredmoney · [0, 1e+12]Market value of preferred stock
Cost of equitycost_of_equityrate · [0, 1]Annual cost of common equity
Cost of debtcost_of_debtrate · [0, 1]Annual pretax cost of debt
Cost of preferredcost_of_preferredrate · [0, 1]Annual cost of preferred stock
Tax ratetax_rateprobability · [0, 1]Marginal tax rate for debt shield
Remove financial leverage (unlever_beta): 4 inputs
Inputs of the calculation unlever_beta
NameDescription
Betabetaratio · [-5, 5]Levered beta to unlever, or unlevered beta to relever
Debt to equitydebt_to_equityratio · [0, 100]Market debt/equity ratio
Tax ratetax_rateprobability · [0, 1]Marginal tax rate
CalculationcalculationtextRemove financial leverage
Add financial leverage (relever_beta): 4 inputs
Inputs of the calculation relever_beta
NameDescription
Betabetaratio · [-5, 5]Levered beta to unlever, or unlevered beta to relever
Debt to equitydebt_to_equityratio · [0, 100]Market debt/equity ratio
Tax ratetax_rateprobability · [0, 1]Marginal tax rate
CalculationcalculationtextAdd financial leverage
Volatility-scaled sovereign spread (country_risk_premium): 4 inputs
Inputs of the calculation country_risk_premium
NameDescription
CalculationcalculationtextVolatility-scaled sovereign spread
Sovereign spreadsovereign_spreadrate · [0, 1]Annual sovereign default spread
Equity volatilityequity_volatilityvolatility · [1e-06, 5]Equity volatility over the common period
Bond volatilitybond_volatilityvolatility · [1e-06, 5]Sovereign bond volatility over the common period

Outputs

Capital asset pricing model (capm): 2 outputs
Outputs of the calculation capm
NameDescription
CalculationcalculationtextCapital asset pricing model
Cost of equitycost_of_equityrate · [-3, 3]Risk-free rate plus beta times ERP
Weighted average cost of capital (wacc): 2 outputs
Outputs of the calculation wacc
NameDescription
CalculationcalculationtextWeighted average cost of capital
WACCwaccrate · [0, 1]Market-weighted after-tax cost of capital
Remove financial leverage (unlever_beta): 2 outputs
Outputs of the calculation unlever_beta
NameDescription
CalculationcalculationtextRemove financial leverage
Betabetaratio · [-505, 505]Unlevered beta
Add financial leverage (relever_beta): 2 outputs
Outputs of the calculation relever_beta
NameDescription
CalculationcalculationtextAdd financial leverage
Betabetaratio · [-505, 505]Levered beta
Volatility-scaled sovereign spread (country_risk_premium): 2 outputs
Outputs of the calculation country_risk_premium
NameDescription
CalculationcalculationtextVolatility-scaled sovereign spread
Premiumpremiumrate · [0, 5e+06]Country equity risk premium

Calculator

Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.

Loading the calculator…

Worked example

Example formula_capm. Inputs:

{
  "beta": 1.2,
  "calculation": "capm",
  "equity_risk_premium": 0.05,
  "risk_free_rate": 0.03
}

Outputs:

{
  "calculation": "capm",
  "cost_of_equity": 0.09
}

Assumptions

  • Annual decimal rates; capital weights use market values in one currency.
  • Hamada assumes zero debt beta and a usable interest tax shield.
  • Country equity and sovereign bond volatilities use the same horizon and currency.

Limitations

  • Zero total capital raises DomainError. Extremely small totals can underflow; normalized weights avoid this.
  • CAPM and Hamada assumptions need not hold empirically; country spread scaling is a practitioner estimate, not a recommendation.

Evidence

Status: standard. Textbook consensus, such as bond duration or the CAPM formula.

Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).

Syllabus

The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.

Citations

  1. Sharpe, W. F. (1964). Capital Asset Prices. Journal of Finance 19, 425-442. doi:10.1111/j.1540-6261.1964.tb02865.x (Equilibrium expected returns)
  2. Lintner, J. (1965). The Valuation of Risk Assets and the Selection of Risky Investments. Review of Economics and Statistics 47, 13-37. doi:10.2307/1924119 (Risk and expected return)
  3. Hamada, R. S. (1972). The Effect of the Firm's Capital Structure on the Systematic Risk of Common Stocks. Journal of Finance 27, 435-452. doi:10.1111/j.1540-6261.1972.tb00971.x (Levered and unlevered beta)
  4. Damodaran, A. Measuring Company Exposure to Country Risk: Theory and Practice. https://pages.stern.nyu.edu/~adamodar/New_Home_Page/valquestions/CountryRisk.htm (Default spreads and relative volatility)

Changelog

  • Version 1: First version.

Use it elsewhere

Documentation
The model's reference page
REST API
GET or POST /v1/models/corporate.cost_of_capital/run
MCP tool
corporate_cost_of_capital, or run_model with the model's id; both give the same result. Connect an assistant
Command line
pyeconomics models run corporate.cost_of_capital --help

The worked example, from Python and from the command line:

Python
import pyeconomics

inputs = {
    "beta": 1.2,
    "calculation": "capm",
    "equity_risk_premium": 0.05,
    "risk_free_rate": 0.03,
}
result = pyeconomics.run("corporate.cost_of_capital", inputs)
print(result.to_json())
Command line
pyeconomics models run corporate.cost_of_capital --inputs - <<'JSON'
{
  "beta": 1.2,
  "calculation": "capm",
  "equity_risk_premium": 0.05,
  "risk_free_rate": 0.03
}
JSON