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

gaussianRing -- ring of Gaussian correlations on n random variables

Synopsis

Description

This function creates a ring whose indeterminates are the covariances of an n dimensional Gaussian random vector. Using a graph, digraph, or mixed graph G as input gives a gaussianRing with extra indeterminates related to the parametrization of the graphical model associated to that graph. If a graph is used, the indeterminates in the gaussianRing are indexed by the vertices in the graph G.

The s(i,j) indeterminates in the gaussianRing are the entries in the covariance matrix of the jointly normal random variables. The k(i,j) indeterminates in the gaussianRing are the nonzero entries in the concentration matrix in the graphical model associatd to an undirected graph. The l(i,j) indeterminates consist of regression coefficients associated to the directed edges in the graph. The p(i,j) indeterminates in the gaussianRing are the nonzero entries in the covariance matrix of the error terms in the graphical model associatd to a mixed graph with bidirected edges. Those entries can be placed into an appropriate matrix format using the functions covarianceMatrix, undirectedEdgesMatrix, directedEdgesMatrix, and bidirectedEdgesMatrix respectively.

i1 : R = gaussianRing 5;
i2 : gens R

o2 = {s   , s   , s   , s   , s   , s   , s   , s   , s   , s   , s   , s   ,
       1,1   1,2   1,3   1,4   1,5   2,2   2,3   2,4   2,5   3,3   3,4   3,5 
     ------------------------------------------------------------------------
     s   , s   , s   }
      4,4   4,5   5,5

o2 : List
i3 : compactMatrixForm =false;
i4 : covarianceMatrix R

o4 = | s     s     s     s     s    |
     |  1,1   1,2   1,3   1,4   1,5 |
     |                              |
     | s     s     s     s     s    |
     |  1,2   2,2   2,3   2,4   2,5 |
     |                              |
     | s     s     s     s     s    |
     |  1,3   2,3   3,3   3,4   3,5 |
     |                              |
     | s     s     s     s     s    |
     |  1,4   2,4   3,4   4,4   4,5 |
     |                              |
     | s     s     s     s     s    |
     |  1,5   2,5   3,5   4,5   5,5 |

             5       5
o4 : Matrix R  <--- R

The function works with an undirected graph as follows.

i5 : G = graph({{a,b},{b,c},{c,d},{a,d}})

o5 = Graph{a => {b, d}}
           b => {a, c}
           c => {b, d}
           d => {a, c}

o5 : Graph
i6 : R = gaussianRing G

o6 = R

o6 : PolynomialRing
i7 : gens R

o7 = {k   , k   , k   , k   , k   , k   , k   , k   , s   , s   , s   , s   ,
       a,a   b,b   c,c   d,d   a,b   a,d   b,c   c,d   a,a   a,b   a,c   a,d 
     ------------------------------------------------------------------------
     s   , s   , s   , s   , s   , s   }
      b,b   b,c   b,d   c,c   c,d   d,d

o7 : List
i8 : covarianceMatrix R

o8 = | s     s     s     s    |
     |  a,a   a,b   a,c   a,d |
     |                        |
     | s     s     s     s    |
     |  a,b   b,b   b,c   b,d |
     |                        |
     | s     s     s     s    |
     |  a,c   b,c   c,c   c,d |
     |                        |
     | s     s     s     s    |
     |  a,d   b,d   c,d   d,d |

             4       4
o8 : Matrix R  <--- R
i9 : undirectedEdgesMatrix R

o9 = | k     k       0   k    |
     |  a,a   a,b         a,d |
     |                        |
     | k     k     k       0  |
     |  a,b   b,b   b,c       |
     |                        |
     |   0   k     k     k    |
     |        b,c   c,c   c,d |
     |                        |
     | k       0   k     k    |
     |  a,d         c,d   d,d |

             4       4
o9 : Matrix R  <--- R

The function works with a directed graph as follows.

i10 : G = digraph {{a,{b,c}}, {b,{c,d}}, {c,{}}, {d,{}}};
i11 : R = gaussianRing G;

This function also accepts as input a mixed graph. In this case, the ring contains the usual indeterminates associated to the covariance matrix of the model. But it is also generated by two new lists of indeterminates. For each directed edge i →j in the mixed graph there is an indeterminate, denoted by default l(i,j), corresponding to the associated direct causal effect parameter in the model. For each bidirected edge i<->j there is an indeterminate, denoted by default p(i,j), corresponding to the associated noise parameter. Finally, for each node i, there is an indeterminate p(i,i). The gaussianRing of a mixed graph assumes that the undirected part of the graph is empty.

i12 : G = mixedGraph(digraph {{b,{c,d}},{c,{d}}},bigraph {{a,d}})

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

o12 : MixedGraph
i13 : R = gaussianRing G

o13 = R

o13 : PolynomialRing
i14 : gens R

o14 = {l   , l   , l   , p   , p   , p   , p   , p   , s   , s   , s   ,
        b,c   b,d   c,d   a,a   b,b   c,c   d,d   a,d   a,a   a,b   a,c 
      -----------------------------------------------------------------------
      s   , s   , s   , s   , s   , s   , s   }
       a,d   b,b   b,c   b,d   c,c   c,d   d,d

o14 : List
i15 : covarianceMatrix R

o15 = | s     s     s     s    |
      |  a,a   a,b   a,c   a,d |
      |                        |
      | s     s     s     s    |
      |  a,b   b,b   b,c   b,d |
      |                        |
      | s     s     s     s    |
      |  a,c   b,c   c,c   c,d |
      |                        |
      | s     s     s     s    |
      |  a,d   b,d   c,d   d,d |

              4       4
o15 : Matrix R  <--- R
i16 : directedEdgesMatrix R

o16 = | 0  0    0     0  |
      |                  |
      | 0  0  l     l    |
      |        b,c   b,d |
      |                  |
      | 0  0    0   l    |
      |              c,d |
      |                  |
      | 0  0    0     0  |

              4       4
o16 : Matrix R  <--- R
i17 : bidirectedEdgesMatrix R

o17 = | p       0     0   p    |
      |  a,a               a,d |
      |                        |
      |   0   p       0     0  |
      |        b,b             |
      |                        |
      |   0     0   p       0  |
      |              c,c       |
      |                        |
      | p       0     0   p    |
      |  a,d               d,d |

              4       4
o17 : Matrix R  <--- R

The variable names that appear can be changed using the options sVariableName, lVariableName, pVariableName, and kVariableName

i18 : G = mixedGraph(digraph {{b,{c,d}},{c,{d}}},bigraph {{a,d}})

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

o18 : MixedGraph
i19 : R = gaussianRing (G,pVariableName => psi)

o19 = R

o19 : PolynomialRing
i20 : gens R

o20 = {l   , l   , l   , psi   , psi   , psi   , psi   , psi   , s   , s   ,
        b,c   b,d   c,d     a,a     b,b     c,c     d,d     a,d   a,a   a,b 
      -----------------------------------------------------------------------
      s   , s   , s   , s   , s   , s   , s   , s   }
       a,c   a,d   b,b   b,c   b,d   c,c   c,d   d,d

o20 : List

The routines conditionalIndependenceIdeal, trekIdeal, covarianceMatrix, undirectedEdgesMatrix, directedEdgesMatrix, bidirectedEdgesMatrix, gaussianVanishingIdeal and gaussianParametrization require that the ring be created by this function.

See also

Ways to use gaussianRing :