capm | R Documentation |
Calculate if a stock is fairly valued based on Capital Asset Pricing Model (CAPM) returns.
capm(Rf,Ri,Rm)
Rf |
A numerical vector with the risk-free rates. |
Ri |
A numerical vector with the yields of the asset. |
Rm |
A numerical vector with the yields of the market. |
Use the same length for the three vectors.
A data.frame including the required return based on Capital Asset Pricing Model (CAPM), the expected (mean) return of the asset and the asset's beta. Lastly, the stock's valuation is assessed: the stock is considered overvalued if the required return exceeds the expected return, and undervalued if the expected return is higher than the required return.
Pavlos Pantatosakis.
R implementation and documentation: Pavlos Pantatosakis pantatosakisp@yahoo.com.
Will Kenton (2024). Capital Asset Pricing Model (CAPM): Definition, Formula, and Assumptions. https://www.investopedia.com/terms/c/capm.asp
##
# Example usage
Rf <- rnorm(250, 0.03, 0) # Constant 3% risk free rate
Ri <- rnorm(250, 0.13, 0.10) # Asset under study
Rm <- rnorm(250, 0.09, 0.04) # Market's (can be an index) returns
example <- capm(Rf,Ri,Rm)
print(example)
#You can add a data.frame with real data
#Choose a vector with the risk free rate (Rf)
#Choose a vector with the stock returns (Ri)
#Choose a vector with the market returns (Rm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.