Learn R Programming

corpmetrics (version 1.0)

capm: Capital Asset Pricing Model (CAPM)

Description

Calculate if a stock is fairly valued based on Capital Asset Pricing Model (CAPM) returns.

Usage

capm(Rf,Ri,Rm)

Value

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.

Arguments

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.

Author

Pavlos Pantatosakis.

R implementation and documentation: Pavlos Pantatosakis pantatosakisp@yahoo.com.

Details

Use the same length for the three vectors.

References

Will Kenton (2024). Capital Asset Pricing Model (CAPM): Definition, Formula, and Assumptions. https://www.investopedia.com/terms/c/capm.asp

Examples

Run this code
##
# 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)

Run the code above in your browser using DataLab