JuliaDynamics / Associations.jl

Algorithms for quantifying associations, independence testing and causal inference from data.
https://juliadynamics.github.io/Associations.jl/stable/
Other
147 stars 12 forks source link

Is there any relation to the CausalInference.jl package? #285

Open sbacelar opened 1 year ago

kahaaga commented 1 year ago

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:

CausalityTools.provides

The major difference to CausalInference.jl is how this package is strucured. It provides three conceptually different layers:

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.

sbacelar commented 1 year ago

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.

kahaaga commented 1 year ago

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!