Regression Analysis for Financial Relationships › Factor Exposures and the CAPM Beta
Quantitative FinanceAll chapters Regression Analysis for Financial Relationships › Factor Exposures and the CAPM BetaOne section · Sections in this chapter3 / 12 ↓
The single most important application of regression in finance is estimating how an asset responds to systematic risk factors. This relationship, called factor exposure or factor loading, tells us how much of an asset's return can be explained by common factors versus idiosyncratic risk. Understanding factor exposures is essential for portfolio construction, risk management, and performance evaluation. You cannot diversify away systematic risk, so these exposures determine how much of that risk a portfolio carries.
The Market Model
The simplest factor model relates individual stock returns to market returns. This approach, developed in the early days of modern finance, recognizes that stocks tend to move together because they are all affected by common economic forces. Broad market movements, driven by changes in interest rates, economic growth expectations, and investor sentiment, influence virtually all stocks to varying degrees.
where:
- : return on stock at time
- : return on the market index
- : beta coefficient, measuring sensitivity to market movements
- : alpha coefficient, measuring return unexplained by the market
- : idiosyncratic error term
This is called the market model or single-index model. The coefficient measures the stock's systematic risk, representing how much the stock moves when the market moves. A stock with rises 1.2% on average when the market rises 1%, and falls 1.2% when the market falls 1%. This amplification makes high-beta stocks more volatile than the market and more risky in a portfolio context. Conversely, a stock with is defensive: it dampens market movements rather than amplifying them.
The idiosyncratic error term captures firm-specific events: earnings surprises, management changes, product launches, and other news that affects only this particular company. Unlike systematic risk, idiosyncratic risk can be diversified away by holding many stocks, because positive surprises at some firms offset negative surprises at others.
The beta coefficient measures an asset's sensitivity to market movements. Mathematically, it equals the covariance of the asset's return with the market return, divided by the variance of the market return:
where:
- : beta coefficient for asset
- : covariance between asset and market returns
- : variance of market returns
This formula has a clear interpretation. The numerator measures how the asset and market move together. The denominator normalizes by market volatility. A stock that moves perfectly with the market, with the same magnitude, has beta equal to one. The market portfolio itself always has a beta of exactly one.
Excess Returns and the CAPM
The Capital Asset Pricing Model, which we'll derive formally in Part IV, states that the expected excess return on any asset should be proportional to its beta. This fundamental result connects risk and return: assets with higher systematic risk must offer higher expected returns to compensate investors for bearing that risk. The CAPM gives the theoretical foundation for using beta as a measure of risk.
where:
- : expected excess return on asset
- : expected market risk premium
- : risk-free interest rate
- : asset's beta
The left side represents the expected return above the risk-free rate, which is the premium investors demand for taking risk. The right side says this premium should equal beta times the market risk premium. An asset with beta of 1.5 should earn 1.5 times the market risk premium, because it carries 1.5 times the market's systematic risk.
To test this empirically, we regress excess returns:
where:
- : excess return on asset
- : excess return on the market portfolio
- : Jensen's alpha measuring abnormal performance
- : systematic risk exposure
- : idiosyncratic error term
If the CAPM holds, the intercept should be zero. This is because all expected return should be explained by beta exposure to the market. A significantly positive alpha suggests the stock earns more than its risk-adjusted required return: it generates excess risk-adjusted performance. A negative alpha means the stock underperforms relative to its risk. This interpretation makes alpha regression one of the most scrutinized statistical tests in investment management. Every active manager claims to generate alpha, and every client wants evidence to support that claim.
Implementing Beta Estimation
Let's estimate the market beta for a stock using historical data. We'll use synthetic data that mimics realistic return characteristics.
import numpy as np
import pandas as pd
# Set random seed for reproducibility
np.random.seed(42)
# Generate synthetic market returns (daily, 2 years)
n_days = 504
market_returns = np.random.normal(
0.0004, 0.012, n_days
) # ~10% annual return, 19% vol
# Generate stock returns with true beta = 1.3, alpha = 0.0002 (small positive)
true_beta = 1.3
true_alpha = 0.0002
idiosyncratic_vol = 0.015
stock_returns = (
true_alpha
+ true_beta * market_returns
+ np.random.normal(0, idiosyncratic_vol, n_days)
)
# Create DataFrame
dates = pd.date_range(start="2022-01-01", periods=n_days, freq="B")
df = pd.DataFrame(
{
"date": dates,
"market_return": market_returns,
"stock_return": stock_returns,
}
)Now we estimate the regression using both manual calculation and statsmodels:
# Manual OLS calculation
x_mean = df["market_return"].mean()
y_mean = df["stock_return"].mean()
# Calculate beta (covariance / variance)
covariance = (
(df["market_return"] - x_mean) * (df["stock_return"] - y_mean)
).sum()
variance = ((df["market_return"] - x_mean) ** 2).sum()
beta_manual = covariance / variance
# Calculate alpha
alpha_manual = y_mean - beta_manual * x_mean
# Calculate fitted values and residuals
fitted_values = alpha_manual + beta_manual * df["market_return"]
residuals = df["stock_return"] - fitted_valuesManual OLS Estimation: Beta: 1.3698 (true: 1.3) Alpha: 0.000707 (true: 0.0002) Residual standard deviation: 0.014560 True idiosyncratic vol: 0.015000
The manual estimates closely match the true parameters used to generate the data, confirming the accuracy of the OLS formulas.
Let's also use statsmodels for a complete regression output:
import statsmodels.api as sm
# Add constant for intercept
X = sm.add_constant(df["market_return"])
y = df["stock_return"]
# Fit OLS regression
model = sm.OLS(y, X).fit() OLS Regression Results
==============================================================================
Dep. Variable: stock_return R-squared: 0.552
Model: OLS Adj. R-squared: 0.552
Method: Least Squares F-statistic: 619.7
Date: Sun, 02 Aug 2026 Prob (F-statistic): 1.09e-89
Time: 08:00:11 Log-Likelihood: 1417.0
No. Observations: 504 AIC: -2830.
Df Residuals: 502 BIC: -2822.
Df Model: 1
Covariance Type: nonrobust
=================================================================================
coef std err t P>|t| [0.025 0.975]
---------------------------------------------------------------------------------
const 0.0007 0.001 1.088 0.277 -0.001 0.002
market_return 1.3698 0.055 24.894 0.000 1.262 1.478
==============================================================================
Omnibus: 0.311 Durbin-Watson: 1.998
Prob(Omnibus): 0.856 Jarque-Bera (JB): 0.397
Skew: 0.052 Prob(JB): 0.820
Kurtosis: 2.909 Cond. No. 84.8
==============================================================================
Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.The regression output provides the coefficient estimates along with standard errors, t-statistics, and p-values. Let's visualize the relationship:

The scatter plot shows that stock returns move in the same direction as market returns but with greater magnitude, consistent with a beta above 1. The stock amplifies market movements by approximately 30%.
To understand the economic meaning of different beta values, consider how stocks with varying market sensitivities respond to the same market movement:
