Definition
Bailey and López de Prado start from the probabilistic Sharpe ratio, the probability that the true ratio exceeds a benchmark given the length of the track record T, the skewness γ3 and the kurtosis γ4 of the returns. The deflated version sets the benchmark to the maximum expected from N independent trials with no skill:
SR0 = √V ( (1 − γ) Φ−1(1 − 1/N) + γ Φ−1(1 − 1/(N e)) )
DSR = Φ( (SR − SR0) √(T − 1) ÷ √( 1 − γ3 SR + (γ4 − 1) SR² / 4 ) )
V is the variance of the Sharpe ratios across the trials, γ is the Euler-Mascheroni constant (about 0.5772) and Φ the normal distribution function. Ratios are per period, not annualised.
Worked example
One hundred strategies with no skill are simulated over five years of daily returns. The best one is tested against zero, then against the deflated benchmark.
import numpy as np
from scipy import stats
rng = np.random.default_rng(7)
T, N = 1250, 100
r = rng.standard_t(df=5, size=(T, N)) * 0.01 # fat-tailed daily returns, zero mean
sr = r.mean(0) / r.std(0, ddof=1)
best = int(np.argmax(sr))
x = r[:, best]
def psr(sr_hat, sr_ref):
g3, g4 = stats.skew(x), stats.kurtosis(x, fisher=False)
z = (sr_hat - sr_ref) * np.sqrt(T - 1) / np.sqrt(1 - g3 * sr_hat + (g4 - 1) / 4 * sr_hat ** 2)
return stats.norm.cdf(z)
g = 0.5772156649
sr0 = np.sqrt(sr.var(ddof=1)) * ((1 - g) * stats.norm.ppf(1 - 1 / N) + g * stats.norm.ppf(1 - 1 / (N * np.e)))
print(f"best of {N}: annualised Sharpe = {sr[best] * np.sqrt(250):.2f}")
print(f"expected best of {N} with no skill, annualised = {sr0 * np.sqrt(250):.2f}")
print(f"probability the true Sharpe is above 0 (ignoring the search) = {psr(sr[best], 0):.3f}")
print(f"deflated Sharpe ratio (against the expected best) = {psr(sr[best], sr0):.3f}")Output, produced by running the code above when this page was built:
best of 100: annualised Sharpe = 1.41 expected best of 100 with no skill, annualised = 1.11 probability the true Sharpe is above 0 (ignoring the search) = 0.999 deflated Sharpe ratio (against the expected best) = 0.756
Tested against zero, the best of the hundred looks convincing. Tested against what the best of a hundred noise strategies is expected to reach, it falls well short of the 0.95 usually required.
Where it misleads
- The result depends on N, and the honest number of trials is hard to establish. Correlated variants should be counted as fewer effective trials, which requires an estimate of their number.
- The benchmark needs the variance of Sharpe ratios across trials. If only the winner was kept, that variance is unknown and has to be assumed.
- The formula assumes returns without serial correlation. Smoothed or illiquid return series overstate the Sharpe ratio before any deflation.
- A high deflated ratio says the record is unlikely under pure selection among noise. It does not cover a look-ahead bias or costs left out of the backtest.
In our work
We deflate on the whole population of candidates and state the number of trials used. The same reasoning applies outside finance to any score that was selected: an AUC, an uplift, a forecast error.
Service: machine learning and model validation Research note: detecting overfitting
References
- Bailey, D. H., López de Prado, M. (2014). The deflated Sharpe ratio: correcting for selection bias, backtest overfitting, and non-normality. Journal of Portfolio Management, 40(5), 94-107. doi:10.3905/jpm.2014.40.5.094
- Bailey, D. H., López de Prado, M. (2012). The Sharpe ratio efficient frontier. Journal of Risk, 15(2), 3-44. doi:10.21314/JOR.2012.255
- Lo, A. W. (2002). The statistics of Sharpe ratios. Financial Analysts Journal, 58(4), 36-52. doi:10.2469/faj.v58.n4.2453