residual-edge-analyzer

Separates strategy returns into baseline exposure and residual edge using OLS attribution with HAC inference.

2.8k|632|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/tradermonty/claude-trading-skills --skill residual-edge-analyzer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: residual-edge-analyzer
Source: https://github.com/tradermonty/claude-trading-skills/tree/main/skills/residual-edge-analyzer
Command: npx skills add https://github.com/tradermonty/claude-trading-skills --skill residual-edge-analyzer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Backtested or live strategy returns often look impressive until you ask whether a simple market, equal-weight, or momentum baseline explains them. This Skill runs returns-based attribution to test whether a strategy's performance contains statistically supported residual edge beyond predeclared baselines, producing an auditable verdict instead of a gut-feel judgment.

Core Features & Use Cases

  • Returns-Based OLS Attribution: Fits an intercept OLS model of strategy returns on declared baseline return series, reporting annualized alpha, loadings, R-squared, and Newey-West (HAC) t-statistics.
  • Robustness Gates: Runs rolling-window stability analysis, alternate-baseline sensitivity models, VIF multicollinearity checks, residual autocorrelation diagnostics, and predeclared regime breakdowns, then assigns one of four statuses: RESIDUAL_EDGE, BASELINE_EXPLAINED, RESIDUAL_FRAGILE, or INSUFFICIENT_EVIDENCE.
  • Provenance Enforcement: Requires explicit declarations for baseline selection timing, gross/net cost basis, analysis scope, and universe data, downgrading results to REVIEW_REQUIRED when provenance is missing.
  • Use Case: After backtesting a swing-trading strategy, feed a CSV of dated strategy, market, and equal-weight returns plus a JSON config to learn whether the apparent alpha survives comparison with simple baselines, or whether a drawdown came from baseline exposure rather than strategy-specific behavior.

Quick Start

Ask the assistant to run the residual edge analyzer on your dated strategy-and-baseline returns CSV with a JSON config declaring the primary and sensitivity baseline models, then review the generated JSON and Markdown attribution report.

Frequently Asked Questions about residual-edge-analyzer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test whether my trading strategy has real alpha beyond market returns?

Run a returns-based OLS regression of your strategy's dated period returns against predeclared baseline return series such as market or equal-weight returns. The analyzer reports annualized alpha with HAC t-statistics, a residual edge ratio, and rolling stability to judge whether the edge is statistically supported.

What input data does returns-based attribution require?

You need one CSV with unique ISO dates and aligned strategy and baseline period returns, plus a JSON config declaring the primary model, sensitivity models, frequency, and data provenance. Summary metrics like CAGR or Sharpe ratios are rejected; actual dated return series are mandatory.

What is the difference between returns-based attribution and Brinson attribution?

Returns-based attribution regresses a return series on factor returns and needs no holdings data, while Brinson attribution decomposes allocation, selection, and interaction effects from historical holdings and benchmark weights. This analyzer explicitly does not perform holdings-based Brinson analysis.

Why does my analysis result show RESIDUAL_FRAGILE or REVIEW_REQUIRED?

RESIDUAL_FRAGILE appears when robustness gates fail, rolling analysis is unavailable, or no alternate baseline was tested. REVIEW_REQUIRED appears when provenance declarations are missing, cost bases mismatch, the sample is in-sample only, or multicollinearity warnings exist, regardless of statistical strength.

Can I use current index constituents to build an equal-weight baseline?

No, building an equal-weight baseline from current constituents introduces survivorship bias and must be declared as current_constituents, which triggers a high-severity warning. Same-universe baselines require point-in-time membership and historical construction rules.

Why is the residual edge ratio used instead of a Sharpe ratio on residuals?

With an intercept in the OLS model, residuals sum to approximately zero, so a raw residual-mean Sharpe ratio is meaningless. The residual edge ratio divides annualized alpha by annualized residual volatility, forming an appraisal or information-ratio-style statistic.