CAPM

Ajay krishnan
9 min readMay 28, 2022

Capital Asset Pricing Model (CAPM) generates expected returns for the assets given the risk of those assets and cost of capital.

Todays topic is about Capital Asset Pricing Model or CAPM for short. Previously we talked about Portfolios, Asset Allocation and Stock Market Data Analysis. On that tutorial we randomly allocate weights for the securities in our portfolio and did some analysis. Today we are going continue from where we left off and learn how to calculate the expected return of a portfolio using the CAPM formula in order to make good investment decisions.

[ Link ] : Portfolios, Asset Allocation and Stock Market Data Analysis.

A delayed investment is a lost opportunity

A sum of money is worth more now than the same sum of money in the future. We all want capital appreciation and we all know that the money doesn’t grow sitting idle , but it can grow through investing. So a delayed investment is a lost opportunity.

A simple example is the money in our banks. The banks give us capital appreciation in the form of interest. All we have to do is put them in bank , in your saving account or something.

So if we have money , we should invest and make more money ? huh ??

what are the factors affecting investment decisions :

  • Personal goals
  • Level of risk tolerance
  • Investment time-span or horizon.

What if you are risk averse ?

If the investor is risk averse, investing in fixed income securities like bonds would be a good idea, because bonds offer a stream of return on a fixed schedule. The amount of the payout could vary though.

What if you are ready to take some risk ?

if investor is ready to take some risk , depending on the time span of investment you could invest in equities / stocks.

Stocks/Equities have risk associated with them , but they offer much interest than fixed income securities like bonds. This is how an investor get compensation for taking the risk.

How much risk is good , the bad and the ugly ?

The Capital Asset Pricing Model (CAPM) describes the relationship between systematic risk and expected return for assets, particularly stocks.

Capital Asset Pricing Model (CAPM) is a financial model describes the link between expected returns on an investors assets and systematic risk associated with them. CAPM indicates that the expected return on a security is equal to the risk free return plus a risk premium.

CAPM formula
  • The risk-free rate in the CAPM formula represent the yield on a long term government bond (fixed income security).
  • The other components of the CAPM formula account for the investor taking on additional risk.

Did this big equation above scare you ?

Are you familiar with the equation of a line ?

Yes it’s just that : Equation of line

Equation of a line

Y = slope*X + y-intercept

  • beta is like the slope
  • risk-free rate is like the y-intercept
CAPM diagram CFI

What is the use of CAPM formula ?

The CAPM formula is used for calculating the expected returns of an asset.

  • New ultraprecise measurements show that the asteroid Bennu has a higher chance than thought of impacting our planet sometime in the next 300 years, NASA says. [ link ] The study finds a 1-in-1,750 chance of a future collision over the next three centuries.
  • Any four random people sharing a birthday in the same month (the odds of this are 1 in 1,750 exactly).

What I’m trying to convey is not about dino killing asteroids but about the uncertainty. There is an inherent risk associated with the decisions you make in the present because future is uncertain. You can’t bet a 100$ and flip a coin expecting it to come heads every time. If you get head twice, that in no way make it more likely to get a head the third time. The probability of coin flip is 0.5 for head and 0.5 for tail , its equally likely.

But why are the casinos always winning..? If we know the probabilities, then game is predictive in the long run. What I mean is, the uncertainty is kind of gone in the long run. If you flip a coin a million times, about half a million times you will get heads and half a million times you will get tails.

This is why when making investing decisions you’ve take into account the associated risk. If you are young and saving for a long-term goal such as retirement, you may want to hold more stocks than bonds. Investors nearing or in retirement may want to hold more bonds than stocks.

The big picture one should understand is that, there is a risk in investing. and understand this risk is the key, because riskier the stock is , more the interest.

Why do companies issue stock?

Companies issue stock to get money for various things, which may include:

  • Paying off debt
  • Launching new products
  • Expanding into new markets or regions
  • Enlarging facilities or building new ones

Stocks offer investors the greatest potential for growth (capital appreciation) over the long haul. Investors willing to stick with stocks over long periods of time, say 15 years or more, generally have been rewarded with strong, positive returns.

But stock prices move down as well as up. There’s no guarantee that the company whose stock you hold will grow and do well, so you can lose money you invest in stocks.

When investing, investors desire a higher reward when taking on more risky investments. The expected return of an asset should take into account the risk investors take and the compensation they get for taking the risk. This is exactly what CAPM does.

Understanding CAPM

Ra = Expected return on a security/asset
Rf = Risk-free return
Beta = Beta of the security
Rm = Expected return of the market

Ra = Rf + Beta( Rm-Rf)

“Expected return” is a long-term assumption about how an investment will play out over its entire life, denoted by Ra in the equation.

“Risk free return” typically equal the yield on fixed income security issued by government, denoted by Rf.

