Skip to main content

Time-Aware PC Python Package

Project description

TimeAwarePC: A Python Package for Finding Causal Connectivity from Time Series Data image Documentation Status

TimeAwarePC is a Python package that implements the Time-Aware PC Algorithm for finding the Causal Functional Connectivity from time series data, based on recent research in directed probabilistic graphical modeling with time series [1]. The package also includes implementations of Granger Causality and the PC algorithm.

Installation

Requirements

  • Python >=3.7, <3.11
  • Python packages automatically checked and installed as part of the setup. To use Granger Causality, additional dependency of nitime which can be installed by pip install nitime.
  • R == 4.4.2
  • R package kpcalg and its dependencies. They can be installed in R or RStudio as follows:
> install.packages("BiocManager")
> BiocManager::install("graph")
> BiocManager::install("RBGL")
> install.packages("pcalg")
> install.packages("https://cran.r-project.org/src/contrib/Archive/kpcalg/kpcalg_1.0.1.tar.gz")

After meeting these requirements, you can get the latest version of TimeAwarePC as follows.

$ pip install timeawarepc

Documentation

Documentation is available at readthedocs.org

Tutorial

See the Quick Start Guide for a quick tutorial of the main functionalities of this library and check if it is installed properly.

What's new in v2.0.0 (BREAKING)

  • cfc_tpc now defaults to no bootstrap subsampling: a single PC run is performed on the full time-delayed data.
    • To enable the legacy bootstrap behavior (50-row windows, 25 iterations), pass subsampsize=50, niter=25 explicitly.
    • Both subsampsize and niter must be specified together (or both left as the default None).
  • partial_corr now fits an intercept and is shift-invariant. Previously the regression was forced through the origin, biasing residuals when the data was not mean-centered.
  • See CHANGELOG.md for the full list of changes and migration notes.

Contributing

Your help is absolutely welcome! Please do reach out or create a feature branch!

Citation

Biswas, R., & Shlizerman, E. (2022). Statistical Perspective on Functional and Causal Neural Connectomics: The Time-Aware PC Algorithm. https://doi.org/10.1371/journal.pcbi.1010653

Biswas, R., & Shlizerman, E. (2021). Statistical Perspective on Functional and Causal Neural Connectomics: A Comparative Study. Frontiers in Systems Neuroscience. https://doi.org/10.3389/fnsys.2022.817962

References

R Clay Reid. (2012) From functional architecture to functional connectomics. Neuron, 75(2):209–217.

Smith, S. M., Miller, K. L., Salimi-Khorshidi, G., Webster, M., Beckmann, C. F., Nichols, T. E., ... & Woolrich, M. W. (2011). Network modelling methods for FMRI. Neuroimage, 54(2), 875-891.

Judea Pearl. (2009) Causality. Cambridge University press.

Markus Kalisch and Peter Bhlmann. (2007) Estimating high-dimensional directed acyclic graphs with the pc-algorithm. In The Journal of Machine Learning Research, Vol. 8, pp. 613-636.

Peter Spirtes, Clark N Glymour, Richard Scheines, and David Heckerman. (2000) Causation, prediction, and search. MIT press.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timeawarepc-2.0.0.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timeawarepc-2.0.0-py2.py3-none-any.whl (26.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file timeawarepc-2.0.0.tar.gz.

File metadata

  • Download URL: timeawarepc-2.0.0.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for timeawarepc-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ac2bd7034bca8e5a39a290ba4a01426034c4d00fc65fc8cb3496e2b642002b8f
MD5 f8ea1e866dd6f87dcca5ad6e777f4218
BLAKE2b-256 b17d3037e82ed50115546ce4292ebe7c99a8e49c20c0e46bbaefba8469623d38

See more details on using hashes here.

File details

Details for the file timeawarepc-2.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: timeawarepc-2.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for timeawarepc-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1d6ec2dd6be2ceb22faf808a2b808c93ff20a9942ef4fedc96b1958e94b1031d
MD5 35e0dcf14b64b18b44331fec22156e66
BLAKE2b-256 e0b577ad42f86bdb4db97e39fc2ab0e40a72506c54a74bfd22cd70f44b2f6ef5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page