Conditional independence statements
Conditional independence (CI) statements over a ground set $N$ are triples of pairwise disjoint subsets $I, J, K \subseteq N$ denoted as $[I \mathrel{⫫} J \mid K]$. The ground set indexes objects under consideration and the CI statement asserts that once the objects in $K$ are "controlled" (conditioned on, in statistical language), the objects in $I$ reveal no information about (are independent of) the objects in $J$.
The functionality documented here deals with CI statements are combinatorial objects. Collections of CI statements are often used to state Markov properties of graphical models in statistics and are ultimately used to define ideals. Their interpretations as polynomial equations depend on the ambient ring (markov_ring or gaussian_ring).
ci_stmt — Function
ci_stmt(I::Vector{Int}, J::Vector{Int}, K::Vector{Int}; symmetric=true, disjoint=true)A conditional independence statement asserting that I is independent of J given K. These parameters are lists of names of random variables. The sets I and J must be disjoint as this package cannot yet deal with functional dependencies.
If symmetric is true, CI statements are assumed to be symmetric in their I and J components. The constructor then reorders the arguments to make the I field lexicographically smaller than the J to ensure that comparisons and hashing respect the symmetry.
If disjoint is set to true, the constructor also removes elements in the intersection of I and K from I (and symmetrically removes the intersection of J and K from J).
As all three fields are sets, each of them may be deduplicated and sorted to ensure consistent comparison and hashing.
Examples
julia> ci_stmt([1], [2], [3,4])
[1 _||_ 2 | {3, 4}]
julia> ci_stmt([1], [2, 3], [4, 5])
[1 _||_ {2, 3} | {4, 5}]This function is part of the experimental code in Oscar. Please read here for more details.
@CI_str — Macro
CI"I...,J...|K..."A literal syntax for denoting CI statements is provided for cases in which all variables consist of a single digit. If I and J only consist of a single element, then even the comma may be omitted. Once the three sets are extracted, ci_stmt is called with default values for its options.
Examples
julia> CI"12|3"
[1 _||_ 2 | 3]
julia> CI"1,23|5424"
[1 _||_ 3 | {2, 4, 5}]This function is part of the experimental code in Oscar. Please read here for more details.
ci_statements — Function
ci_statements(random_variables::Vector{Int})Return a list of all elementary CI statements over a given set of variables. A CIStmt(I, J, K) is elementary if both I and J have only one element.
As a consequence of the semigraphoid properties, these statements are enough to describe the entire CI structure of a probability distribution.
Examples
julia> ci_statements([1, 2, 3, 4])
24-element Vector{CIStmt}:
[1 _||_ 2 | {}]
[1 _||_ 2 | 3]
[1 _||_ 2 | 4]
[1 _||_ 2 | {3, 4}]
[1 _||_ 3 | {}]
[1 _||_ 3 | 2]
[1 _||_ 3 | 4]
[1 _||_ 3 | {2, 4}]
[1 _||_ 4 | {}]
[1 _||_ 4 | 2]
⋮
[2 _||_ 3 | {1, 4}]
[2 _||_ 4 | {}]
[2 _||_ 4 | 1]
[2 _||_ 4 | 3]
[2 _||_ 4 | {1, 3}]
[3 _||_ 4 | {}]
[3 _||_ 4 | 1]
[3 _||_ 4 | 2]
[3 _||_ 4 | {1, 2}]This function is part of the experimental code in Oscar. Please read here for more details.
ci_statements(R::MarkovRing)Return all the CIStmt objects which can be formed on the random_variables(R).
julia> R = markov_ring(2, 2, 2, 2)
Markov ring over rational field for 4 random variables and states (2, 2, 2, 2)
julia> ci_statements(R)
24-element Vector{CIStmt}:
[1 _||_ 2 | {}]
[1 _||_ 2 | 3]
[1 _||_ 2 | 4]
[1 _||_ 2 | {3, 4}]
[1 _||_ 3 | {}]
[1 _||_ 3 | 2]
[1 _||_ 3 | 4]
[1 _||_ 3 | {2, 4}]
[1 _||_ 4 | {}]
[1 _||_ 4 | 2]
⋮
[2 _||_ 3 | {1, 4}]
[2 _||_ 4 | {}]
[2 _||_ 4 | 1]
[2 _||_ 4 | 3]
[2 _||_ 4 | {1, 3}]
[3 _||_ 4 | {}]
[3 _||_ 4 | 1]
[3 _||_ 4 | 2]
[3 _||_ 4 | {1, 2}]This function is part of the experimental code in Oscar. Please read here for more details.
ci_statements(R::GaussianRing)Return all the CIStmt objects which can be formed on the random_variables(R).
julia> R = gaussian_ring(3)
GaussianRing over Rational field in 6 variables
s[1, 1], s[1, 2], s[1, 3], s[2, 2], s[2, 3], s[3, 3]
julia> ci_statements(R)
6-element Vector{CIStmt}:
[1 _||_ 2 | {}]
[1 _||_ 2 | 3]
[1 _||_ 3 | {}]
[1 _||_ 3 | 2]
[2 _||_ 3 | {}]
[2 _||_ 3 | 1]This function is part of the experimental code in Oscar. Please read here for more details.
ci_ideal — Function
ci_ideal(R::MarkovRing, stmts)::MPolyIdealReturn the ideal for the conditional independence statements given by stmts.
Examples
julia> R = markov_ring(2, 2, 2)
Markov ring over rational field for 3 random variables and states (2, 2, 2)
julia> ci_ideal(R, [CI"1,3|2", CI"2,3|1"])
Ideal generated by
p[1, 1, 1]*p[2, 1, 2] - p[2, 1, 1]*p[1, 1, 2]
p[1, 2, 1]*p[2, 2, 2] - p[2, 2, 1]*p[1, 2, 2]
p[1, 1, 1]*p[1, 2, 2] - p[1, 2, 1]*p[1, 1, 2]
p[2, 1, 1]*p[2, 2, 2] - p[2, 2, 1]*p[2, 1, 2]This function is part of the experimental code in Oscar. Please read here for more details.
ci_ideal(R::GaussianRing, stmts::Vector{CIStmt})Return the ideal for the conditional independence statements given by stmts.
Examples
julia> R = gaussian_ring(3)
GaussianRing over Rational field in 6 variables
s[1, 1], s[1, 2], s[1, 3], s[2, 2], s[2, 3], s[3, 3]
julia> ci_ideal(R, [CI"1,2|", CI"1,2|3"])
Ideal generated by
s[1, 2]
s[1, 2]*s[3, 3] - s[1, 3]*s[2, 3]This function is part of the experimental code in Oscar. Please read here for more details.
make_elementary — Method
make_elementary(stmt::CIStmt; semigaussoid=false)Convert a CIStmt into an equivalent list of CIStmts all of which are elementary. The default operation assumes the semigraphoid axioms and converts $[I \mathrel{⫫} J \mid K]$ into the list consisting of $[i \mathrel{⫫} j \mid L]$ for all $i \in I$, $j \in J$ and $L$ in the interval $K \subseteq L \subseteq (I \cup J \cup K) \setminus \{i,j\}$.
If semigaussoid is true, the stronger semigaussoid axioms are assumed and L in the above procedure does not range in the interval above K but is always fixed to K. Semigaussoids are also known as compositional graphoids.
Examples
julia> make_elementary(CI"12,34|56")
16-element Vector{CIStmt}:
[1 _||_ 3 | {5, 6}]
[1 _||_ 3 | {5, 6, 2}]
[1 _||_ 3 | {5, 6, 4}]
[1 _||_ 3 | {5, 6, 2, 4}]
[1 _||_ 4 | {5, 6}]
[1 _||_ 4 | {5, 6, 2}]
[1 _||_ 4 | {5, 6, 3}]
[1 _||_ 4 | {5, 6, 2, 3}]
[2 _||_ 3 | {5, 6}]
[2 _||_ 3 | {5, 6, 1}]
[2 _||_ 3 | {5, 6, 4}]
[2 _||_ 3 | {5, 6, 1, 4}]
[2 _||_ 4 | {5, 6}]
[2 _||_ 4 | {5, 6, 1}]
[2 _||_ 4 | {5, 6, 3}]
[2 _||_ 4 | {5, 6, 1, 3}]
julia> make_elementary(CI"12,34|56"; semigaussoid=true)
4-element Vector{CIStmt}:
[1 _||_ 3 | {5, 6}]
[1 _||_ 4 | {5, 6}]
[2 _||_ 3 | {5, 6}]
[2 _||_ 4 | {5, 6}]This function is part of the experimental code in Oscar. Please read here for more details.