In 2023, the Fama-French 5-factor model could explain only 35% of NVIDIA's weekly return variation. In 2024, it explained 82%. That gap tells you something important: NVIDIA's 2023 surge was driven primarily by a narrative that no systematic factor had yet priced in - the sudden recognition that GPU scarcity would define AI infrastructure for years. By 2024, that insight had diffused into the market factor itself, and the stock began behaving like a large-cap bellwether rather than a thematic trade.
The Fama-French 5-factor model is the most widely used framework for decomposing stock returns into systematic components. Instead of asking "did this stock go up?", it asks "how much of that return is explained by exposure to known risk premia, and how much is specific to the company?" The answer has implications for both portfolio construction and for understanding whether outperformance is repeatable.
This article runs the model on NVIDIA, Apple, and Microsoft using the Finance Toolkit, interprets what each factor says about each company, and draws out the most useful comparisons across the three. For more information on the Finance Toolkit, have a look here. To explore the Finance Toolkit MCP, see here.
The Five Factors
Before running any code, it helps to have the five factors clearly defined. Each represents a systematic source of return that the model holds responsible for a portion of a stock's performance.
| Factor | Full Name | What it measures | Negative slope means |
|---|---|---|---|
| Mkt-RF | Market Risk Premium | Excess return of the broad market over the risk-free rate. Slope ~= market beta. | Less market-sensitive than average |
| SMB | Small Minus Big | Historical premium of small-cap stocks over large-cap stocks. | Large-cap orientation - underperforms when small-caps lead |
| HML | High Minus Low | Historical premium of value stocks (high book-to-market) over growth stocks. | Growth stock - underperforms when value leads |
| RMW | Robust Minus Weak | Historical premium of high operating profitability over weak profitability. | Returns not well explained by current realized earnings |
| CMA | Conservative Minus Aggressive | Historical premium of low-investment firms over high-investment firms. | Aggressive reinvestor - heavy capex or R&D spend |
Setting Things Up
Start by installing the Finance Toolkit:
pip install financetoolkit
Then import the library and create a Toolkit instance for all three stocks:
from financetoolkit import Toolkit
companies = Toolkit(
tickers=["NVDA", "AAPL", "MSFT"],
api_key="YOUR_FMP_API_KEY",
start_date="2019-01-01"
)
Get your FMP API key at jeroenbouma.com/fmp. The free plan covers five years of history; the full 2019-2026 dataset used here requires a paid plan.
Running the Fama-French Model
The Finance Toolkit exposes the Fama-French model through the performance module. Setting period="yearly" runs a separate regression for each calendar year, which reveals how factor exposures shift over time.
ff5 = companies.performance.get_fama_and_french_model(
period="yearly",
method="multi"
)
Which returns:
| Factor | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 |
|---|---|---|---|---|---|---|---|---|
| Mkt-RF | 0.0173 | 0.0263 | 0.0102 | 0.0131 | 0.0087 | 0.0120 | 0.0110 | 0.0109 |
| HML | -0.0077 | -0.0113 | -0.0030 | -0.0098 | -0.0058 | -0.0045 | -0.0061 | -0.0027 |
| RMW | -0.0032 | 0.0051 | 0.0015 | 0.0031 | 0.0073 | -0.0018 | 0.0041 | 0.0015 |
| R² | 0.5252 | 0.5657 | 0.6199 | 0.7596 | 0.3489 | 0.8245 | 0.7248 | 0.6659 |
NVDA only, selected factors shown. Full output includes SMB, CMA, Intercept, and MSE for all three tickers.
Several patterns are immediately visible. The Mkt-RF slope peaked in 2020 at 0.0263 - NVIDIA was at its most market-sensitive during the COVID volatility year, when everything moved together. It compressed from 2021 onward as the stock developed more of its own narrative. The HML slope is negative in every year without exception: NVIDIA has never traded like a value stock.
The R-squared column tells the most important story, and the 2023 reading of 0.3489 is the centrepiece. Just 35% of NVIDIA's weekly return variation that year was explained by the five systematic factors. The rest came from idiosyncratic exposure to the AI infrastructure thesis. The Fama-French model had no variable for "Jensen Huang said demand is insane on the earnings call." By 2024, enough of that thesis had diffused into the market factor that the model's explanatory power nearly doubled to 82%.
Try this in the Finance Toolkit MCP: "Run the Fama-French 5-factor model on NVIDIA annually from 2019 to 2026 and explain what each factor slope tells me about the stock."
Comparing NVIDIA, Apple, and Microsoft
Running the model across all three tickers in a single call makes the structural differences visible at once. The 2024 annual regression offers a clean snapshot:
comparison_2024 = ff5.loc[
[(ticker, factor) for ticker in ["NVDA", "AAPL", "MSFT"]
for factor in ["Mkt-RF Slope", "SMB Slope", "HML Slope", "RMW Slope", "CMA Slope", "R Squared"]],
"2024"
]
Which returns:
| Factor | NVDA | AAPL | MSFT |
|---|---|---|---|
| Mkt-RF | 0.0120 | 0.0113 | 0.0124 |
| SMB | -0.0051 | -0.0048 | -0.0027 |
| HML | -0.0045 | -0.0027 | -0.0043 |
| RMW | -0.0018 | 0.0044 | 0.0027 |
| CMA | -0.0067 | -0.0100 | -0.0036 |
| R² | 0.8245 | 0.7804 | 0.8783 |
The Mkt-RF slopes are nearly identical across all three: 0.0120, 0.0113, and 0.0124. In 2024, all three mega-cap technology stocks had converged to approximately the same market sensitivity. Their size and index weight had made them proxies for the market itself.
The RMW divergence is the most informative. Apple (0.0044) and Microsoft (0.0027) both show positive profitability exposure. NVIDIA's RMW is slightly negative (-0.0018) - not because NVIDIA is unprofitable (its margins are exceptional), but because the market was pricing NVIDIA more on anticipated future earnings than demonstrated current earnings. The profitability factor rewards realized profitability; forward-looking pricing disconnects from that factor.
Microsoft's R-squared of 0.8783 is the highest: 88% of its weekly return variation in 2024 is explained by the five systematic factors. Microsoft had matured into a highly factor-driven stock.
Try this in the Finance Toolkit MCP: "Compare the Fama-French 5-factor loadings for NVIDIA, Apple, and Microsoft in 2024 and explain which stock is most driven by systematic factors."
The R-Squared Signal Over Time
Isolating the R-squared across years for all three stocks reveals how the market's understanding of each company evolved:
r_squared = ff5.loc[
[(ticker, "R Squared") for ticker in ["NVDA", "AAPL", "MSFT"]]
]
Which returns:
| Ticker | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 |
|---|---|---|---|---|---|---|---|---|
| NVDA | 0.5252 | 0.5657 | 0.6199 | 0.7596 | 0.3489 | 0.8245 | 0.7248 | 0.6659 |
| AAPL | 0.7576 | 0.7242 | 0.5847 | 0.7331 | 0.6022 | 0.7804 | 0.7595 | 0.5754 |
| MSFT | 0.5061 | 0.5604 | 0.8047 | 0.5903 | 0.3418 | 0.8783 | 0.6154 | 0.3783 |
Apple's R-squared has been the most stable - consistently in the 0.58-0.78 range. As the largest company in the world for most of this period, Apple effectively became the market; its returns have always tracked the broad factors reasonably well.
Microsoft's 2023 R-squared of 0.3418 is as low as NVIDIA's. This is surprising until you recall that 2023 was also the year Microsoft announced its OpenAI integration and Copilot roadmap, triggering a re-rating that was as idiosyncratic as NVIDIA's GPU demand story. Both stocks were responding to the same underlying AI narrative in different ways; neither had that narrative captured in a systematic factor.
What the Model Cannot Tell You
The Fama-French 5-factor model does not explain why a stock outperformed. It explains what factors were present and how sensitive the stock was to each one. An R-squared of 0.82 means the model fits well for that year; it does not mean you could have predicted NVIDIA's return by looking at the factor returns in advance.
What the model is genuinely useful for is portfolio construction. If you are building a portfolio with specific factor tilts - overweight value, underweight growth - running FF5 on your holdings tells you whether your intended exposures actually exist in the portfolio, or whether stock-specific dynamics are swamping the factor positioning. For a stock like NVIDIA in 2023, the answer was clearly the latter.
Top comments (0)