Skip to main content

Module causality

Module causality 

Source

Functions§

conditional_granger_causality
Conditional Granger causality (Geweke 1984). Tests if source Granger-causes target controlling for condition.
directed_transfer_function
Directed transfer function (Kaminski & Blinowska 1991). Returns (d × d × n_freqs) flat Vec.
identity_flat 🔒
pairwise_granger_causality
Pairwise Granger causality (Granger 1969). Returns log-likelihood ratio. Positive = source Granger-causes target.
partial_directed_coherence
Partial directed coherence (Baccala & Sameshima 2001). Returns (d × d × n_freqs) flat Vec.
solve_spd 🔒
Solve the symmetric positive-definite system S X = B via Cholesky factorisation. S (n×n, row-major) is a ridge-regularised normal-equations matrix XᵀX + εI, which is positive-definite for any ε > 0; B is n×m, row-major. Returns X (n×m, row-major).
spectral_granger_causality
Spectral Granger causality (Geweke 1982). Returns (d × d × n_freqs) as flat Vec, row-major in [i][j][f] order.
spectral_matrix 🔒
Build the multivariate-autoregressive spectral matrix A(f) = I − Σ_{k=0}^{order−1} A_{k+1} · e^{−i2πf(k+1)} at normalised frequency f ∈ [0, 0.5), from the row-major VAR coefficient stack beta ((order·d) × d). Block k is transposed on the fly: coeff_block.T[i, j] = beta[k·d + j, i]. A(f) is a general complex, non-Hermitian matrix.
spectral_transfer_inverse 🔒
Invert the MVAR spectral matrix A(f) to the transfer function H(f) = A(f)⁻¹ via LU factorisation, returning None when A(f) is numerically singular (|det A(f)| < 1e-30).
sse_ols 🔒
Sum of squared errors for OLS regression: SSE = ||y - X beta||^2.
var_coefficients 🔒
Fit VAR(order) model. Returns (beta [order*d × d, row-major], sigma [d×d, row-major]).