L.10 WACC

Replicate the book case of WACC

WACC (weighted average cost of capital) - can be measured at market values and accounting values. You cannot mix them up. They are completely different in a way for counting, so if you mix them up you will get incorrect result that may be misleading. At market values you need both equity and debt of company and the cost of equity and the cost of debt. This measure tells the investors the rate of return they might expect with how much risk they would bare on their investment.

Example:

library(quantmod)
## Loading required package: xts
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo

Set User Agent (if necessary for your connection)

options(HTTPUserAgent = "igordros@icloud.com")

Load Microsoft stock data

getSymbols("MSFT") 
## [1] "MSFT"

Constants:

outstanding_shares <- 30000000 # Number of outstanding shares
market_cap <- last(MSFT$MSFT.Adjusted) * outstanding_shares
cost_of_debt <- 0.03 # 3% 
tax_rate <- 0.25 # 25% 
beta <- 1.1 # Beta of Microsoft's stock 
risk_free_rate <- 0.02 # 2% risk-free rate 
market_risk_premium <- 0.06 # 6% market risk premium 
market_value_of_debt <- 100e9 # $100 billion 

Calculations:

cost_of_equity <- risk_free_rate + beta * market_risk_premium


print(cost_of_equity)
## [1] 0.086
market_cap <- as.numeric(market_cap)

print(market_cap)
## [1] 1.2645e+10
total_market_value <- market_cap + market_value_of_debt


print(total_market_value)
## [1] 1.12645e+11

Total market value = 112,645,000,000 USD

weight_of_debt <- market_value_of_debt / total_market_value

print(weight_of_debt)
## [1] 0.8877447
weight_of_equity <- market_cap / total_market_value


print(weight_of_equity)
## [1] 0.1122553

WACC calculation

wacc <- (weight_of_debt * cost_of_debt * (1 - tax_rate)) + (weight_of_equity * cost_of_equity)

print(wacc)
## [1] 0.02962821

Output WACC

cat("WACC for Microsoft:", wacc * 100, "%\n")
## WACC for Microsoft: 2.962821 %