Ledoit-Wolf Single Factor Shrinkage
The Ledoit-Wolf Single Factor Shrinkage pulls the sample covariance towards the covariance matrix that the market model implies, with the benchmark as the market (Ledoit and Wolf, 2003). Each return is a beta times the market return plus a residual unrelated to the other assets, a target with only 2N + 1 parameters that is estimated precisely, while the sample covariance adds what the factor leaves out.
The formula for the Ledoit-Wolf Single Factor Shrinkage starts from the sample covariance S of the demeaned returns \(y_{i , t}\) of the N assets over the T periods, divided by T, the covariances \(S_{i , m}\) of the assets with the benchmark and the variance \(S_{m , m}\) of the benchmark:
\[S_{i,j} = \frac{\sum_{t=1}^{T} y_{i,t} \cdot y_{j,t}}{T}\]The target F keeps the variances and takes the covariances the market model implies, \(\beta_{i} \cdot \beta_{j}\) times the variance of the market:
\[F_{i,i} = S_{i,i}\] \[F_{i,j} = \frac{S_{i,m} \cdot S_{j,m}}{S_{m,m}} \quad \text{if } i \neq j\]The intensity follows from the variances \(\pi_{i , j}\) of the entries of S, the covariance rho of the target with S (the sum of the estimated covariances between the entries of F and those of S, as derived by Ledoit and Wolf, 2003), and the squared distance gamma between the target and S:
\[\pi_{i,j} = \frac{\sum_{t=1}^{T} (y_{i,t} \cdot y_{j,t} - S_{i,j})^{2}}{T}\] \[\gamma = \sum_{i=1}^{N} \sum_{j=1}^{N} (F_{i,j} - S_{i,j})^{2}\] \[\delta = \max\left(0, \min\left(\frac{\sum_{i=1}^{N} \sum_{j=1}^{N} \pi_{i,j} - \rho}{\gamma \cdot T}, 1\right)\right)\]The estimate moves S that share of the way to the target:
\[\Sigma = (1 - \delta) \cdot S + \delta \cdot F\]It suits assets that share one dominant factor; the benchmark should be the market the assets belong to, as a target from an unrelated benchmark explains little of their co-movement.
Its parameters can be set, and it can be shown as a correlation matrix. The covariance matrix holds the variance of every asset and the covariance of every pair, the risk input of the mean-variance analysis of Markowitz (1952). With N assets it holds N (N + 1) / 2 numbers to estimate, and when N is not small compared to the number of periods T, the sample estimate is noisy and ill-conditioned: its smallest eigenvalues come out too small, and an optimizer that inverts it puts large weights on the combinations of assets that only look safe in the sample. The estimators differ in how they deal with this: by shrinking towards a structured target, by cleaning the eigenvalues, by weighting recent periods, by counting only large moves or by resisting outliers. Every estimate is annualized with the number of periods in a year.
Also known as: single index shrinkage, market model shrinkage.
In the Finance Toolkit this is get_covariance_estimate with method="ledoit_wolf_single_factor", the same function as Covariance Estimate.
Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_covariance_estimate:
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "JNJ", "XOM"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.portfolio.get_covariance_estimate(method="ledoit_wolf_single_factor")
| Parameter | Type | Description | Example |
|---|---|---|---|
method | str | The estimator. Options are: “sample” (Sample Covariance, ddof=1), “ledoit_wolf” (Ledoit-Wolf Shrinkage, towards the scaled identity, Ledoit and Wolf, 2004), “ledoit_wolf_constant_correlation” (Ledoit-Wolf Constant Correlation Shrinkage, towards the average correlation, Ledoit and Wolf, 2004), “ledoit_wolf_single_factor” (Ledoit-Wolf Single Factor Shrinkage, towards the covariance that the benchmark as a single factor implies, Ledoit and Wolf, 2003), “oas” (Oracle Approximating Shrinkage, Chen et al., 2010), “shrunk” (Fixed Shrinkage, 10% towards the scaled identity by default), “semicovariance” (Semicovariance, the co-movement below a zero return, Estrada, 2008), “exponential” (Exponentially Weighted Covariance, recent periods weigh most, RiskMetrics), “denoised” (Denoised Covariance, the eigenvalues of the correlation matrix that random returns could produce averaged, Laloux et al., 2000), “denoised_spectral” (Spectral Denoised Covariance, those eigenvalues set to zero), “denoised_shrink” (Targeted Shrinkage Covariance, the noise correlations shrunk towards their diagonal, López de Prado, 2020), “gerber” (Gerber Covariance, co-movements beyond half a standard deviation, Gerber et al., 2022), “detoned” (Detoned Covariance, the correlation without its first principal components, López de Prado, 2020), “factor” (Factor Model Covariance, the covariance a time series factor model implies, Connor, 1995), “minimum_covariance_determinant” (Minimum Covariance Determinant, the reweighted covariance of the half of the periods with the smallest covariance determinant, robust to outliers, Rousseeuw and Van Driessen, 1999), “jlogo” (j-LoGo Covariance, the sparse inverse covariance on the TMFG planar graph of the correlations, Barfuss et al., 2016), “geodesic” (Geodesic Shrinkage, 10% towards the scaled identity along the geodesic of the positive definite matrices by default, Bhatia, 2007), “regime_adjusted_ew” (Regime Adjusted Exponentially Weighted Covariance, a half-life of 40 periods by default, rescaled by the recent realized against predicted risk, Paleologo, 2025), “denoised_detoned” (Denoised and Detoned Covariance, the denoised correlation with its first principal components removed, López de Prado, 2020), “nercome” (Nonparametric Eigenvalue-Regularized Covariance Matrix Estimator, eigenvectors from one part of the periods and the variances along them from the other, Lam, 2016), “ccc_garch” (Constant Conditional Correlation GARCH Covariance, the next-period covariance of GARCH volatilities with constant correlations, Bollerslev, 1990), “mm” (MM-Estimator, robust, Maronna et al., 2019), “rocke” (Rocke S-Estimator, robust, Maronna et al., 2019). Defaults to “sample”. | "sample" |
period | str | The frequency of the returns. Options are: “daily” (daily returns), “weekly” (weekly returns), “monthly” (monthly returns), “quarterly” (quarterly returns), “yearly” (yearly returns). Defaults to “daily”. | "weekly" |
span | int | The span in periods of the exponentially weighted estimate. Defaults to 180. | 180 |
shrinkage | float | The fixed intensity \(\delta\) of the fixed and geodesic shrinkage, between 0 and 1. Defaults to 0.1 (PyPortfolioOpt defaults to 0.2 for the fixed shrinkage). | |
gerber_threshold | float | The threshold of the Gerber estimate in standard deviations, between 0 and 1. Defaults to 0.5. | 0.5 |
gerber_statistic | int | The Gerber statistic. Options are: 0 (the original statistic), 1 (the positive semidefinite variant), 2 (the matrix form). Defaults to 1. | 1 |
denoise_alpha | float | The share \(\alpha\) of the noise correlations the targeted shrinkage keeps, between 0 and 1. Defaults to 0. | 0 |
components | int | The number of principal components the detoned estimates remove. Defaults to 1. | 1 |
factor_selection | str | How the factor estimate takes the loadings. Options are: “ols” (every factor), “forward” (stepwise by the p-values, 0.05), “backward” (stepwise by the p-values, 0.05), “pcr” (principal components regression keeping 95% of the variance). Defaults to “ols”. | "ols" |
factors | pd.DataFrame | None | The factor returns of the factor estimate, one column per factor, at the frequency of the period. Defaults to None, the Fama and French five factors of the region. | None, the Fama and French five factors of the region |
region | str | The region of the Fama and French factors. Options are: “United States”, “Developed”, “Developed ex US”, “Europe”, “Japan”, “Asia Pacific ex Japan”, “North America”. Defaults to “United States”. | "Europe" |
half_life | float | The half-life in periods of the exponential weights of the regime adjusted estimate. Defaults to 40, skfolio’s default as well. | 40, skfolio's default as well |
seed | int | None | The seed of the random subsets of the Minimum Covariance Determinant, which also starts the MM and Rocke estimators, and of the random splits of NERCOME (numpy’s default generator), so the same returns give the same estimate. Defaults to 0. | 42 |
correlation | bool | Whether to return the correlation matrix of the estimate instead. Defaults to False. | False |
include_benchmark | bool | Whether to include the benchmark as an asset. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding. | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
Which returns:
| Item | AAPL | MSFT | JNJ | XOM |
|---|---|---|---|---|
| AAPL | 0.0776 | 0.0453 | 0.0072 | 0.0144 |
| MSFT | 0.0453 | 0.0661 | 0.0034 | 0.0063 |
| JNJ | 0.0072 | 0.0034 | 0.0280 | 0.0059 |
| XOM | 0.0144 | 0.0063 | 0.0059 | 0.0730 |
4 rows
References
- Paper Ledoit, O. and Wolf, M. (2003). “Improved Estimation of the Covariance Matrix of Stock Returns with an Application to Portfolio Selection.” Journal of Empirical Finance, 10(5), 603-621.
- Library Shares similar logic as PyPortfolioOpt’s CovarianceShrinkage.ledoit_wolf (Ledoit-Wolf Shrinkage, Ledoit-Wolf Constant Correlation Shrinkage, Ledoit-Wolf Single Factor Shrinkage)