Works with the AI Agents you already use
Strategy Statistical Validation
by BanditXBT
Test whether a backtested edge is real: PSR, deflated Sharpe, PBO/CSCV, walk-forward, multiple-testing and bootstrap CIs.
$29
About this skill
Question: given how many things were tried, how much data exists, and how non-normal the returns are, what is the probability the true Sharpe exceeds a hurdle? Educational analysis, not investment advice; state assumptions and data sources.
- Count trials N honestly. Every parameter cell, feature set, universe, rebalance frequency, and discarded idea counts. When N is large and trials are correlated, estimate an effective N (e.g., clustering trial returns, or eigenvalues of the trial correlation matrix); this is a judgment call, so report results across a range of N.
- Per-period Sharpe
SR = mean/stdat native frequency, T observations. Annualize only for reporting:sqrt(periods_per_year)is valid under iid; for autocorrelated returns use Lo (2002) adjustment. - PSR (Bailey and Lopez de Prado 2012).
PSR(SR*) = Phi( (SR - SR*) sqrt(T-1) / sqrt(1 - g3*SR + (g4-1)/4 * SR^2) ); g3 skewness, g4 raw kurtosis (normal = 3), SR and SR* non-annualized. - DSR (Bailey and Lopez de Prado 2014). Replace SR* by the expected maximum Sharpe of N unskilled trials:
SR0 = sqrt(V) * ((1-gamma)*Phi^-1(1-1/N) + gamma*Phi^-1(1-1/(N*e))), V = variance of per-period SRs across trials, gamma = 0.5772 (Euler-Mascheroni).DSR = PSR(SR0). A common convention is DSR >= 0.95 (a conventional confidence level, not a theorem). - MinTRL.
1 + (1 - g3*SR + (g4-1)/4*SR^2) * (z/(SR - SR*))^2, z = Phi^-1(confidence), e.g. 1.645 for 95% one-sided. Compare with available T. - PBO via CSCV (Bailey, Borwein, Lopez de Prado, Zhu). Matrix M (T x N trials). Split rows into S even blocks (S=16 gives 12,870 combinations; S=8-16 typical). For each combination of S/2 blocks as in-sample, pick the best in-sample trial, take its out-of-sample relative rank omega = rank/(N+1), logit
lambda = ln(omega/(1-omega)).PBO= share of combinations with lambda <= 0 (best IS trial lands at or below the OOS median). Also report performance degradation (IS vs OOS regression) and probability of OOS loss. - Walk-forward / purged CV. Refit every hyperparameter inside each training window; purge and embargo overlapping labels; report the stitched OOS curve only. Combinatorial purged CV yields a distribution of OOS paths. Keep a final untouched holdout.
- Multiple-testing correction. Family-wise: Bonferroni/Holm; bootstrap White's Reality Check (2000), Hansen's SPA (2005), Romano-Wolf stepdown (2005). FDR: Benjamini-Hochberg (Benjamini-Yekutieli under dependence). Harvey, Liu, Zhu (RFS 2016) estimate that a newly discovered factor needs a t-ratio above about 3.0.
- Bootstrap CI. Stationary bootstrap (Politis-Romano 1994) with block length from Politis-White (corrected by Patton-Politis-White 2009); report CIs for Sharpe, max drawdown, Calmar.
def psr(r, sr_star=0.0): r = np.asarray(r); T = len(r); sr = r.mean()/r.std(ddof=1) g3, g4 = skew(r), kurtosis(r, fisher=False) return norm.cdf((sr-sr_star)np.sqrt(T-1)/np.sqrt(1-g3sr+(g4-1)/4*sr**2))
def sr0(var_sr, N, g=0.5772156649): return np.sqrt(var_sr)((1-g)norm.ppf(1-1/N)+gnorm.ppf(1-1/(Nnp.e)))
Educational analysis, not investment advice. DSR depends on an honestly counted number of trials; confirm arch method names for your installed version.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 13 days ago
- Software
Python 3numpyscipyarch
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.