Class SharpeValidation
java.lang.Object
com.quantfinlib.backtest.validation.SharpeValidation
Sharpe ratio significance tests (Bailey & López de Prado):
- Probabilistic Sharpe Ratio — the probability the true Sharpe exceeds a benchmark, adjusting for track length and non-normal returns (skew, kurtosis).
- Deflated Sharpe Ratio — PSR against the Sharpe you'd expect from the best of N random trials: the multiple-testing haircut for a strategy picked from a parameter grid.
All Sharpe inputs are per-period (not annualized) with observation
count nObs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubledeflatedSharpe(double observedSharpe, double[] trialSharpes, int nObs, double skewness, double kurtosis) Deflated Sharpe: PSR of the winner against the expected-max benchmark implied by all the parameter combinations that were tried.static doubleexpectedMaxSharpe(int trials, double varianceOfTrialSharpes) Expected maximum Sharpe amongtrialsindependent zero-skill strategies whose Sharpe estimates have the given cross-trial variance.static doubleminTrackRecordLength(double observedSharpe, double benchmarkSharpe, double skewness, double kurtosis, double confidence) Minimum track record length (Bailey & López de Prado): how many periods of THIS performance are needed beforeprobabilisticSharpe(double, double, int, double, double)would clearconfidencethat the true Sharpe exceeds the benchmark — the allocator's question ("how long until this manager's record means something?")static doubleprobabilisticSharpe(double observedSharpe, double benchmarkSharpe, int nObs, double skewness, double kurtosis) Probability the true Sharpe exceedsbenchmarkSharpe, in [0,1].
-
Method Details
-
probabilisticSharpe
public static double probabilisticSharpe(double observedSharpe, double benchmarkSharpe, int nObs, double skewness, double kurtosis) Probability the true Sharpe exceedsbenchmarkSharpe, in [0,1]. -
expectedMaxSharpe
public static double expectedMaxSharpe(int trials, double varianceOfTrialSharpes) Expected maximum Sharpe amongtrialsindependent zero-skill strategies whose Sharpe estimates have the given cross-trial variance. -
deflatedSharpe
public static double deflatedSharpe(double observedSharpe, double[] trialSharpes, int nObs, double skewness, double kurtosis) Deflated Sharpe: PSR of the winner against the expected-max benchmark implied by all the parameter combinations that were tried. Values near 1 mean the edge survives the multiple-testing haircut; below ~0.95 the "discovery" is likely selection bias.- Parameters:
trialSharpes- per-period Sharpe of every trial in the search (including the winner)
-
minTrackRecordLength
public static double minTrackRecordLength(double observedSharpe, double benchmarkSharpe, double skewness, double kurtosis, double confidence) Minimum track record length (Bailey & López de Prado): how many periods of THIS performance are needed beforeprobabilisticSharpe(double, double, int, double, double)would clearconfidencethat the true Sharpe exceeds the benchmark — the allocator's question ("how long until this manager's record means something?") in closed form:n* = 1 + (1 − γ₃·SR + (γ₄−1)/4·SR²) · (z_conf / (SR − SR*))²
ReturnsPOSITIVE_INFINITYwhen the observed Sharpe does not exceed the benchmark — no track record length proves an edge the record does not show. Sharpe inputs are PER-PERIOD (not annualized), matchingprobabilisticSharpe.
-