rheon.corr.mp_edge

rheon.corr.mp_edge(n: int, m: int, sigma2: float = 1.0) → tuple[float, float][source]

Compute the Marchenko-Pastur edges for n observations of m series.

Use it to tell a correlation matrix’s eigenvalues from noise: eigenvalues between the edges are what pure noise produces, and only those above the upper edge carry information (Laloux, Cizeau, Bouchaud and Potters, 1999). For the density between the edges, use mp_density().

Parameters

n

The number of observations, above 0.

m

The number of series, above 0.

sigma2

The noise variance. Default 1, a correlation matrix’s.

Returns

(lam_minus, lam_plus), two floats:

lam_pm = sigma2 * (1 +- 1/sqrt(Q))**2,    Q = n / m

Q = 1 gives (0, 4 sigma2).

Raises

ValueError

n or m not above 0, or sigma2 not a finite number above 0.

Examples

lo, hi = rp.corr.mp_edge(n=400, m=100)
print(round(lo, 3), round(hi, 3))
0.25 2.25

See also