Rolling Beta for AI Semiconductor Stocks: OLS vs Blume vs Kalman in Python

Rolling Beta for AI Semiconductor Stocks: OLS vs Blume vs Kalman in Python
Same ticker, same 60-day window, same market proxy — three different numbers. On the final day of the sample AMD’s beta is 4.054 from rolling OLS, 3.046 after the Blume adjustment, and 2.855 from a one-state Kalman filter. NVDA’s OLS estimate is not calmer: across the same run it ranges from 1.365 to 3.375. This post implements all three estimators, runs them on public daily data on 2026-11-21, reports the measured table, and shows why the MSE differences are too small to crown a winner.
Data and verification. All series are yfinance daily adjusted closes for NVDA, AVGO, AMD, TSM and MU, with SPY as the market proxy, covering closes from 2024-01-02 to 2026-11-20 — 725 daily log returns from 2024-01-03 to 2026-11-20. The script beta_compare.py fetched the data and produced beta_results.json; we ran the script on public daily data on 2026-11-21, and statsmodels v0.15.0 docs were consulted. Not verified: pykalman’s docs returned a 404 at fetch time, and the Blume (1975) original on JSTOR was not re-read, so Blume facts arrive via the CFI and wraquant pages; wraquant is secondary corroboration only.
Why beta drifts
Beta is a covariance-over-variance ratio recomputed on a moving sample; as the window rolls forward the ratio changes, and for high-beta semiconductors the swings are wide. Estimator choice then layers a second source of divergence on top of that drift.
Beta is not a property of a company; it is a property of a sample. We recompute β = Cov(r_asset, r_market) / Var(r_market) on a 60-day rolling window of daily log returns, which means every day drops one observation and adds another. The numerator and denominator both move, and they do not move together, so the ratio wobbles even when the underlying relationship is stable. On our run NVDA’s rolling OLS beta travelled from 1.365 to 3.375 inside a single ~2.9-year window.
Three forces drive that drift. The first is the intervalling effect described by the Corporate Finance Institute: betas differ across return frequencies, and at short intervals illiquid stocks tend to understate beta while liquid stocks overstate it. We did not test the intervalling effect here; daily returns are used throughout.
The second is index choice. The same CFI page notes the S&P 500 covers 500 of thousands of traded equities, so “the” market return depends on which proxy you pick; we used SPY and nothing else.
The third is regime. Our window spans the 2025–2026 AI-chip rally, and the betas below are estimated across that period. A rolling estimator reports any shift in co-movement as beta drift. Once the sample is this unstable, the estimator you layer on top becomes a visible second-order choice — which is the rest of this post.
The three estimators
Rolling OLS re-fits the covariance and variance ratio in every window; Blume shrinks each estimate toward one with fixed weights; the Kalman filter treats beta as a random-walk state updated daily. They differ in assumptions, not ambition, and none is inherently more accurate.
Rolling OLS
Beta is covariance over variance, computed separately on each window:
β = Cov(r_asset, r_market) / Var(r_market)
Rolling OLS simply re-fits that ratio on each 60-day slice. The statsmodels RollingOLS docs matter for the implementation details: the exog argument does not include an intercept by default, so you must pass add_constant(x) yourself, and window must be strictly larger than the number of variables. The v0.15.0 documentation also notes the class was “Tested against OLS for accuracy” and warns that results may differ from OLS on windows where the model has an implicit constant. We keep the default missing='drop' and a fixed 60-day window.
Rolling OLS is the least opinionated of the three: no shrinkage, no state-space prior, no tuning. Every value in the OLS column is a plain least-squares fit on the last 60 observations.
Blume-adjusted beta
The adjustment is one line:
Adjusted Beta = 0.67 × Regression Beta + 0.33 × 1.00
Provenance matters here. Per the Corporate Finance Institute, Blume’s 1975 paper “Betas and Their Regression Tendencies” found that betas tend to converge toward 1, and reached that by regressing period-2 betas on period-1 betas; the 0.67 / 0.33 form is the Bloomberg-style adjustment. The wraquant beta module implements the same arithmetic as 0.33 + 0.67 * raw_beta and cites Blume (1971) “On the Assessment of Risk” alongside the 1975 paper.
Two things to hold onto. The weights are a convention from the literature, not an estimate from our data, and they pull every beta toward 1 by construction — a raw 4.054 becomes 3.046 regardless of what the sample says. And the primary 1975 paper was not re-read for this post; the facts above arrive through CFI and wraquant.
Kalman filter beta
The filter treats beta as a hidden state that wanders:
b_t = b_(t−1) + w, w ~ N(0, q) y_t = b_t · x_t + v, v ~ N(0, r)
The scalar update for each day is four lines, with H the day’s market log return:
P = P + q; K = P·H / (H·P·H + r); b = b + K·(y − b·H); P = (1 − K·H)·P
The FilterPy KalmanFilter docs describe the general route: build KalmanFilter(dim_x, dim_z), set Q, R, F and H, then alternate predict() and update(z), with Q_discrete_white_noise in filterpy.common available for the process covariance. We used a hand-rolled one-state loop instead, because with dim_x = dim_z = 1 the explicit update is shorter than the object setup.
The setting that matters most: q = 1e-5 and r = 1e-4 are hand-picked, not fitted. Nothing in this run optimised them. Because the state is a random walk with small process noise, the resulting path is smooth by design — not because it is more correct.
Python implementation
statsmodels’ RollingOLS does not add an intercept for us, so the market return column has to pass through add_constant first; with window set to 60 on daily log returns, fit().params then yields one intercept and one beta per window, starting on the sixtieth day.
Rolling OLS with statsmodels
import numpy as np
import pandas as pd
import yfinance as yf
from statsmodels.regression.rolling import RollingOLS
from statsmodels.tools import add_constant
TICKERS = ["NVDA", "AVGO", "AMD", "TSM", "MU"]
px = yf.download(TICKERS + ["SPY"], start="2024-01-02", end="2026-11-21",
auto_adjust=True)["Close"]
rets = np.log(px).diff().dropna() # 725 daily log returns, 2024-01-03 .. 2026-11-20
x = rets["SPY"].to_numpy() # market proxy
y = rets["NVDA"].to_numpy() # swap for each ticker
# exog excludes the intercept by default; window must exceed the parameter count
res = RollingOLS(y, add_constant(x), window=60).fit()
params = res.params # col 0 = intercept, col 1 = beta
Blume in one line
Once the per-window OLS betas exist, the shrinkage is arithmetic:
beta_raw = params[:, 1] # per-window OLS beta
beta_adj = 0.67 * beta_raw + 0.33
A one-state Kalman loop
q, r = 1e-5, 1e-4 # process and measurement noise: hand-picked, not fitted
b, P = 1.0, 1.0 # state (beta) and its variance
kalman_beta = []
for t in range(len(x)):
H = x[t] # today's market log return
yt = y[t] # today's asset log return
P = P + q
K = P * H / (H * P * H + r)
b = b + K * (yt - b * H)
P = (1 - K * H) * P
kalman_beta.append(b)
Measured results
Across 725 daily log returns with a 60-day window, raw OLS beta means ran from 1.879 for TSM to 2.605 for MU; Blume shrank every mean toward one; Kalman tracked the OLS means, and its standard deviation was lower for every ticker (0.185–0.394 against 0.454–0.776). The MSE gaps were 0.2%–3% of each other, so there is no forecasting winner.
| Ticker | OLS beta mean (std, min–max) | Blume mean | Kalman mean (std, min–max) | Last day OLS / Blume / Kalman | Daily one-step MSE ×1e4 OLS / Blume / Kalman |
|---|---|---|---|---|---|
| NVDA | 2.156 (0.540, 1.365-3.375) | 1.774 | 2.338 (0.394, 1.905-3.035) | 1.952 / 1.638 / 2.013 | 5.412 / 5.342 / 5.251 |
| AVGO | 2.214 (0.469, 1.218-3.457) | 1.813 | 2.192 (0.260, 1.927-2.703) | 2.372 / 1.919 / 2.122 | 6.531 / 6.533 / 6.433 |
| AMD | 2.484 (0.754, 1.229-4.896) | 1.994 | 2.218 (0.217, 1.922-2.855) | 4.054 / 3.046 / 2.855 | 9.193 / 9.441 / 9.311 |
| TSM | 1.879 (0.454, 0.709-3.068) | 1.589 | 1.757 (0.185, 1.498-2.244) | 2.241 / 1.832 / 1.937 | 3.991 / 3.987 / 3.967 |
| MU | 2.605 (0.776, 1.206-5.091) | 2.075 | 2.248 (0.244, 1.543-2.834) | 3.241 / 2.501 / 2.834 | 12.100 / 12.225 / 11.971 |
Three observations. AMD’s last-day trio of 4.054 / 3.046 / 2.855 is endpoint sensitivity in its purest form: identical closing prices, three answers, because OLS sees only the final 60 sessions while the Kalman state carries memory of earlier ones. MU shows both the widest OLS dispersion (std 0.776) and the widest OLS range (1.206-5.091), which is what a beta touching five looks like while the window rolls. TSM is the tightest row on every axis, including the lowest MSE values at 3.991 / 3.987 / 3.967.
The differences in the MSE columns are 0.2%–3% of each other. That is no meaningful difference on this sample, and it is not enough to support a forecasting winner.
Caveats
Every figure above comes from one sample, one 60-day window specification, and one market proxy. The honest summary is that there is no meaningful difference on this sample, and the list below sets out what that does and does not support.
- The MSE spread is 0.2%–3%, which is not evidence that the Kalman estimator forecasts better. Read the column as a tie, not a ranking.
- q = 1e-5 and r = 1e-4 are hand-picked, not fitted. A different pair would move the Kalman path, and we did not sweep them.
- Blume’s 0.67 / 0.33 weights are a literature convention that pulls every beta toward 1 by construction. They encode a prior, not a measured property of these names.
- The price data is one ~2.9-year window that includes the 2025–2026 AI-chip rally, so betas are regime-dependent and nothing here says they will hold in a different one.
- Kalman standard deviations of 0.18–0.39 against OLS’s 0.45–0.78 mean smoothness is the observed difference, not accuracy.
- This is a methodology post with measured results. It is not investment advice, and it makes no position sizing or return claims.
FAQ
Three questions matter before anyone uses these numbers: which estimator to use, why the Kalman path is so much smoother, and how much a different window or market proxy would change the answers. Each short answer below stays inside what this sample can actually support.
Which estimator should I use for AI semiconductor stocks?
No single estimator wins on forecasting in this sample, so the choice comes down to operational needs. Rolling OLS is the simplest to explain and audit. The Blume adjustment is the cheapest shrinkage: it pulls every beta toward one by construction. The Kalman filter produces the smoothest path, but it obliges you to defend q and r values that were not fitted here.
Why is the Kalman beta so much smoother than the OLS beta?
Because the filter models beta as a random-walk state rather than an independent per-window fit. Each day nudges the previous estimate instead of replacing it, so the path inherits memory. The measured spread shows it: Kalman standard deviations run 0.18–0.39 against 0.45–0.78 for OLS. That is smoothness by design, not evidence of accuracy.
Would a different window or index change the answer?
Very likely, though we did not test it. The CFI intervalling note says betas differ across return frequencies, and index choice matters because the S&P 500 covers 500 of thousands of traded equities — SPY is one proxy, not the market. A different window length would also change how much of the 2025–2026 AI-chip rally each estimate absorbs.
Sources
The four links below are the only external references used, and every number in the results table comes from the run recorded in beta_results.json. Data provenance is listed after the links so the sample can be reconstructed and re-run independently.
- statsmodels RollingOLS docs — v0.15.0, signature and intercept/window notes.
- FilterPy KalmanFilter docs — predict/update loop and
Q_discrete_white_noise. - Corporate Finance Institute — Adjusted Beta — published 2020-07-13; Blume (1975), the 0.67 / 0.33 form, intervalling and index-choice notes.
- wraquant beta module — secondary corroboration for
0.33 + 0.67 * raw_beta.
Data provenance: yfinance daily adjusted closes for NVDA, AVGO, AMD, TSM and MU, with SPY as the market proxy, 2024-01-02 to 2026-11-20, producing 725 daily log returns; beta_compare.py fetched the series on 2026-11-21 and wrote the raw output to beta_results.json. Methodology post with measured results, not investment advice.


