James-Stein Shrinkage

The James-Stein Shrinkage pulls every average return towards their grand mean, the average of the average returns. James and Stein (1961) showed that for three or more means, this shrinkage lowers the total squared error of the estimates compared to the averages themselves, whatever the true means are.

The formula for the James-Stein Shrinkage starts from the averages \(m_{i}\) of the N assets over the T periods and their grand mean g:

\[g = \frac{\sum_{i=1}^{N} m_{i}}{N}\]

The intensity beta compares the noise in the averages, from the eigenvalues \(\lambda_{k}\) of the sample covariance (ddof=1), with their spread around the grand mean, and is kept between 0 and 1 (the positive-part estimator in the form of Meucci, 2005, for an unknown covariance):

\[\beta = \frac{\sum_{k=1}^{N} \lambda_{k} - 2 \cdot \max\left(\lambda_{k}\right)}{T \cdot \sum_{i=1}^{N} (m_{i} - g)^{2}}\]

The estimate moves every average that share of the way to the grand mean, scaled to a year with P, the number of periods in a year:

\[\mu_{i} = P \cdot ((1 - \beta) \cdot m_{i} + \beta \cdot g)\]

The larger the estimation noise compared to the spread of the averages, the closer the estimates lie together; the ranking of the assets stays that of their averages.

It shows how much the choice moves the input that mean-variance weights are most sensitive to. The expected return of an asset can only be estimated from a short and noisy history: the precision of an average return grows with the length of the history in years, not with the number of periods within them, so even decades of data leave it imprecise. An optimizer that takes such estimates at face value bets most on the assets whose averages happen to be highest in the sample. The estimators differ in how they deal with this: by weighting recent periods, by deriving the returns from a model of risk, by shrinking the averages towards a common value or by using only an ordering of the assets.

Also known as: James-Stein mean, shrunk mu, shrinkage expected returns.

In the Finance Toolkit this is get_expected_returns_estimate with method="james_stein", the same function as Expected Returns Estimate.

Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_expected_returns_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_expected_returns_estimate(method="james_stein", show_columns=["Mean", "Geometric", "Bayes-Stein", "James-Stein", "Bodnar-Okhrin-Parolya"])

Which returns:

References

  • Paper James, W. and Stein, C. (1961). “Estimation with Quadratic Loss.” Proceedings of the Fourth Berkeley Symposium on Mathematical Statistics and Probability, 1, 361-379.
  • Paper Meucci, A. (2005). “Risk and Asset Allocation.” Springer.
  • Library Referenced against skfolio’s ShrunkMu (James-Stein Shrinkage)
  • Library Shares similar logic as Riskfolio-Lib’s mean_vector (James-Stein Shrinkage)
Share