polars_online.corr.equicorr_row

polars_online.corr.equicorr_row(row: Any) → float[source]

Estimate the common correlation from one standardized row, by Engle and Kelly’s closed form.

Use it to compute, offline, the per-row estimate a deco model reads: Engle and Kelly’s Lemma 2.3. For the mean correlation of a whole matrix, use equicorr().

Parameters

row

One row of n standardized values (each series less its mean, over its standard deviation).

Returns

A float:

u = (S1**2 - S2) / ((n - 1) * S2),    S1 = sum(x),  S2 = sum(x * x)

with x the row. It is nan below two entries or at S2 = 0.

Examples

print(round(po.corr.equicorr_row([1.2, 0.8, 1.0, -0.2]), 3))
0.504

See also