Associations.jl
Associations.jl copied to clipboard
Is there any relation to the CausalInference.jl package?
Hi @sbacelar!
The CausalInference.jl package is related, but provides a much more limited and specialized set of functions. Here are some differences:
CausalInference.jl provides:
- Top-level functions for the PC and FCI causal graph inference algorithms.
- Tools for reasoning about directed acyclic graphs (which are the output of the PC and FCI algorithm)
- Three association measures: (partial) correlation, (conditional) mutual information (but only one estimator of the latter)
- Two independence tests: a gaussian one (which CausalityTools will also have when #249 is implemented), and one based on conditional mutual information.
CausalityTools.provides
- Top level function for the optimal causation entropy (OCE) graph inference algorithm. Other graph algorithms on the way are the PCMCI (Runge et al) and the PC algorithm (the same as for CausalInference.jl)
- Currently, no tools for reasoning about directed acyclic graphs, but there are plans to implement some machinery similar to that of CausalInference.jl, or re-use it here.
The major difference to CausalInference.jl is how this package is strucured. It provides three conceptually different layers:
- Association measures. While CausalInference.jl only has two measures (CMI and correlation), we offer many more association measures. See here for an overview.
- Many of our measures can be estimated in a plethora of different ways. For example, here you can compute conditional mutual information (
CMIShannon
) using about 15 different estimators from the literature (see overview here), both discrete and continuous and mixed. Information-based measures in this package tries to be compatible with the discrete estimators from ComplexityMeasures.jl. We also have three different estimators for the convergence cross mapping (CCM) algorithm (see here). Other things we offer are recurrence-based association measures, distance correlation, regular correlation and much more. - Independence tests. See overview here. Notably,
SurrogateTest
can be used with any association measure from the list above and any surrogate type from TimeseriesSurrogates.jl, which in itself gives you more than ten conceptually distinct surrogate-based permutation/randomization tests. The more modernLocalPermutationTest
conditional independence test can be used with any conditional association measure that is implemented. In contrast, with CausalInference.jl, you only have two options for indepence testing: a Gaussian independence test using correlation, or a CMI-test with one (1) alternative for estimation. - Any
SurrogateTest
orLocalPermutationTest
can be used as input to the OCE causal graph algorithm. Future implementations of the PC algorithm and related causal graph algorithms will also be equally flexible. - Our tests are reproducible, because you can provide your own RNG instance to the independence tests.
I haven't counted, but with all the available options, there must be hundreds of ways of inferring causal graphs at the top-level already, using only the OCE
algorithm. Some of these estimation routes have been explored in the literature, while most of them have not. But here you can pick and choose from any estimator of any measure from the literature (provided that it is implemented), and just apply it to whatever independence test (provided it is implemented), which in turn can be applied to any causal graph algorithm you want (provided the graph algorithm is implemented).
In summary, the design philosophy of this package is modularity and reproducibility. It is a practical attempt at unifying all the various ways of computing associations between any kind of data, and determining if such associations are significant. You can consider it a kind-of ongoing literature review of association, independence testing and causal graph inference, with code to back it up.
CausalInference.jl provides a very small subset of this functionality, with some very nice additional tools to reason about the resulting graphs. If you're interested in applying the PC algorithm, you should use that package for now. For anything else, you have many more options here. I suspect there will be almost complete overlap between both packages in the not-so-distant future. However, there is no way of easily merging CausalInference.jl with our stuff, or vice versa, because of our modular API design.
I think that should cover it! Feel free to drop any questions if there's something I missed.
Thank you for your answer.
I have been asking chatGPT
for some references about causal inference, one of which was this ArXiV
paper: Kalainathan, D., & Goudet, O. (2019). Causal Discovery Toolbox: Uncover causal relationships in Python. ArXiv. /abs/1903.02278. I wanted to know if there is any similar software for Julia and found CausalInference.jl
and CausalityTools.jl
.
I have searched Pearl
(from Judea Pearl) in CausalityTools.jl
but found none. Maybe IMO it would be interesting to add some references to the documentation.
I have been asking chatGPT for some references about causal inference
The future had to catch up with this repository too 😁
I have searched Pearl (from Judea Pearl) in CausalityTools.jl but found none. Maybe IMO it would be interesting to add some references to the documentation.
The reason why you don't find any reference to Pearl here yet is because none of the methods currently implemented deal directly with his work. When the PC algorithm is released in the near future, its docstring will reference Pearl, as well as Spirtes et al. and related works (which are referenced in the paper you mentioned).
Until now, we've been focused on getting all the low-level machinery and a stable API in place. Since that is now in place since v2.0, the natural next step now is to implement PC, and any other related causal inference frameworks that exist out there. (PS: pull requests are very welcome, if you feel inclined!)
Maybe IMO it would be interesting to add some references to the documentation.
We definitely need some sort of summary page where all the seminal works on the topic are mentioned! I'll keep this issue open as a reminder.
this ArXiV paper: Kalainathan, D., & Goudet, O. (2019). Causal Discovery Toolbox: Uncover causal relationships in Python. ArXiv. /abs/1903.02278.
Under the hood, the graph inference pipeline for this package is actually quite similar to what is described in Figure 1 of this paper. In particular, you can use any pairwise association measure in this package to infer an undirected graph (the middle portion of their Figure 1). However, you'd have to do it manually until the PC or related algorithms is in place (or use CausalInference.jl!)
Unfortunately, I have no knowledge of the Python package or the R packages mentioned in the paper. I'm implementing everything from scratch here, as part of my learning journey and own research on time series causal inference.
If there's anything in particular you'd like to see in terms of functionality, you can always open a specific issue to request its implementation!