Equity Valuation in R
Cliff Ang
Senior Vice President, Compass Lexecon
Mathematically, the CAPM is as follows:
$$ E(R_i) = R_f + \beta_i (R_m - R_f) $$
where
Beta is typically estimated using a market model regression of the form:
$$ R_i = \alpha + \beta \times R_m $$
(unlike the CAPM, no risk-free rate in the market model!!!)
where
The regression is typically performed using
# Calculate stock return rets <- Delt(prices$firm_ret)
# Calculate market return rets$spy <- Delt(prices$spy)
# Rename first variable names(rets)[1] <- "firm_ret"
# Remove first observation - NA rets <- rets[-1, ]
# Run regression reg <- lm(myl ~ spy, data = rets)
# Extract beta beta <- summary(reg)$coeff[2]
Equity Valuation in R