Fama Decomposition
Calculate the Fama (1972) decomposition of total excess return into Selectivity and Diversification.
Jensen’s Alpha alone conflates two very different sources of excess return: genuine stock/timing selection skill, and simply carrying more total risk than the market by holding an under-diversified portfolio (which, in a CAPM world, should be compensated with extra return even absent any skill). Fama’s decomposition separates the two by comparing the portfolio’s actual return against two different CAPM-implied return benchmarks: one using the portfolio’s actual Beta (systematic risk only), and one using the portfolio’s actual total risk ratio (Sigma_Portfolio / Sigma_Market) in place of Beta.
The formulas are as follows:
\[\text{Selectivity} = (\text{Asset Return} - \text{Risk-Free Rate}) - (\text{Sigma\_Portfolio} / \text{Sigma\_Market}) \cdot (\text{Benchmark Return} - \text{Risk-Free Rate})\] \[\text{Diversification} = \left[\text{Risk-Free Rate} + (\text{Sigma\_Portfolio} / \text{Sigma\_Market}) \cdot (\text{Benchmark Return} - \text{Risk-Free Rate})\right] - \left[\text{Risk-Free Rate} + \text{Beta} \cdot (\text{Benchmark Return} - \text{Risk-Free Rate})\right]\]Selectivity is the return earned above what would be required for a fully diversified portfolio carrying the same total risk, i.e. genuine security selection or timing skill. Diversification is the extra return the manager left on the table (if positive, it is a cost) by taking on unsystematic risk that a fully diversified portfolio of the same total risk would not have. Selectivity plus Diversification equals Jensen’s Alpha (see get_jensens_alpha).
Also known as: Fama’s Net Selectivity, Fama performance decomposition.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Fama Decomposition for you. Just ask in plain English.
Calculate the Fama Decomposition in Python
The Fama Decomposition is available in the Performance module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_fama_decomposition as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.performance.get_fama_decomposition().xs("AAPL", level=0, axis=1)
Which returns:
| Date | Selectivity | Diversification |
|---|---|---|
| 2021 | 0.0113 | -0.0084 |
| 2022 | 0.022 | -0.0375 |
| 2023 | 0.1048 | 0.0979 |
| 2024 | -0.1053 | 0.1698 |
| 2025 | -0.1774 | 0.056 |
| 2026 | -0.0958 | 0.1246 |
Parameters
get_fama_decomposition accepts the following parameters:
- period (str, optional): The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
- rolling (int, optional): The rolling window size to use for the Beta component of the
calculation. If set, Beta is estimated over a rolling window of this many periods across
the full return history instead of per
period. Defaults to None. - rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
- lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.
Related Performance Metrics
The Performance module page introduces the module, and the sidebar lists all of its functions.