Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (33 sloc) 2.35 KB


A Julia package for causal inference, graphical models and structure learning with the PC algorithm. This package contains for now the classical (unstable) PC algorithm pcalg, tested on random DAGs by comparing the result of the PC algorithm using the d-separation oracle with the CPDAG computed with Chickering's DAG->CPDAG conversion algorithm (implemented as dsep and cpdag in this package).

See the Library for other implemented functionality.

The algorithms use the SimpleGraph and SimpleDiGraph graph representation of the Julia package LightGraphs. Both types of graphs are represented by sorted adjacency lists (vectors of vectors in the LightGraphs implemention).

CPDAGs are just modelled as SimpleDiGraphs, where unoriented edges are represented by a forward and a backward directed edge.


Compute skeleton graph h with separating sets S and CPDAG g from the 47x1190 data set NCI-60 on expression profiles of miRNAs and mRNAs

using Distributions
using CausalInference
using LightGraphs

p = 0.01

# Download data 

# Read data and compute correlation maxtrix
X = readdlm("NCI-60.csv")
d, n = size(X)
C = Symmetric(cor(X, 2)) 

# Compute skeleton `h` and separting sets `S`
h, S = skeleton(d, gausscitest, (C, n), quantile(Normal(), 1-p/2))

# Compute the CPDAG `g`
g = pcalg(d, gausscitest, (C, n), quantile(Normal(), 1-p/2)) 

(Using data from T. D. Le, L. Liu et al.: Inferring microRNA–mRNA causal regulatory relationships from expression data, Bioinformatics, vol. 29, no. 6, 765–771, 2013.)


The speed of the algorithm is comparable with the C++ code of the R package pcalg after some pending optimizations.


See issue #1 (Roadmap/Contribution) for questions and coordination of the development.


  • D. M. Chickering: Learning Equivalence Classes of Bayesian-Network Structures. Journal of Machine Learning Research 2 (2002), 445-498.
  • D. Colombo, M. H. Maathuis: Order-Independent Constraint-Based Causal Structure Learning. Journal of Machine Learning Research 15 (2014), 3921-3962.