Class SharpeValidation

java.lang.Object
com.quantfinlib.backtest.validation.SharpeValidation

public final class SharpeValidation extends Object
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 Type
    Method
    Description
    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.
    static double
    expectedMaxSharpe(int trials, double varianceOfTrialSharpes)
    Expected maximum Sharpe among trials independent zero-skill strategies whose Sharpe estimates have the given cross-trial variance.
    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 before probabilisticSharpe(double, double, int, double, double) would clear confidence that the true Sharpe exceeds the benchmark — the allocator's question ("how long until this manager's record means something?")
    static double
    probabilisticSharpe(double observedSharpe, double benchmarkSharpe, int nObs, double skewness, double kurtosis)
    Probability the true Sharpe exceeds benchmarkSharpe, in [0,1].

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • probabilisticSharpe

      public static double probabilisticSharpe(double observedSharpe, double benchmarkSharpe, int nObs, double skewness, double kurtosis)
      Probability the true Sharpe exceeds benchmarkSharpe, in [0,1].
    • expectedMaxSharpe

      public static double expectedMaxSharpe(int trials, double varianceOfTrialSharpes)
      Expected maximum Sharpe among trials independent 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 before probabilisticSharpe(double, double, int, double, double) would clear confidence that 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*))²
      Returns POSITIVE_INFINITY when 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), matching probabilisticSharpe.