R/cost_of_capital.R

Defines functions cost_of_equity wacc

Documented in cost_of_equity wacc

#' WACC
#' 
#' Calculates the weighted average cost of capital
#'
#' @param debt_to_equity 
#' @param cost_of_debt 
#' @param cost_of_equity 
#' @param tax_rate 
#'
#' @return
#' @export
#'
#' @examples
wacc <- function(debt_to_equity, cost_of_debt, cost_of_equity, tax_rate) {
  
  
  debt_ratio = debt_to_equity / (1 + debt_to_equity)
  
  debt_share = cost_of_debt * (1 - tax_rate) * debt_ratio
  
  equity_share = cost_of_equity * (1 - debt_ratio)
  
  debt_share + equity_share
  
}

#' Cost of equity
#'
#' @param rf 
#' @param beta 
#' @param market_risk_premium 
#'
#' @return
#' @export
#'
#' @examples
cost_of_equity <- function(rf, beta, market_risk_premium) {
  
  rf + beta * market_risk_premium
  
}
olaoritsland/finmod documentation built on Dec. 22, 2021, 4:18 a.m.