Funding Cost Model
Model perpetual futures funding rate costs in backtests by incorporating historical funding rate time series, predicting periodic funding payments, and accurately accounting for their significant cumulative impact on long-term strategy net profitability.
Understanding Funding Cost Models
1. Definition and Importance of Funding Cost Models
What are Funding Cost Models?
Funding cost models are analytical frameworks used to calculate the expenses a company incurs to raise capital. This capital can come from various sources, primarily debt (loans, bonds) and equity (stocks, retained earnings).
Why are they important?
Understanding the cost of funding is crucial for several reasons:
- Investment Decisions: It serves as a benchmark (often the Weighted Average Cost of Capital - WACC) for evaluating potential investments. Projects with an expected return lower than the cost of capital should generally not be undertaken.
- Capital Structure Optimization: Helps management determine the optimal mix of debt and equity that minimizes the cost of capital, thereby maximizing firm value.
- Valuation: The cost of capital is a key input in discounted cash flow (DCF) valuation models, used to discount future cash flows to their present value.
- Performance Measurement: It provides a hurdle rate against which the performance of a company or its projects can be measured.
- Strategic Planning: Informs long-term financial planning and strategy, including decisions about expansion, mergers, and acquisitions.
2. Types of Funding Cost Models
There are several components that contribute to a company's overall funding cost. The most common models focus on:
- Cost of Debt (Kd): The effective rate a company pays on its borrowings.
- Cost of Equity (Ke): The return required by equity investors for their investment in the company.
- Weighted Average Cost of Capital (WACC): The average rate of return a company expects to pay to finance its assets, considering the proportion of each capital source (debt and equity).
2.1. Weighted Average Cost of Capital (WACC)
WACC is the average rate of return a company expects to pay to finance its assets. It takes into account the proportion of each component of capital (debt and equity) and their respective costs.
Formula:
$WACC = \left( \frac{E}{V} \right) \times R_e + \left( \frac{D}{V} \right) \times R_d \times (1 - T)$
Where:
- $E$ = Market value of equity
- $D$ = Market value of debt
- $V$ = Total market value of the company's financing (E + D)
- $R_e$ = Cost of equity
- $R_d$ = Cost of debt
- $T$ = Corporate tax rate
Explanation:
This formula calculates a weighted average of the cost of equity and the after-tax cost of debt. The reason for using the after-tax cost of debt is that interest payments are typically tax-deductible, providing a tax shield benefit to the company.
import numpy as np
import matplotlib.pyplot as plt
def calculate_wacc(market_value_equity: float, market_value_debt: float,
cost_of_equity: float, cost_of_debt: float, tax_rate: float) -> float:
"""
Calculates the Weighted Average Cost of Capital (WACC).
Args:
market_value_equity (float): The total market value of the company's equity.
market_value_debt (float): The total market value of the company's debt.
cost_of_equity (float): The cost of equity (as a decimal).
cost_of_debt (float): The cost of debt (as a decimal).
tax_rate (float): The corporate tax rate (as a decimal).
Returns:
float: The calculated WACC (as a decimal).
Formula used:
WACC = (E/V) * Re + (D/V) * Rd * (1 - T)
"""
total_value = market_value_equity + market_value_debt
weight_equity = market_value_equity / total_value
weight_debt = market_value_debt / total_value
wacc = (weight_equity * cost_of_equity) + (weight_debt * cost_of_debt * (1 - tax_rate))
return wacc
# Mock Data for WACC Calculation
mv_equity = 500_000_000 # $500 million
mv_debt = 300_000_000 # $300 million
c_equity = 0.12 # 12%
c_debt = 0.06 # 6%
t_rate = 0.25 # 25%
# Perform WACC Calculation
wacc_result = calculate_wacc(mv_equity, mv_debt, c_equity, c_debt, t_rate)
print(f"Market Value of Equity (E): ${mv_equity:,.2f}")
print(f"Market Value of Debt (D): ${mv_debt:,.2f}")
print(f"Cost of Equity (Re): {c_equity:.2%}")
print(f"Cost of Debt (Rd): {c_debt:.2%}")
print(f"Corporate Tax Rate (T): {t_rate:.2%}")
print(f"---------------------------------------")
print(f"Calculated WACC: {wacc_result:.4f} or {wacc_result:.2%}")Market Value of Equity (E): $500,000,000.00 Market Value of Debt (D): $300,000,000.00 Cost of Equity (Re): 12.00% Cost of Debt (Rd): 6.00% Corporate Tax Rate (T): 25.00% --------------------------------------- Calculated WACC: 0.0919 or 9.19%
Interpretation of WACC Result
The calculated WACC for this hypothetical company is 9.19%. This means that, on average, the company must earn a return of at least 9.19% on its investments to satisfy its debt holders and equity investors. If the company undertakes projects that yield less than 9.19%, it will likely destroy shareholder value.
This WACC value serves as a critical discount rate for evaluating potential projects and overall firm valuation. It reflects the blended cost of capital from both equity and debt sources, adjusted for the tax-deductibility of interest expenses.
2.2. Cost of Equity ($R_e$)
The Cost of Equity ($R_e$) is the return a company requires to compensate its equity investors for the risk they undertake by investing in the company's stock. It is often estimated using the Capital Asset Pricing Model (CAPM) or the Dividend Discount Model (DDM).
Capital Asset Pricing Model (CAPM)
CAPM is a widely used model for estimating the expected return on an asset, which in this context, is the cost of equity.
Formula:
$R_e = R_f + \beta \times (R_m - R_f)$
Where:
- $R_e$ = Cost of Equity
- $R_f$ = Risk-Free Rate
- $\beta$ = Beta (a measure of the stock's volatility in relation to the overall market)
- $R_m$ = Expected Market Return
- $(R_m - R_f)$ = Market Risk Premium
Explanation:
CAPM suggests that the expected return on an equity investment is equal to the risk-free rate plus a risk premium. The risk premium is determined by the asset's beta, which quantifies its systematic risk (non-diversifiable risk), multiplied by the market risk premium (the excess return expected from the market over the risk-free rate).
def calculate_cost_of_equity_capm(risk_free_rate: float, beta: float, market_return: float) -> float:
"""
Calculates the Cost of Equity using the Capital Asset Pricing Model (CAPM).
Args:
risk_free_rate (float): The risk-free rate (e.g., yield on government bonds, as a decimal).
beta (float): The stock's beta (a measure of systematic risk).
market_return (float): The expected market return (as a decimal).
Returns:
float: The calculated Cost of Equity (as a decimal).
Formula used:
Re = Rf + Beta * (Rm - Rf)
"""
cost_of_equity = risk_free_rate + beta * (market_return - risk_free_rate)
return cost_of_equity
# Mock Data for CAPM Calculation
rf_rate = 0.03 # 3% risk-free rate
stock_beta = 1.2 # Beta of the company's stock
market_ret = 0.08 # 8% expected market return
# Perform CAPM Calculation
c_equity_capm = calculate_cost_of_equity_capm(rf_rate, stock_beta, market_ret)
print(f"Risk-Free Rate (Rf): {rf_rate:.2%}")
print(f"Stock Beta (β): {stock_beta:.2f}")
print(f"Expected Market Return (Rm): {market_ret:.2%}")
print(f"---------------------------------------")
print(f"Calculated Cost of Equity (CAPM): {c_equity_capm:.4f} or {c_equity_capm:.2%}")Risk-Free Rate (Rf): 3.00% Stock Beta (β): 1.20 Expected Market Return (Rm): 8.00% --------------------------------------- Calculated Cost of Equity (CAPM): 0.0900 or 9.00%
Interpretation of Cost of Equity (CAPM) Result
Based on the Capital Asset Pricing Model, the calculated Cost of Equity for this stock is 9.00%. This implies that equity investors expect a return of at least 9.00% for their investment, considering the risk-free rate, the stock's systematic risk (beta), and the overall market's expected return. Companies often use this value as the $R_e$ component in their WACC calculation.
Dividend Discount Model (DDM)
The Dividend Discount Model (DDM) is another method to estimate the cost of equity, particularly for companies that pay dividends. It assumes that the value of a stock is the present value of all its future dividends.
Formula (Constant Growth DDM):
$R_e = \frac{D_1}{P_0} + g$
Where:
- $R_e$ = Cost of Equity
- $D_1$ = Expected dividend per share in the next period ($D_0 \times (1 + g)$)
- $P_0$ = Current market price per share
- $g$ = Constant growth rate of dividends
Explanation:
This model suggests that the cost of equity is the sum of the dividend yield ($D_1 / P_0$) and the expected constant growth rate of dividends ($g$). It is most appropriate for mature companies with a stable dividend payout policy.
def calculate_cost_of_equity_ddm(current_dividend: float, stock_price: float, dividend_growth_rate: float) -> float:
"""
Calculates the Cost of Equity using the Dividend Discount Model (DDM).
Args:
current_dividend (float): The most recently paid annual dividend per share (D0).
stock_price (float): The current market price per share (P0).
dividend_growth_rate (float): The constant growth rate of dividends (as a decimal).
Returns:
float: The calculated Cost of Equity (as a decimal).
Formula used:
Re = (D1 / P0) + g where D1 = D0 * (1 + g)
"""
# Calculate next period's dividend (D1)
next_dividend = current_dividend * (1 + dividend_growth_rate)
cost_of_equity = (next_dividend / stock_price) + dividend_growth_rate
return cost_of_equity
# Mock Data for DDM Calculation
d0 = 2.00 # $2.00 per share (most recent dividend)
p0 = 50.00 # $50.00 per share (current stock price)
g_rate = 0.05 # 5% constant dividend growth rate
# Perform DDM Calculation
c_equity_ddm = calculate_cost_of_equity_ddm(d0, p0, g_rate)
print(f"Most Recent Dividend (D0): ${d0:.2f}")
print(f"Current Stock Price (P0): ${p0:.2f}")
print(f"Dividend Growth Rate (g): {g_rate:.2%}")
print(f"---------------------------------------")
print(f"Calculated Cost of Equity (DDM): {c_equity_ddm:.4f} or {c_equity_ddm:.2%}")Most Recent Dividend (D0): $2.00 Current Stock Price (P0): $50.00 Dividend Growth Rate (g): 5.00% --------------------------------------- Calculated Cost of Equity (DDM): 0.0920 or 9.20%
Interpretation of Cost of Equity (DDM) Result
Using the Dividend Discount Model, the calculated Cost of Equity is 9.20%. This indicates the return investors expect from the company's stock, given its current dividend, stock price, and expected dividend growth. It's important to note that DDM is best suited for mature companies with stable and predictable dividend growth.
Comparing the CAPM (9.00%) and DDM (9.20%) results for the Cost of Equity, we see they are relatively close, which can provide more confidence in the estimate. In practice, analysts often use multiple models and average their results or use the one most appropriate for the company's characteristics.
2.3. Cost of Debt ($R_d$)
The Cost of Debt ($R_d$) is the effective interest rate a company pays on its borrowings, such as bank loans or bonds. Since interest payments are often tax-deductible, the relevant cost of debt for WACC calculation is usually the after-tax cost of debt.
Formula:
$R_d \text{ (after-tax)} = R_d \text{ (pre-tax)} \times (1 - T)$
Where:
- $R_d \text{ (pre-tax)}$ = Yield to Maturity (YTM) on the company's debt or average interest rate on loans
- $T$ = Corporate tax rate
Explanation:
The pre-tax cost of debt is essentially the interest rate the company pays to its lenders. However, because interest expenses reduce taxable income, the actual cost to the company is lower. The tax shield provided by interest payments makes debt financing cheaper than it appears at first glance. The Yield to Maturity (YTM) on a company's outstanding bonds is often used as a proxy for the pre-tax cost of debt.
def calculate_cost_of_debt(pre_tax_cost_of_debt: float, tax_rate: float) -> float:
"""
Calculates the after-tax Cost of Debt.
Args:
pre_tax_cost_of_debt (float): The pre-tax cost of debt (e.g., YTM, as a decimal).
tax_rate (float): The corporate tax rate (as a decimal).
Returns:
float: The calculated after-tax Cost of Debt (as a decimal).
Formula used:
Rd (after-tax) = Rd (pre-tax) * (1 - T)
"""
after_tax_cost_of_debt = pre_tax_cost_of_debt * (1 - tax_rate)
return after_tax_cost_of_debt
# Mock Data for Cost of Debt Calculation
pre_tax_rd = 0.06 # 6% pre-tax cost of debt (e.g., YTM)
t_rate_debt = 0.25 # 25% corporate tax rate
# Perform Cost of Debt Calculation
c_debt_after_tax = calculate_cost_of_debt(pre_tax_rd, t_rate_debt)
print(f"Pre-Tax Cost of Debt (Rd): {pre_tax_rd:.2%}")
print(f"Corporate Tax Rate (T): {t_rate_debt:.2%}")
print(f"---------------------------------------")
print(f"Calculated After-Tax Cost of Debt: {c_debt_after_tax:.4f} or {c_debt_after_tax:.2%}")Pre-Tax Cost of Debt (Rd): 6.00% Corporate Tax Rate (T): 25.00% --------------------------------------- Calculated After-Tax Cost of Debt: 0.0450 or 4.50%
Interpretation of After-Tax Cost of Debt Result
With a pre-tax cost of debt of 6.00% and a corporate tax rate of 25.00%, the calculated after-tax Cost of Debt is 4.50%. This demonstrates the significant impact of the tax shield on the actual cost of borrowing for a company. This 4.50% is the value typically used for the $R_d \times (1 - T)$ component in the WACC formula.
3. Visualizations to Illustrate Funding Cost Concepts
Visualizations are powerful tools to understand how different variables impact the cost of funding. We will create two types of plots:
- Multi-panel Plot: To show the sensitivity of WACC, Cost of Equity (CAPM), and After-Tax Cost of Debt to their key drivers.
- Trend-based Plot: To illustrate the relationship between WACC and the debt-to-capital ratio, highlighting the concept of optimal capital structure.
3.1. Figure 1: Sensitivity Analysis of Funding Costs
This multi-panel plot will show:
- Panel A (WACC vs. Debt Weight): How WACC changes as the proportion of debt in the capital structure varies.
- Panel B (Cost of Equity vs. Beta): How the Cost of Equity (CAPM) changes with different Betas.
- Panel C (After-Tax Cost of Debt vs. Tax Rate): How the after-tax cost of debt changes with varying corporate tax rates.
These plots help in understanding the sensitivity of each component and the overall WACC to changes in their underlying assumptions.
# Re-using previously defined functions
# calculate_wacc, calculate_cost_of_equity_capm, calculate_cost_of_debt
# --- Panel A: WACC vs. Debt Weight ---
# Keep equity and debt costs constant, vary debt weight (and thus equity weight)
debt_weights = np.linspace(0.0, 1.0, 100) # Debt weight from 0% to 100%
# Assuming a constant total value for simplicity, e.g., $1
total_value_for_weights = 1.0
wacc_values = []
for dw in debt_weights:
mv_debt_sim = dw * total_value_for_weights
mv_equity_sim = (1 - dw) * total_value_for_weights
# Use the initial c_equity (0.12) and pre_tax_rd (0.06), t_rate (0.25) from WACC example
if mv_equity_sim == 0 and mv_debt_sim == 0: # Avoid division by zero if total_value_for_weights is 0
wacc_values.append(np.nan)
elif mv_equity_sim == 0: # Pure debt financing, WACC is just cost of debt
wacc_values.append(calculate_cost_of_debt(pre_tax_rd, t_rate)) # Using pre_tax_rd from earlier WACC mock data
elif mv_debt_sim == 0: # Pure equity financing, WACC is just cost of equity
wacc_values.append(c_equity) # Using c_equity from earlier WACC mock data
else:
wacc_values.append(calculate_wacc(mv_equity_sim, mv_debt_sim, c_equity, pre_tax_rd, t_rate))
# --- Panel B: Cost of Equity vs. Beta ---
betas = np.linspace(0.5, 2.0, 100) # Beta values from 0.5 to 2.0
c_equity_capm_values = [calculate_cost_of_equity_capm(rf_rate, b, market_ret) for b in betas]
# --- Panel C: After-Tax Cost of Debt vs. Tax Rate ---
tax_rates = np.linspace(0.0, 0.5, 100) # Tax rates from 0% to 50%
c_debt_after_tax_values = [calculate_cost_of_debt(pre_tax_rd, tr) for tr in tax_rates]
# Create the multi-panel plot
plt.figure(figsize=(18, 5))
plt.subplot(1, 3, 1)
plt.plot(debt_weights * 100, np.array(wacc_values) * 100, label='WACC')
plt.title('WACC vs. Debt Weight')
plt.xlabel('Debt Weight (%)')
plt.ylabel('WACC (%)')
plt.grid(True)
plt.legend()
plt.subplot(1, 3, 2)
plt.plot(betas, np.array(c_equity_capm_values) * 100, label='Cost of Equity (CAPM)', color='orange')
plt.title('Cost of Equity (CAPM) vs. Beta')
plt.xlabel('Beta')
plt.ylabel('Cost of Equity (%)')
plt.grid(True)
plt.legend()
plt.subplot(1, 3, 3)
plt.plot(tax_rates * 100, np.array(c_debt_after_tax_values) * 100, label='After-Tax Cost of Debt', color='green')
plt.title('After-Tax Cost of Debt vs. Tax Rate')
plt.xlabel('Tax Rate (%)')
plt.ylabel('Cost of Debt (%)')
plt.grid(True)
plt.legend()
plt.tight_layout()
plt.show()Interpretation of Figure 1: Sensitivity Analysis
This multi-panel plot provides valuable insights into how changes in key variables affect funding costs:
-
Panel A: WACC vs. Debt Weight
- The plot shows how WACC typically decreases as the proportion of debt in the capital structure increases initially, primarily due to the tax deductibility of interest expenses (making debt cheaper than equity).
- However, beyond a certain point (often depicted as a U-shape, though not explicitly shown in this linear simplified model), WACC might start to rise again as too much debt increases financial risk, leading to higher costs of both debt and equity.
-
Panel B: Cost of Equity (CAPM) vs. Beta
- This panel clearly demonstrates a linear positive relationship between a company's Beta and its Cost of Equity. As Beta (systematic risk) increases, investors demand a higher return to compensate for the increased risk, leading to a higher Cost of Equity.
-
Panel C: After-Tax Cost of Debt vs. Tax Rate
- This plot illustrates that as the corporate tax rate increases, the after-tax cost of debt decreases. This is because a higher tax rate means the tax shield benefit of interest payments is more significant, making debt financing effectively cheaper for the company.
3.2. Figure 2: WACC and Optimal Capital Structure
This plot will show how WACC changes across a range of debt-to-capital ratios, while also demonstrating how the cost of equity and cost of debt might change as financial leverage increases. This helps visualize the theoretical concept of an optimal capital structure where WACC is minimized.
For this plot, we will simulate increasing financial risk as debt increases:
- The cost of debt ($R_d$) will increase as the debt-to-capital ratio rises, reflecting higher perceived risk by lenders.
- The cost of equity ($R_e$) will also increase due to the increased financial risk passed on to equity holders. This can be approximated using the Hamada equation or by directly increasing $R_e$ as a function of debt.
# Re-using calculate_wacc function
# Define a range of debt-to-capital ratios (debt_weight in our WACC function)
debt_to_capital_ratios = np.linspace(0.0, 0.9, 100) # From 0% to 90% debt
# Base values for simulation (can be adjusted)
base_cost_equity = 0.10 # Base cost of equity without debt
base_cost_debt = 0.04 # Base cost of debt without debt
corporate_tax_rate = 0.25
# Arrays to store results
wacc_sim = []
re_sim = []
rd_after_tax_sim = []
# Simulate how cost of equity and debt might change with increasing leverage
# Simple linear increase for demonstration. In reality, it's more complex.
# As debt increases, both debt and equity become riskier, demanding higher returns.
for debt_ratio in debt_to_capital_ratios:
# Simulate increasing cost of debt with more leverage
current_cost_debt = base_cost_debt + (debt_ratio * 0.04) # Increases from 4% to 7.6%
# Simulate increasing cost of equity with more leverage
# A more rigorous approach would use the Hamada equation for unlevering/relevering beta
current_cost_equity = base_cost_equity + (debt_ratio * 0.05) # Increases from 10% to 14.5%
# Calculate after-tax cost of debt
current_rd_after_tax = calculate_cost_of_debt(current_cost_debt, corporate_tax_rate)
# Calculate WACC
# E/V = (1 - debt_ratio), D/V = debt_ratio
wacc_val = calculate_wacc((1 - debt_ratio), debt_ratio, current_cost_equity, current_cost_debt, corporate_tax_rate)
re_sim.append(current_cost_equity)
rd_after_tax_sim.append(current_rd_after_tax)
wacc_sim.append(wacc_val)
# Find the minimum WACC and the corresponding debt ratio
min_wacc = np.min(wacc_sim)
optimal_debt_ratio = debt_to_capital_ratios[np.argmin(wacc_sim)]
# Create the trend-based plot
plt.figure(figsize=(12, 7))
plt.plot(debt_to_capital_ratios * 100, np.array(re_sim) * 100, label='Cost of Equity (Re)', color='blue')
plt.plot(debt_to_capital_ratios * 100, np.array(rd_after_tax_sim) * 100, label='After-Tax Cost of Debt (Rd)', color='red')
plt.plot(debt_to_capital_ratios * 100, np.array(wacc_sim) * 100, label='WACC', color='green', linewidth=2)
# Highlight the optimal capital structure
plt.axvline(x=optimal_debt_ratio * 100, color='gray', linestyle='--', label=f'Optimal Debt Ratio: {optimal_debt_ratio:.1%}')
plt.scatter(optimal_debt_ratio * 100, min_wacc * 100, color='green', marker='o', s=100, zorder=5, label=f'Min WACC: {min_wacc:.2%}')
plt.title('WACC and Optimal Capital Structure')
plt.xlabel('Debt to Capital Ratio (%)')
plt.ylabel('Cost (%)')
plt.grid(True)
plt.legend()
plt.ylim(0, max(np.max(re_sim), np.max(rd_after_tax_sim), np.max(wacc_sim)) * 100 * 1.1) # Set y-axis limit for better visualization
plt.show()Interpretation of Figure 2: WACC and Optimal Capital Structure
This plot is a conceptual illustration of how a company's WACC can change with its capital structure, and it highlights the idea of an 'optimal' capital structure:
-
Cost of Debt (After-Tax) (Red Line): As the debt-to-capital ratio increases, the cost of debt initially remains relatively low due to the tax shield. However, as the company takes on more debt, its financial risk increases, causing lenders to demand higher interest rates, which is reflected in the upward slope of the red line.
-
Cost of Equity (Blue Line): Similarly, as financial leverage increases, the equity of the company becomes riskier. Equity investors demand a higher return to compensate for this increased risk, leading to a rising cost of equity, even if the business risk remains constant.
-
WACC (Green Line): The WACC line typically declines at lower debt levels because the cheaper, tax-deductible debt replaces more expensive equity. However, as debt levels become very high, the increasing costs of both debt and equity (due to higher financial risk) eventually outweigh the benefits of the tax shield, causing the WACC to increase. The lowest point on the WACC curve represents the optimal capital structure, where the company's cost of capital is minimized, and theoretically, its firm value is maximized.
It's important to remember that this is a simplified model for illustrative purposes. In reality, finding the exact optimal capital structure is complex and involves many other factors.
Conclusion
This notebook has provided a comprehensive overview of funding cost models, focusing on the calculation and interpretation of the Weighted Average Cost of Capital (WACC), the Cost of Equity (using CAPM and DDM), and the Cost of Debt. We've explored:
- The fundamental definitions and importance of understanding funding costs in financial decision-making.
- Detailed formulas and Python functions for calculating each component.
- Demonstrations with mock data to show practical application.
- Visualizations to illustrate the sensitivity of these costs to key drivers and the conceptual idea of an optimal capital structure.
Understanding a company's cost of capital is paramount for making informed investment decisions, optimizing financial structure, and ultimately maximizing shareholder wealth. While the models presented here are foundational, real-world application often involves more nuanced considerations and advanced techniques.