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
Where
- Cost of equity
cost_of_equity - Risk-free rate
risk_free_rate - Equity beta to the market portfolio
beta - Equity risk premium: the expected market return less the risk-free rate
equity_risk_premium - Weighted average cost of capital, after tax
wacc - Market value of common equity
equity - Market value of debt
debt - Market value of preferred stock
preferred - Pretax cost of debt
cost_of_debt - Cost of preferred stock
cost_of_preferred - Marginal tax rate
tax_rate - Levered (equity) beta
- Unlevered (asset) beta
- Debt-to-equity ratio at market values
debt_to_equity - Country risk premium
premium - Sovereign default spread
sovereign_spread - Volatility of the country's equity market
equity_volatility - 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
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Capital asset pricing model | |
Risk free raterisk_free_raterate · [-0.05, 0.5] | rate | [-0.05, 0.5] | Annual risk-free rate |
Equity risk premiumequity_risk_premiumrate · [-0.5, 0.5] | rate | [-0.5, 0.5] | Expected market return less risk-free rate |
Betabetaratio · [-5, 5] | ratio | [-5, 5] | Equity beta to the market portfolio |
Weighted average cost of capital (wacc): 8 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Weighted average cost of capital | |
Equityequitymoney · [0, 1e+12] | money | [0, 1e+12] | Market value of common equity |
Debtdebtmoney · [0, 1e+12] | money | [0, 1e+12] | Market value of debt |
Preferredpreferredmoney · [0, 1e+12] | money | [0, 1e+12] | Market value of preferred stock |
Cost of equitycost_of_equityrate · [0, 1] | rate | [0, 1] | Annual cost of common equity |
Cost of debtcost_of_debtrate · [0, 1] | rate | [0, 1] | Annual pretax cost of debt |
Cost of preferredcost_of_preferredrate · [0, 1] | rate | [0, 1] | Annual cost of preferred stock |
Tax ratetax_rateprobability · [0, 1] | probability | [0, 1] | Marginal tax rate for debt shield |
Remove financial leverage (unlever_beta): 4 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Betabetaratio · [-5, 5] | ratio | [-5, 5] | Levered beta to unlever, or unlevered beta to relever |
Debt to equitydebt_to_equityratio · [0, 100] | ratio | [0, 100] | Market debt/equity ratio |
Tax ratetax_rateprobability · [0, 1] | probability | [0, 1] | Marginal tax rate |
Calculationcalculationtext | text | Remove financial leverage |
Add financial leverage (relever_beta): 4 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Betabetaratio · [-5, 5] | ratio | [-5, 5] | Levered beta to unlever, or unlevered beta to relever |
Debt to equitydebt_to_equityratio · [0, 100] | ratio | [0, 100] | Market debt/equity ratio |
Tax ratetax_rateprobability · [0, 1] | probability | [0, 1] | Marginal tax rate |
Calculationcalculationtext | text | Add financial leverage |
Volatility-scaled sovereign spread (country_risk_premium): 4 inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Volatility-scaled sovereign spread | |
Sovereign spreadsovereign_spreadrate · [0, 1] | rate | [0, 1] | Annual sovereign default spread |
Equity volatilityequity_volatilityvolatility · [1e-06, 5] | volatility | [1e-06, 5] | Equity volatility over the common period |
Bond volatilitybond_volatilityvolatility · [1e-06, 5] | volatility | [1e-06, 5] | Sovereign bond volatility over the common period |
Outputs
Capital asset pricing model (capm): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Capital asset pricing model | |
Cost of equitycost_of_equityrate · [-3, 3] | rate | [-3, 3] | Risk-free rate plus beta times ERP |
Weighted average cost of capital (wacc): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Weighted average cost of capital | |
WACCwaccrate · [0, 1] | rate | [0, 1] | Market-weighted after-tax cost of capital |
Remove financial leverage (unlever_beta): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Remove financial leverage | |
Betabetaratio · [-505, 505] | ratio | [-505, 505] | Unlevered beta |
Add financial leverage (relever_beta): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Add financial leverage | |
Betabetaratio · [-505, 505] | ratio | [-505, 505] | Levered beta |
Volatility-scaled sovereign spread (country_risk_premium): 2 outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Calculationcalculationtext | text | Volatility-scaled sovereign spread | |
Premiumpremiumrate · [0, 5e+06] | rate | [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
- 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)
- 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)
- 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)
- 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, orrun_modelwith 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:
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())
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