fastEDM Python Package
Package Description
Empirical Dynamic Modeling (EDM) is a way to perform causal analysis on time series data.
The fastEDM
Python package implements a series of EDM tools, including the convergent cross-mapping algorithm.
Key features of the package:
- powered by a fast multi-threaded C++ backend,
- able to process panel data, a.k.a. multispatial EDM,
- able to handle missing data using new
dt
algorithms or by dropping points.
Installation
To install the latest version from Github using pip
run:
Example: Chicago crime levels and temperature
This example, looking at the causal links between Chicago’s temperature and crime rates, is described in full in our paper:
from fastEDM import easy_edm
import pandas as pd
url = "https://github.com/EDM-Developers/fastEDM-r/raw/main/vignettes/chicago.csv"
chicago = pd.read_csv(url)
chicago["Crime"] = chicago["Crime"].diff()
crimeCCMCausesTemp = easy_edm("Crime", "Temperature", data=chicago, verbosity=0)
#> No evidence of CCM causation from Crime to Temperature found.
tempCCMCausesCrime = easy_edm("Temperature", "Crime", data=chicago, verbosity=0)
#> Some evidence of CCM causation from Temperature to Crime found.
Stata & R packages
We have created the edm Stata package and are currently developing this package alongside the fastEDM R package. The fastEDM
packages are direct ports of the Stata package to R & Python.
As all the packages share the same underlying C++ code, their behaviour will be identical.
Other Resources
This site serves as the primary source of documentation for the package, though there is also:
- our Stata Journal paper which explains the package and the overall causal framework, and
- Jinjing's QMNET seminar on the package, the recording is on YouTube and the slides are here.
Authors
- Patrick Laub (author, maintainer),
- Jinjing Li (author),
- Michael Zyphur (author),
- Edoardo Tescari (contributor),
- Simon Mutch (contributor),
- Rishi Dhushiyandan (contributor),
- George Sugihara (originator)
Citation
Jinjing Li, Michael J. Zyphur, George Sugihara, Patrick J. Laub (2021), Beyond Linearity, Stability, and Equilibrium: The edm Package for Empirical Dynamic Modeling and Convergent Cross Mapping in Stata, Stata Journal, 21(1), pp. 220-258
@article{edm-stata,
title={Beyond linearity, stability, and equilibrium: The edm package for empirical dynamic modeling and convergent cross-mapping in {S}tata},
author={Li, Jinjing and Zyphur, Michael J and Sugihara, George and Laub, Patrick J},
journal={The Stata Journal},
volume={21},
number={1},
pages={220--258},
year={2021},
}