“Risk Premium” The amount an investor get in excess of the risk free return , denoted by (Rm — Rf). The more volatile a market or an asset class is, the higher the market risk premium will be.

  • The risk premium represents the additional return over and above the risk-free rate, which is required to compensate investors for investing in a riskier stock.

“Beta” is a measure of volatility of stock. The Beta reflect the sensitivity of the stock price to the overall market. In other words, it is the stock’s sensitivity to market risk.

  • if Beta = 1.0, the price of the security is correlated positively with the market, means the expected return on a security is equal to the average market return.
  • if Beta > 1.0, #AGGRESSIVE, The security is more volatile than the market. For example if beta is 2.0 , it implies the security is twice as volatile as the market.
  • if Beta < 1.0, #DEFENSIVE, The security is negatively corelated with market. In other words the security is less volatile compared to the market.

CAPM Example — Calculation of Expected Return

Example : 1

Suppose the following information about a stock is known:

  • It trades on the NYSE and its operations are based in the United States
  • Current yield on a U.S. 10-year treasury is 2.5%
  • Rm = 12.4% , average market return of S&P500 over an year
  • Beta = 1.11, meaning its average return is 1.11x as volatile as the S&P500

Expected return = Risk Free Rate + [Beta * Market Risk Premium]

Expected return = 2.5% + 1.11 ( 12.4% — 2.5% ), which give us 13.4%

The next example is taken from CFI website [link]

Example : 2

Suppose the following information about a stock is known:

  • It trades on the NYSE and its operations are based in the United States
  • Current yield on a U.S. 10-year treasury is 2.5%
  • The average excess historical annual return for U.S. stocks is 7.5%
  • The beta of the stock is 1.25 (meaning its average return is 1.25x as volatile as the S&P500 over the years)

Expected return = Risk Free Rate + [Beta * Market Risk Premium]

Expected return = 2.5% + [1.25 x 7.5%] , which give us = 11.9%

Now that we understand the CAPM formula, lets apply the CAPM formula to calculate the expected return of portfolio. Lets use the same dataset which we’ve worked with in the pervious tutorial. All the links are provided below.

Expected return of a portfolio

We are going to work with the same dataset from the previous tutorial. This dataset give us information about stock prices of different companies from 2012 to 2020.

Link to the notebook : Github

[ Link ] : Portfolios, Asset Allocation and Stock Market Data Analysis.

Dataset

In order to perform further operations on the data we have to normalize the prices based on the initial price.

def normalize_the_price(df):
"""normalize the prices based on the initial price
"""
historic_data = df.iloc[:,1:].copy()
start = df.iloc[0,1:]

return historic_data/start
Data : securities in our portfolio

Stocks daily return

You may calculate daily stock returns to monitor the magnitude of this change. The daily return measures the dollar change in a stock’s price as a percentage of the previous day’s closing price. A positive return means the stock has grown in value, while a negative return means it has lost value.

def get_stock_daily_return(df):
h = df.copy()
h_shifted = h.shift().fillna(0)
# Calculate the percentage of change from the previous day
r = ((h - h_shifted)/h_shifted)*100
r.iloc[0] = 0
return r.astype(np.float64)
Stocks daily return

Risk free return

# Current yield on a U.S. 10-year treasury is 2.5%
rf = 0.025

Market return


# Market return
# average daily rate of return for S&P500
market = stocks_daily_return['sp500']
print('Mean of market daily return',market.mean())
# Let's calculate the annualized rate of return for S&P500
# Note that out of 365 days/year, stock exchanges are closed for 104 days during weekend days (Saturday and Sunday)
# Apart from the weekends, there are other holidays.
rm = stocks_daily_return['sp500'].mean() * 252print('Annualized rate of return for S&P500 ',rm)

Beta

The Beta reflect the sensitivity of the stock price to the overall market.

Beta is a measure of volatility
beta = {}
for stock in stocks:
security = stocks_daily_return[stock]
market = stocks_daily_return['sp500']
slope, y_intercept = np.polyfit(market, security, deg=1)
beta[stock]=slope
plt.bar(beta.keys(),beta.values());
plt.axhline(y=1.0, c='r');
Beta of different securities in the portfolio

Expected Return

expected_return = {}for stock in stocks:
er = rf+(beta[stock]*(rm-rf))
expected_return[stock] = er
# expected_return output
{'AAPL': 13.827796928268592,
'AMZN': 12.325120578537051,
'BA': 17.17619530010068,
'GOOG': 12.860259462543615,
'IBM': 11.936674353150185,
'MGM': 20.533594501402906,
'T': 9.26036498686519,
'TSLA': 15.759167230150451}

Portfolio expected return

Lets find out the expected return of the portfolio, assume that we assign equal weights to all the securities.

# Lets assign equal weights to all of them
weight = 1/len(stocks)
weights = weight*np.ones(len(stocks))

# weights output
[0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125]
# Expected return of the portfolio
er = np.dot(np.array(list(expected_return.values())), weights)
# output
Expected return of the portfolio : 14.209896667627333

--

--