# Quant Statistics

Quantitative statistical methods: ADF unit-root / cointegration tests, GARCH volatility...

- Repository: https://github.com/HKUDS/Vibe-Trading (37375 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add HKUDS/Vibe-Trading --skill quant-statistics -g -a claude-code -y`
Codex: `npx skills add HKUDS/Vibe-Trading --skill quant-statistics -g -a codex -y`
Cursor: `npx skills add HKUDS/Vibe-Trading --skill quant-statistics -g -a cursor -y`
Gemini CLI: `npx skills add HKUDS/Vibe-Trading --skill quant-statistics -g -a gemini-cli -y`

## Description

Quantitative statistical methods: ADF unit-root / cointegration tests, GARCH volatility modeling, regression diagnostics (heteroskedasticity / autocorrelation), Bootstrap, and hypothesis testing.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Quantitative Statistical Methods

## Overview

Common statistical methodology used in quantitative investing, covering time-series testing, volatility modeling, regression diagnostics, and statistical inference. Provides the statistical foundation for strategy development and factor research.

## Implementation

Every test below is already implemented and unit-tested in `src.quantlib.timeseries`. **Import and call it, do not retype these formulas into throwaway code**, which is how sign errors and double-sqrt bugs get into results.

```python
from src.quantlib.timeseries import (
    adf_test, cointegration_test, find_hedge_ratio, compute_half_life,
    granger_test, fit_garch, heteroscedasticity_test, autocorrelation_test,
    vif_test, bootstrap_statistic, bootstrap_sharpe,
)
```

**Optional backends**: `statsmodels` powers everything except the two bootstrap helpers (which are pure numpy); `arch` powers `fit_garch` only. Neither is declared as a dependency of `vibe-trading-ai`, so both are imported lazily inside the functions. Importing the module always works; calling a function whose backend is missing raises an `ImportError` naming the package and the install command (`pip install "statsmodels>=0.14"` / `pip install "arch>=6.0"`). If you hit that error, report it to the user rather than silently substituting a different method.

## Time-Series Tests

### 1. ADF Unit-Root Test (Stationarity Test)

**Why it matters**: regressing non-stationary series directly can produce spurious regression, making conclusions unreliable.

```python
from src.quantlib.timeseries import adf_test

result = adf_test(prices['close'], significance=0.05)
# {'adf_statistic': -1.23, 'p_value': 0.65, 'lags_used': 4,
#  'is_stationary': False,
#  'critical_values': {'1%': -3.44, '5%': -2.87, '10%': -2.57}}

if not result['is_stationary']:
    returns = np.log(prices['close']).diff().dropna()
    adf_test(returns)  # log returns are normally stationary
```

**Decision rules**:

The rest: https://github.com/HKUDS/Vibe-Trading/blob/HEAD/agent/src/skills/quant-statistics/SKILL.md
