Expand description
Granger causality testing for embedding trajectories.
Tests whether entity A’s movements in embedding space precede entity B’s. Uses a VAR(L) model on dimensionality-reduced trajectories.
§Algorithm
- Align trajectories to a common time grid (linear interpolation)
- For each dimension d:
- Fit restricted model:
B_d(t) = Σ β_l · B_d(t-l) + ε - Fit unrestricted model:
B_d(t) = Σ β_l · B_d(t-l) + Σ γ_l · A_d(t-l) + ε - F-test: does the unrestricted model significantly improve?
- Fit restricted model:
- Combine per-dimension p-values via Fisher’s method
§References
- Granger, C.W.J. (1969). Investigating causal relations. Econometrica, 37(3).
- Fisher, R.A. (1925). Statistical methods for research workers.
Structs§
- Granger
Result - Result of a Granger causality test.
Enums§
- Granger
Direction - Direction of Granger causality.
Functions§
- align_
trajectories 🔒 - Align two trajectories to a common time grid via linear interpolation.
- cholesky_
solve 🔒 - Solve Ax = b where A is symmetric positive definite via Cholesky.
- erfc 🔒
- Complementary error function approximation.
- f_
statistic 🔒 - Compute F-statistic from restricted and unrestricted RSS.
- f_to_p 🔒
- Approximate p-value from F-statistic using the F-distribution.
- fisher_
combine 🔒 - Fisher’s method: combine independent p-values.
- fit_
and_ 🔒rss - Fit a simple autoregressive model and return residual sum of squares.
- granger_
causality - Test Granger causality between two embedding trajectories.
- interpolate_
at 🔒 - Linear interpolation of a trajectory at a specific timestamp.
- ln_beta 🔒
- Log of the Beta function: ln(B(a,b)) = ln(Gamma(a)) + ln(Gamma(b)) - ln(Gamma(a+b))
- ln_
gamma 🔒 - Stirling’s approximation for ln(Gamma(x)) for x > 0.
- ols_
granger_ 🔒single_ dim - Fit OLS for a single dimension and compute residual sum of squares.
- regularized_
incomplete_ 🔒beta - Regularized incomplete beta function via continued fraction (Lentz’s method).
- solve_
ols 🔒 - Solve OLS via normal equations with regularization.
- test_
direction 🔒 - Test one direction: does
causeGranger-causeeffect?