moment_sums#

fedcausal.lingam.moment_sums(x, order=4)[source]#

Return the moment sums of x, centred on its own mean.

Sums centred on each block’s own mean merge exactly, and they stay accurate wherever the data are located; raw power sums lose every significant digit once the mean is a few thousand standard deviations away from zero.

Parameters:
xnumpy.ndarray

A block of rows, shape (n, p), with n samples and p variables.

order{3, 4}, default 4

Maximum order of moments to compute.

Returns:
dict

With c = x - mean:

  • n : int – sample count.

  • mean : (p,) – column means.

  • m11 : (p, p) – Σ cᵢ cⱼ.

  • m21 : (p, p) – Σ cᵢ² cⱼ; its diagonal is Σ cᵢ³.

When order is 4, also:

  • m31 : (p, p) – Σ cᵢ³ cⱼ; its diagonal is Σ cᵢ⁴.

  • m22 : (p, p) – Σ cᵢ² cⱼ².