Library

Library

Directed acyclic graphs (DAGs)

CausalInference.dsepFunction.
dsep(g::AbstractGraph, u, v, s; verbose = false)

Check whether u and v are d-separated given set s. Algorithm: unrolled https://arxiv.org/abs/1304.1505

source
CausalInference.cpdagFunction.
cpdag(skel::DiGraph)

Reference: M. Chickering: Learning equivalence classes of Bayesian network structures. Journal of Machine Learning Research 2 (2002). M. Chickering: A Transformational Characterization of Equivalent Bayesian Network Structures. (1995).

Note that the edge order defined there is already partly encoded into the representation of a DiGraph.

source
CausalInference.vskelFunction.
vskel(g)

Skeleton and v-structures. (Currently from the first step of the pc-Alg.)

source

PC algorithm

CausalInference.pcalgFunction.
pcalg(n::V, I, par...)

Perform the PC algorithm for a set of 1:n variables using the tests

I(u, v, [s1, ..., sn], par...)

Returns the CPDAG as DiGraph.

source
skeleton(n, I) -> g, S

Perform the undirected PC skeleton algorithm for a set of 1:n variables using the test I. Returns skeleton graph and separating set

source
dseporacle(i, j, s, g)

Oracle for the skeleton and pcalg functions using dsep on the true graph g

source
unshielded(g, S)

Find unshielded triples in the skeleton. Triples are connected vertices v-w-z where z is not a neighbour of v. Uses that edges iterates in lexicographical order.

source

Statistics

gausscitest(i, j, s, (C,n), c)

Test for conditional independence of variable no i and j given variables in s with Gaussian test at the critical value c. C is covariance of n observations.

source
partialcor(i, j, s, C)

Compute the partial correlation of nodes i and j given list of nodes s using the correlation matrix C.

source

Miscellaneous

digraph(E)

Create DiGraph from edge-list.

source
CausalInference.pairsFunction.
pairs(g)

Return the edge-list as Pairs.

source
pc_oracle(g)

Compute CPDAG using the PC algorithm using the dseporacle on the DAG g.

source
skel_oracle(g)

Compute the skeleton using the dseporacle for the DAG g.

source
randdag(n, alpha = 0.1)

Create random DAG from randomly permuted random triangular matrix with edge probability alpha.

source
disjoint_sorted(u, v)

Check if the intersection of sorted collections is empty. The intersection of empty collectios is empty.

source
ordered_edges(dag)

Iterator of edges of a dag, ordered in Chickering order:

Perform a topological sort on the NODES
while there are unordered EDGES in g
    Let y be the lowest ordered NODE that has an unordered EDGE incident into it
    Let x be the highest ordered NODE for which x => y is not ordered
    return x => y 
end
source
insorted(a, x)

Check if x is in the sorted collection a

source
removesorted(collection, item) -> contains(collection, item)

Remove item from sorted collection.

source