Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

statistical-testing

БесплатноЗапускает вложенные скриптыНе проверен

Rigorous statistical evaluation of trading strategy returns to determine if alpha is real or a statistical artifact. Supports hypothesis testing, benchmark…

uberdeveloperот uberdeveloper★ 29 звёзд на GitHub

Об этом скилле

Statistical Testing Skill

Purpose

Answer the critical question: "Is this alpha real or just a statistical artifact?"

This skill provides rigorous statistical evaluation of trading strategy returns using classical hypothesis testing, distribution analysis, benchmark comparison, and conditional/segmented analysis.


Core Principles

<principles>
  <principle id="1">NO AMBIGUITY - If anything is unclear, HALT and ask the user. Never guess.</principle>
  <principle id="2">SPEED FIRST - Use scipy for classical tests; statsforecast/statsmodels only on explicit request</principle>
  <principle id="3">GRACEFUL DEGRADATION - If benchmark fetch fails, continue analysis and inform user</principle>
  <principle id="4">TWEET-STYLE OUTPUT - Default to concise summaries; expand on request</principle>
  <principle id="5">SMART DEFAULTS - Use LLM inference for asset class detection and benchmark selection</principle>
</principles>

Prerequisites

Required Input

  • Data file with date and returns columns
  • User hypothesis (explicit or inferable from prompt)

Optional Input

  • Benchmark data (column in file OR fetch permission)
  • Confidence level (default: 95%)
  • Conditional filters (e.g., "when VIX > 20")
  • Specific test selection (default: auto-select based on hypothesis)

Workflow

Step 1: Data Discovery

Action: Use load-data skill to peek at file

Expected Output: XML manifest with:

<data_manifest>
  <source>
    <file_path>...</file_path>
    <row_count>...</row_count>
  </source>
  <temporal_info>
    <date_column>...</date_column>
    <frequency>daily|weekly|monthly</frequency>
    <date_range>
      <start>YYYY-MM-DD</start>
      <end>YYYY-MM-DD</end>
    </date_range>
  </temporal_info>
  <columns>
    <column name="..." type="..." role="returns_candidate|feature|benchmark_candidate"/>
    ...
  </columns>
  <sample_data format="markdown">
    [5 rows in table format]
  </sample_data>
  <inferences>
    <primary_returns>column_name</primary_returns>
    <benchmark_available>true|false</benchmark_available>
    <benchmark_column>column_name or null</benchmark_column>
  </inferences>
</data_manifest>

Validation:

  • Date column identified (HALT if missing/ambiguous)
  • Returns column(s) identified (HALT if missing/ambiguous)
  • Benchmark column detected (optional, proceed without if missing)

Multiple Returns Columns:

IF multiple returns columns detected:
  1. List all candidates to user
  2. Ask: "Which column should I test?"
  3. IF no response → use first column
  4. Inform user which column was selected

Frequency Mismatch:

IF user specifies frequency BUT data frequency differs:
  1. HALT and inform user
  2. Show: "You said 'weekly' but data appears to be 'daily'"
  3. Ask: "Should I proceed with your specified frequency or use detected frequency?"
  4. IF user insists → use user's frequency (user override)

Step 2: Hypothesis & Intent Parsing

Action: Parse user prompt to determine test type AND user intent

Supported Hypothesis Types:

Type Example Prompt Test Method
Performance "Does my strategy have positive returns?" One-sample t-test, Wilcoxon signed-rank
Outperformance "Does my strategy beat NIFTY50?" Paired t-test, Wilcoxon signed-rank
Comparison "Is strategy A better than strategy B?" Independent t-test, Mann-Whitney U
Conditional "Does drawdown differ when VIX > 20?" Mann-Whitney U, t-test (based on distribution)
Stationarity "Are returns stationary over time?" ADF, KPSS (statsmodels, on explicit request)

Intent Detection (CRITICAL for Trading Strategies):

Parse BOTH hypothesis AND intent to determine if temporal validation is needed.

Intent Type Keywords Validation Required Examples
PRIORITY 1: Explicit Validation out of sample, oos, walk forward, cross validation, hold out YES (auto-run) "Show out of sample results"
PRIORITY 2: Future/Deploy work in future, going forward, deploy, robust, predict future, forecast, tomorrow, live trading, production YES (auto-run) "Will this work in future?"
PRIORITY 3: Optimization optimal, best, maximize, improve, enhance, find threshold, find parameter YES (ask user) "What's optimal threshold?"
PRIORITY 4: Exploratory why, explain, understand, analyze, correlate, relationship, pattern, what happened NO "Why did Feb perform poorly?"

Implementation Logic:

def detect_intent_and_validation_need(user_prompt):
    """Determine if temporal validation is needed"""

    # Priority 1: Explicit validation requests (no confirmation)
    if contains_any(user_prompt, [
        "out of sample", "oos", "walk forward",
        "cross validation", "hold out", "test set"
    ]):
        r
Полный SKILL.md на GitHub

Установить statistical-testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

ADVANCED_TEST_RESULTS.mdGIT_COMMIT_GUIDE.mdHOW_I_VALIDATED_TESTS.mdIMPLEMENTATION_SUMMARY.mdPROMPTS.mdREADME.mdREAL_DATA_TEST_RESULTS.mdTESTING_METHODOLOGY.mdreferences/ARCHITECTURE_DECISIONS.mdreferences/advanced_tests.pyscripts/advanced_scenarios_test.pyscripts/benchmark_fetcher.pyscripts/conditional_filter.pyscripts/example_usage.pyscripts/interactive_quant_test.pyscripts/live_validation_example.pyscripts/quick_advanced_test.pyscripts/reporter.pyscripts/test_engine.pyscripts/test_with_real_data.py

FAQ

Что делает скилл statistical-testing?

Rigorous statistical evaluation of trading strategy returns to determine if alpha is real or a statistical artifact. Supports hypothesis testing, benchmark comparison, conditional analysis, temporal validation, and distribution checks. Use when validating backtest results, comparing strategies, testing performance claims, optimizing parameters, or analyzing performance across market conditions. On-request advanced tests: adversarial robustness battery (sign-flip permutation, path shuffle, regime stress, sub-period consistency, block bootstrap, parameter plateau) and robust statistics (trimmed mean/Yuen, edge concentration, robust Sharpe) — run only when explicitly requested.

Как установить скилл statistical-testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл statistical-testing запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить statistical-testing с