liveBook · Manning

Beta

As explained in Build a Robo-Advisor with Python (From Scratch)

Beta is a measure of an asset's sensitivity to movements in the overall market, with the market portfolio conventionally assigned a beta of one.

Beta measures an investment’s sensitivity to market movements. The market portfolio has beta 1; a beta below 1 indicates lower market sensitivity, while a beta above 1 indicates greater sensitivity. Utilities and household-staple producers are cited as lower-beta businesses, whereas luxury-goods companies may have higher betas. section 3.1.2

In the capital asset pricing model (CAPM), beta turns market exposure into an expected-return estimate: E[r] = rf + β(E[rm] − rf). The estimate combines the current risk-free rate, expected market return, and the stock’s beta; beta scales the market risk premium rather than guaranteeing a realized return. section 3.1.2

Listing 3.3 Regressing stock returns on market returns to get beta
import statsmodels.api as sm

stock_prices_monthly = stock_prices.resample('MS').first()  #1
mkt_prices_monthly = mkt_prices.resample('MS').first()
aapl_returns_monthly = stock_prices_monthly['AAPL'].pct_change()  #2

mkt_returns_monthly = mkt_prices_monthly.pct_change()
y = (aapl_returns_monthly - rf['TB3MS']/100/12).dropna()  #3
X = (mkt_returns_monthly - rf['TB3MS']/100/12).dropna()  #4
model = sm.OLS(y,X)  #5
results = model.fit()  #6
print(results.summary())  #7

Estimate beta by regressing a stock’s monthly excess returns on monthly market excess returns. The fitted slope is the beta estimate; the implementation uses SPY as the market proxy, 3-month T-Bill rates for the risk-free rate, and ordinary least squares. section 3.1.2

CAPM estimates for three stocks

AAPL’s estimated beta is 1.3187, producing an 8.96% CAPM expected return under the stated inputs. FE and WMT have lower betas, 0.2958 and 0.4907, with CAPM expected returns of 6.10% and 6.64%. Their historical expected returns differ substantially, illustrating that a CAPM estimate is not simply a historical average. section 3.1.2

Beta is also the slope in a regression that separates market-related return from alpha: r − rf = α + β(rm − rf) + ε. Alpha is the intercept, while beta captures exposure to the market factor. This is a single-factor model; multifactor models add factors beyond market exposure. section 7.2.2

Practical considerations when using beta include:

  • Use a market-return proxy and align its return frequency with the investment’s returns before regression. section 3.1.2
  • Subtract the risk-free rate from both stock and market returns when estimating the CAPM regression shown here. section 3.1.2
  • Treat beta-based expected returns as one alternative to historical-average estimates when building traditional asset-allocation inputs. section 3.3

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Defines beta, interprets low and high values, and implements an excess-return OLS regression without detailing regression diagnostics.
Examples
Uses AAPL, FE, and WMT, SPY market data, 3-month T-Bill rates, and an AAPL beta of 1.3187.
What it assumes
Assumes familiarity with returns and Python data tools while demonstrating the beta-estimation workflow incrementally.
What you can do after
Apply it via pandas-datareader, yfinance, and statsmodels to estimate beta and calculate CAPM expected returns.
How it connects
Connects beta to CAPM, risk-free rates, market returns, alpha, single-factor models, and multifactor models.

Also explained in

Compare how 2 books explain beta →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.