cumulants_from_sums#
- causalbase.lingam.cumulants_from_sums(client_stats)[source]#
Merge the blocks’ moment sums and return the pooled covariance and cumulants.
- Parameters:
- client_statsSequence[dict]
moment_sums()of each block of rows, all of the same order and over the same variables. One block gives the cumulants of a single table.
- Returns:
- dict
n: int – total sample count.cov:(p, p)– sample covariance matrix.c3:(p,)– C₃(xᵢ).c12:(p, p)– C₁,₂(xᵢ, xⱼ) = Cum(xᵢ, xⱼ, xⱼ).c21:(p, p)– C₂,₁(xᵢ, xⱼ) = Cum(xᵢ, xᵢ, xⱼ).
When the sums are of order 4, also:
c4:(p,)– C₄(xᵢ).c13:(p, p)– C₁,₃(xᵢ, xⱼ) = Cum(xᵢ, xⱼ, xⱼ, xⱼ).c31:(p, p)– C₃,₁(xᵢ, xⱼ) = Cum(xᵢ, xᵢ, xᵢ, xⱼ).c22:(p, p)– C₂,₂(xᵢ, xⱼ) = Cum(xᵢ, xᵢ, xⱼ, xⱼ).
An empty dict when client_stats is empty.
- Raises:
- ValueError
If the blocks have sums of different orders or over different numbers of variables, or fewer rows in total than the order needs.
Notes
The bias corrections are the k-statistics of Schefczik and Hägele, with Mₖ the sum of k-th powers about the pooled mean:
3rd order: k₃ = N / ((N-1)(N-2)) · M₃.
4th order: k₄ = [N(N+1) M₄ - 3(N-1) M₂²] / [(N-1)(N-2)(N-3)].