Skip to content

Superseded (2026-05-25) — this operator is a Layer-1 transform, not a Layer-0 atomic input. Merged into correlation_matrix_v1. Kept for history.

What (One-liner)

Pairwise Pearson correlation matrix (numpy.corrcoef wrapper). Library-level primitive, core dependency for portfolio / regime / criticality.

How to use

python
from services.algo.statistics import correlation_matrix
correlation_matrix({
    "SPY": [1, 2, 3, 4, 5],
    "TLT": [5, 4, 3, 2, 1],
})
# → {"SPY": {"SPY": 1.0, "TLT": -1.0}, "TLT": {"SPY": -1.0, "TLT": 1.0}}

Core formulas

ρ_{ij} = Cov(X_i, X_j) / (σ_i × σ_j)   # numpy.corrcoef

Assumptions & applicability

Assumptions: Synchronous + same length + n≥2.

Applicable: Portfolio covariance, regime, herd-risk criticality.

Not Applicable: Non-linear, pairwise missing, high-dim low sample (use Ledoit-Wolf).

Known limitations

  1. Pearson linear assumption
  2. No pairwise complete
  3. Underestimation for fat tails

References

Pearson (1895) original + Ledoit-Wolf (2004) shrinkage improvement.

Golden Test

tests/golden/fixtures/tier1/correlation_matrix/, 1e-12, 2026-04-20 passing.

Changelog

  • 1.0.0 (2026-04-20) — First Active

Verifiable intelligence for the decisions that demand scrutiny.