implementation of convergent cross mapping by Sugihara et al (2012)
Project description
causal_ccm
Package implementing Convergent Cross Mapping for causality inference in dynamical systems as defined by Sugihara et al (2012)
Example usage
For an example how to use, see: https://github.com/PrinceJavier/causal_ccm/blob/main/usage_sample.ipynb
Source code: https://github.com/PrinceJavier/causal_ccm
To install
pip install causal-ccm
To use
Say we want to check if X drives Y. We first define ccm
using:
X
andY
- time series datatau
- time lag (iftau=1
we get[t, t-1, t-2...]
as our shadow manifold embeddingE
- embedding dimension (default=2) for the shadow manifoldL
- time horizon to consider, defaults at length of time series X
We import the package
from causal_ccm.causal_ccm import ccm
We define ccm
:
ccm1 = ccm(X, Y, tau, E, L) # define ccm with X, Y time series
We check the strength of causality measured as correlation in prediction vs true (see Sugihara (2012))
ccm1.causality()
We can visualize cross mapping between manifolds of X and Y
ccm1.visualize_cross_mapping()
We visualize correlation of X->Y
We stronger correlation = stronger causal relationship
ccm1.plot_ccm_correls()
Finally, we can check convergence in predictions (correlations) by computing ccm1.causality()
for ccm1
defined with different L values.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for causal_ccm-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b59e67d6e4db35fdd21d518bbf0ac9dfef869a9e975bcdfa442494013ece98c0 |
|
MD5 | a616b03d978efe1e2bd330b9a7078708 |
|
BLAKE2b-256 | 46e21ee8717b1d5c6dc861ad3bc0e7c78d11a0f555722613af9056ae76f73852 |