Library / Code module
Probabilistic and deflated Sharpe ratio
deflated_sharpe_ratio
Compute the probability that a strategy's true Sharpe ratio exceeds a benchmark given skewness, kurtosis and sample length, and deflate it for having picked the best of many trials by comparing against the expected maximum Sharpe ratio of pure-luck trials. Use it before reporting the best of a configuration search.
ATTRIBUTION.md3.9 KBLICENSE1.0 KBREADME.md3.0 KBatom_cli.py3.0 KBcomponent.json8.5 KBdeflated_sharpe_ratio.py5.2 KBnumerics.py28.0 KBschema_lite.py8.9 KBtest_deflated_sharpe_ratio.py3.7 KBtest_package.py12.0 KB
Full files in your harness.
What it takes and gives
- Runs with
- Python 3.10 or later
- Entry points
- sharpe_moments, probabilistic_sharpe_ratio, expected_maximum_sharpe, expected_maximum_of_normals, deflated_sharpe_ratio
- Known answers
- 8 cases its tests reproduce
Cases it covers
- selection is not ignored: PSR against zero ignores that this series was the best of 20 tries; in the seeded test the best of 20 pure-noise strategies passes PSR > 0.95 in over 30 percent of runs.
Limits and scope
- Limits
- Asymptotic: with few observations or heavily dependent returns the PSR is approximate. The deflation needs the number of effectively independent trials and the variance of their Sharpe ratios, both of which must be estimated honestly (every configuration tried counts). The expected-maximum formula is an approximation to a Gaussian extreme value. It does not test for other forms of overfitting such as look-ahead bias.
- Guarantees
- PSR(SR* = SR) = 0.5 exactly; PSR increases with the number of observations when SR > SR*. expected_maximum_sharpe scales with sqrt(variance) and stays within 0.05 of the exact Gaussian expected maximum for 10 to 1000 trials (checked by quadrature). Invalid inputs (zero variance, fewer than 2 trials, a non-positive variance term) raise ValueError.
- Assumes
- Returns are i.i.d. with a finite fourth moment; the PSR relies on the asymptotic normality of the estimated Sharpe ratio. trials is the number of effectively independent configurations tried, and their Sharpe ratios are roughly Gaussian with the given variance. All Sharpe ratios are per period (not annualized) and in the same units as the variance.
Details
- Kind
- Code module
- Licence
- MIT
- Declared effects
- runs commands
- Source
- github.com/alisonjieli-png/loop-engine/tools/creative_originals/evaluation_atoms/items/deflated_sharpe_ratio
- Size
- 10 files, 77.3 KB
- Identity
library.supply.creative_originals.20f4678e03288208e88145fe.e7d9db3913cbe480- Version
e7d9db3913cbe480d696fe6d9f9ed1e2b11960f755d2592e6f9af2c391ea7912
The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.
Where it is shown
- Statistics for comparing resultsDeterministic skills
Related components
Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.