Given a mixed graph G with directed and bidirected edges, let L be the matrix corresponding to the directed edges (see directedEdgesMatrix) and let W be the matrix corresponding to the bidirected edges (see bidirectedEdgesMatrix). Then, the covariance matrix S (see covarianceMatrix) of the random variables in the gaussian graphical model corresponding to the mixed graph G can be parametrized by the matrix equation S = (I-L)-TW(I-L)-1, where I is the identity matrix.
The entry S(i,j) of the covariance matrix can also be written as the sum of all monomials corresponding to treks between vertices i and j. See trekSeparation for the definition of a trek. The monomial corresponding to a trek is the product of all parameters associated to the directed and bidirected edges on the trek.
i1 : G = mixedGraph(digraph {{b,{c,d}},{c,{d}}},bigraph {{a,d}})
o1 = MixedGraph{Bigraph => Bigraph{a => set {d}} }
d => set {a}
Digraph => Digraph{b => set {c, d}}
c => set {d}
d => set {}
Graph => Graph{}
o1 : MixedGraph
|
i2 : R = gaussianRing G o2 = R o2 : PolynomialRing |
i3 : S = covarianceMatrix(R,G)
o3 = | s_(a,a) s_(a,b) s_(a,c) s_(a,d) |
| s_(a,b) s_(b,b) s_(b,c) s_(b,d) |
| s_(a,c) s_(b,c) s_(c,c) s_(c,d) |
| s_(a,d) s_(b,d) s_(c,d) s_(d,d) |
4 4
o3 : Matrix R <--- R
|
i4 : L = directedEdgesMatrix(R,G)
o4 = | 0 0 0 0 |
| 0 0 l_(b,c) l_(b,d) |
| 0 0 0 l_(c,d) |
| 0 0 0 0 |
4 4
o4 : Matrix R <--- R
|
i5 : W = bidirectedEdgesMatrix(R,G)
o5 = | p_(a,a) 0 0 p_(a,d) |
| 0 p_(b,b) 0 0 |
| 0 0 p_(c,c) 0 |
| p_(a,d) 0 0 p_(d,d) |
4 4
o5 : Matrix R <--- R
|
i6 : M = gaussianParametrization(R,G)
o6 = | p_(a,a) 0
| 0 p_(b,b)
| 0 l_(b,c)p_(b,b)
| p_(a,d) l_(b,c)l_(c,d)p_(b,b)+l_(b,d)p_(b,b)
------------------------------------------------------------------------
0
l_(b,c)p_(b,b)
l_(b,c)^2p_(b,b)+p_(c,c)
l_(b,c)^2l_(c,d)p_(b,b)+l_(b,c)l_(b,d)p_(b,b)+l_(c,d)p_(c,c)
------------------------------------------------------------------------
p_(a,d)
l_(b,c)l_(c,d)p_(b,b)+l_(b,d)p_(b,b)
l_(b,c)^2l_(c,d)p_(b,b)+l_(b,c)l_(b,d)p_(b,b)+l_(c,d)p_(c,c)
l_(b,c)^2l_(c,d)^2p_(b,b)+2l_(b,c)l_(b,d)l_(c,d)p_(b,b)+l_(b,d)^2p_(b,b
------------------------------------------------------------------------
|
|
|
)+l_(c,d)^2p_(c,c)+p_(d,d) |
4 4
o6 : Matrix R <--- R
|
i7 : J = delete(0_R, flatten entries (L|W))
o7 = {p , p , l , l , p , l , p , p , p }
a,a a,d b,c b,d b,b c,d c,c a,d d,d
o7 : List
|
i8 : eliminate(J, ideal(S-M))
o8 = ideal (s , s )
a,c a,b
o8 : Ideal of R
|
i9 : G = mixedGraph(digraph {{b,{c,d}},{c,{d}}},bigraph {{a,d}})
o9 = MixedGraph{Bigraph => Bigraph{a => set {d}} }
d => set {a}
Digraph => Digraph{b => set {c, d}}
c => set {d}
d => set {}
Graph => Graph{}
o9 : MixedGraph
|
i10 : R = gaussianRing G o10 = R o10 : PolynomialRing |
i11 : M = gaussianParametrization(R,G,SimpleTreks=>true)
o11 = | 1 0 0
| 0 1 l_(b,c)
| 0 l_(b,c) 1
| p_(a,d) l_(b,c)l_(c,d)+l_(b,d) l_(b,c)l_(b,d)+l_(c,d)
-----------------------------------------------------------------------
p_(a,d) |
l_(b,c)l_(c,d)+l_(b,d) |
l_(b,c)l_(b,d)+l_(c,d) |
1 |
4 4
o11 : Matrix R <--- R
|