Objective
You have estimates for many related units (Sharpe ratios of 50 strategies, alphas of 200 funds, hit rates of 30 traders), each noisy. Where does the prior for each unit come from? A hierarchical model answers: from the other units. By the end of this lesson you should be able to write down a two-level normal model, estimate its prior from the cross-section (empirical Bayes), explain why the James–Stein estimator beats the raw estimates for every possible truth, and shrink a set of Sharpe ratios by hand.
Three ways to use a group
Take units with estimates of true values :
The sampling variance is known from each unit's own data (for an annualised Sharpe ratio from years of iid returns, roughly , often rounded to ). The population parameters and describe how true values vary across units.
- No pooling (): use . Unbiased per unit, but the extremes are mostly noise.
- Complete pooling (): give every unit the group mean. No noise, but ignores real differences.
- Partial pooling: the posterior given is
This is the familiar normal shrinkage formula, but with a crucial difference: and are now estimated from the data. Units with noisier estimates (shorter track records) are shrunk more, and the amount of shrinkage is set by how dispersed the estimates are compared with their noise.
The data tell you the prior
Marginally, integrating out ,
If every unit has the same , the observed estimates scatter with variance , so the excess dispersion over pure noise measures real differences. With the group mean and :
For the shrinkage factor itself there is an exactly unbiased estimate. Since and ,
This is the Efron–Morris (James–Stein towards the mean) estimator, and plugging estimates of and into the Bayes formula is empirical Bayes. If (the estimates are less dispersed than noise alone predicts), use the positive-part version , which pools completely.
With unequal , estimate and by maximising the marginal likelihood , or go fully Bayesian with a prior on (a half-normal or half-Cauchy) and average over it. Full Bayes matters when is small: plugging in a single ignores uncertainty about it, so the empirical-Bayes posterior intervals are too narrow, especially when is near zero.
The James–Stein estimator and why it dominates
Take with known and no prior at all. The raw estimate has total risk for every . James and Stein (1961) showed that for
has strictly smaller total risk for every . So is inadmissible: there is an estimator at least as good everywhere and better somewhere.
Intuition. , so the raw vector is too long on average, and the longer it is relative to the noise, the less it needs shortening.
Proof via Stein's lemma. For and a weakly differentiable , . Write the estimator as :
With , we have and , so
The bracket is positive for , which needs , and is largest at , giving risk . Shrinking towards the estimated grand mean uses one degree of freedom, so the constant becomes and you need .
What dominance does and does not say.
- It is a statement about total squared error summed over units. An individual unit whose true value is far from the others can be made worse; the gains elsewhere outweigh it.
- It holds for every , with no prior assumed, but it does use the normal likelihood with known (or well-estimated) .
- The units need not be related for the maths to work, which is the "paradox". The gains are large only when the really are close together, so in practice shrink within groups that are plausibly exchangeable: same asset class, same style, similar capacity.
- The positive-part estimator dominates plain James–Stein, and is itself inadmissible, though only slightly.
The simulation below compares the raw Sharpe estimates of 8 funds with James–Stein and positive-part James–Stein towards the grand mean.
import random
random.seed(3)
p, sigma, R = 8, 0.5, 20_000 # 8 funds, s.e. 0.5 on each Sharpe estimate
mse = {"raw": 0.0, "JS": 0.0, "JS+": 0.0}
for _ in range(R):
theta = [random.gauss(0.5, 0.3) for _ in range(p)] # true Sharpes
y = [t + random.gauss(0, sigma) for t in theta] # estimates
ybar = sum(y) / p
S = sum((v - ybar) ** 2 for v in y)
B = (p - 3) * sigma**2 / S # estimated shrinkage
js = [ybar + (1 - B) * (v - ybar) for v in y]
jsp = [ybar + max(0.0, 1 - B) * (v - ybar) for v in y] # positive part
for name, est in (("raw", y), ("JS", js), ("JS+", jsp)):
mse[name] += sum((e - t) ** 2 for e, t in zip(est, theta)) / p / R
for name, v in mse.items():
print(f"{name:4s} mean squared error per fund: {v:.4f}")
Output:
raw mean squared error per fund: 0.2500
JS mean squared error per fund: 0.1347
JS+ mean squared error per fund: 0.1212
Theory gives for James–Stein, matching the simulation. An oracle who knew and would reach ; the gap is the price of estimating the prior from only 8 funds.
Worked example
shrinking eight Sharpe ratios
Eight funds in the same style each have 4 years of history, so each annualised Sharpe estimate has sampling variance about . The estimates are . Compute the Efron–Morris shrinkage, the shrunk Sharpe ratios, and the implied spread of true Sharpe ratios.
Show solutionHide solution
Group mean. . Deviations: .
Dispersion. , so the cross-sectional variance is . Pure noise would give , so only about a third of the observed spread is real.
Shrinkage. , so each fund keeps of its deviation from the mean.
| Raw | 1.6 | 1.1 | 0.9 | 0.7 | 0.5 | 0.3 | 0.1 | −0.4 |
|---|---|---|---|---|---|---|---|---|
| Shrunk | 1.14 | 0.87 | 0.76 | 0.65 | 0.55 | 0.44 | 0.33 | 0.06 |
The top fund's 1.6 becomes 1.14: still the best, but the evidence supports a much less impressive number. The worst fund's becomes slightly positive: four bad years in a style that typically earns 0.6 are weak evidence of a negative true Sharpe.
Implied prior. gives , so true Sharpe ratios in this style have SD about . The plug-in posterior SD of each fund is , which understates the truth a little because is itself uncertain with only eight funds.
Worked example
short track record against long track record
In a style where true Sharpe ratios are about , fund A shows a Sharpe of 1.5 over 2 years and fund B shows 1.0 over 9 years. Using sampling variance , which fund has the higher posterior mean Sharpe, and how certain are the two estimates?
Show solutionHide solution
Prior variance .
Fund A. , so . Posterior mean . Posterior variance , SD .
Fund B. , so . Posterior mean . Posterior variance , SD .
Ranking flips. On raw numbers A looks 50% better; after shrinkage B is ahead, against , and B's estimate is also tighter. Two years of a Sharpe of 1.5 is roughly a standard-error result, and a group in which true Sharpes above 1 are rare produces such results by luck quite often. Interview point: when someone ranks managers or signals on raw Sharpe ratios with different track lengths, the first fix is to put them on a common, shrunk scale.
Knowledge check
Ten strategies each have Sharpe estimates with sampling variance . The group mean is and . Using , what is the shrunk Sharpe of a strategy whose raw estimate is ?
Knowledge check
Which statement about the James–Stein estimator (shrinking towards the grand mean, normal estimates with known noise variance, at least four units) is correct?
Knowledge check
You have 20 strategies, each with a Sharpe estimate from 4 years of data (sampling variance 0.25). The sample variance of the 20 estimates is 0.22. What does empirical Bayes conclude?
Key takeaways
- Hierarchical model: , . The posterior mean shrinks each towards by , more for noisier units.
- The prior is estimated from the cross-section: the estimates scatter with variance , so excess dispersion over noise measures real differences. is unbiased for .
- James–Stein: for (or shrinking to the mean) the raw estimate is inadmissible; shrinkage lowers total squared error for every truth, though not necessarily for every unit.
- For Sharpe ratios with sampling variance about , short track records shrink most; rankings on raw Sharpe ratios across different track lengths are unreliable.
- Empirical Bayes understates uncertainty when there are few units; full Bayes puts a prior on and averages over it.
- Shrink within exchangeable groups, or towards a regression on known characteristics, and beware selected or survivor-only groups.
Practice problems
Finished reading?
Answer the 3 knowledge checks to complete this lesson (0 done).