next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
GraphicalModels :: covarianceMatrix

covarianceMatrix -- the covariance matrix of a gaussian graphical model

Synopsis

Description

If this function is called without a graph G, it is assumed that R is the gauss ring of a directed acyclic graph.
i1 : G = digraph {{a,{b,c}}, {b,{c,d}}, {c,{}}, {d,{}}}

o1 = Digraph{a => set {b, c}}
             b => set {c, d}
             c => set {}
             d => set {}

o1 : Digraph
i2 : R = gaussianRing G

o2 = R

o2 : PolynomialRing
i3 : S = covarianceMatrix R

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
Note that the covariance matrix is symmetric in the symbols.
i4 : G = mixedGraph(digraph {{b,{c,d}},{c,{d}}},bigraph {{a,d}})

o4 = MixedGraph{Bigraph => Bigraph{a => set {d}}   }
                                   d => set {a}
                Digraph => Digraph{b => set {c, d}}
                                   c => set {d}
                                   d => set {}
                Graph => Graph{}

o4 : MixedGraph
i5 : R = gaussianRing G

o5 = R

o5 : PolynomialRing
i6 : S = covarianceMatrix(R,G)

o6 = | 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
o6 : Matrix R  <--- R

See also

Ways to use covarianceMatrix :