Macaulay2 » Documentation
Packages » GraphicalModelsMLE :: scoreEquations
next | previous | forward | backward | up | index | toc

scoreEquations -- score equations of the log-likelihood function of a Gaussian graphical model

Synopsis

Description

This function computes the score equations that arise from taking partial derivatives of the log-likelihood function of the concentration matrix (the inverse of the covariance matrix) of a Gaussian graphical statistical model and returns the ideal generated by such equations.

The input of this function is a gaussianRing and statistical data. The latter can be given as a matrix or a list of observations. The rows of the matrix or the elements of the list are observation vectors given as lists. It is possible to input the sample covariance matrix directly by using the optional input SampleData.

i1 : G = mixedGraph(digraph {{1,2},{1,3},{2,3},{3,4}},bigraph{{3,4}});
i2 : R = gaussianRing(G);
i3 : U = matrix{{6, 10, 1/3, 1}, {3/5, 3, 1/2, 1}, {4/5, 3/2, 9/8, 3/10}, {10/7, 2/3,1, 8/3}};

              4       4
o3 : Matrix QQ  <-- QQ
i4 : JU=scoreEquations(R,U)

o4 = ideal (192199680p    - 99333449, 267221621760p    - 849243924773,
                      3,4                          4,4                
     ------------------------------------------------------------------------
     1353974896462794079472640p    - 142165262245288892244817, 6898968p    -
                               3,3                                     2,2  
     ------------------------------------------------------------------------
     11533057, 19600p    - 95819, 20855l    + 90447,
                     1,1                3,4         
     ------------------------------------------------------------------------
     146915678869660815915l    - 4228634793402814499,
                           2,3                       
     ------------------------------------------------------------------------
     58766271547864326366l    + 4167005135395196717, 574914l    - 896035)
                          1,3                               1,2

o4 : Ideal of QQ[l   ..l   , l   , l   , p   , p   , p   , p   , p   ]
                  1,2   1,3   2,3   3,4   1,1   2,2   3,3   4,4   3,4
i5 : V = sampleCovarianceMatrix U

o5 = | 95819/19600 25601/3360 -2129/4480 -1313/16800 |
     | 25601/3360  867/64     -2321/2304 -173/192    |
     | -2129/4480  -2321/2304 337/3072   473/11520   |
     | -1313/16800 -173/192   473/11520  3641/4800   |

              4       4
o5 : Matrix QQ  <-- QQ
i6 : JV=scoreEquations(R,V,SampleData=>false)

o6 = ideal (192199680p    - 99333449, 267221621760p    - 849243924773,
                      3,4                          4,4                
     ------------------------------------------------------------------------
     1353974896462794079472640p    - 142165262245288892244817, 6898968p    -
                               3,3                                     2,2  
     ------------------------------------------------------------------------
     11533057, 19600p    - 95819, 20855l    + 90447,
                     1,1                3,4         
     ------------------------------------------------------------------------
     146915678869660815915l    - 4228634793402814499,
                           2,3                       
     ------------------------------------------------------------------------
     58766271547864326366l    + 4167005135395196717, 574914l    - 896035)
                          1,3                               1,2

o6 : Ideal of QQ[l   ..l   , l   , l   , p   , p   , p   , p   , p   ]
                  1,2   1,3   2,3   3,4   1,1   2,2   3,3   4,4   3,4

SaturateOptions allows to use all functionalities of saturate. Saturate determines whether to saturate. Note that the latter will not provide the score equations of the model.

i7 : G = mixedGraph(digraph {{1,2},{1,3},{2,3},{3,4}},bigraph{{3,4}});
i8 : R = gaussianRing(G);
i9 : U = matrix{{6, 10, 1/3, 1}, {3/5, 3, 1/2, 1}, {4/5, 3/2, 9/8, 3/10}, {10/7, 2/3,1, 8/3}};

              4       4
o9 : Matrix QQ  <-- QQ
i10 : J=scoreEquations(R,U,SaturateOptions => {Strategy => Eliminate})

o10 = ideal (192199680p    - 99333449, 267221621760p    - 849243924773,
                       3,4                          4,4                
      -----------------------------------------------------------------------
      1353974896462794079472640p    - 142165262245288892244817, 6898968p    -
                                3,3                                     2,2  
      -----------------------------------------------------------------------
      11533057, 19600p    - 95819, 20855l    + 90447,
                      1,1                3,4         
      -----------------------------------------------------------------------
      146915678869660815915l    - 4228634793402814499,
                            2,3                       
      -----------------------------------------------------------------------
      58766271547864326366l    + 4167005135395196717, 574914l    - 896035)
                           1,3                               1,2

o10 : Ideal of QQ[l   ..l   , l   , l   , p   , p   , p   , p   , p   ]
                   1,2   1,3   2,3   3,4   1,1   2,2   3,3   4,4   3,4
i11 : JnoSat=scoreEquations(R,U,Saturate=>false)

                                                                         
o11 = ideal (- 574914l    + 896035, - 2299656l   p    - 3584140l   p    -
                      1,2                     1,3 4,4           2,3 4,4  
      -----------------------------------------------------------------------
                                                                 
      223545l   p    - 223545p    + 36764p   , - 614424l   p    -
             3,4 3,4          4,4         3,4           1,3 4,4  
      -----------------------------------------------------------------------
                                                                
      1092420l   p    - 81235l   p    - 81235p    + 72660p   , -
              2,3 4,4         3,4 3,4         4,4         3,4   
      -----------------------------------------------------------------------
                                                                   
      35385l   p    - 153288l   p    - 324940l   p    + 13244p    -
            3,4 3,3          1,3 3,4          2,3 3,4         3,3  
      -----------------------------------------------------------------------
                                              2                             
      35385p   , - 19600p    + 95819, 1149828l    - 3584140l    - 235200p   
            3,4          1,1                  1,2           1,2          2,2
      -----------------------------------------------------------------------
                          2   2                       2               2   2  
      + 3186225, 55191744l   p    + 172038720l   l   p    + 152938800l   p   
                          1,3 4,4             1,3 2,3 4,4             2,3 4,4
      -----------------------------------------------------------------------
                                                                      2   2  
      + 10730160l   l   p   p    + 22745800l   l   p   p    + 1238475l   p   
                 1,3 3,4 4,4 3,4            2,3 3,4 4,4 3,4           3,4 3,4
      -----------------------------------------------------------------------
                     2                  2                  2    
      + 10730160l   p    + 22745800l   p    - 11289600p   p    -
                 1,3 4,4            2,3 4,4            3,3 4,4  
      -----------------------------------------------------------------------
                                                                        
      1764672l   p   p    - 20344800l   p   p    + 2476950l   p   p    -
              1,3 4,4 3,4            2,3 4,4 3,4           3,4 4,4 3,4  
      -----------------------------------------------------------------------
                 2                  2             2                     
      927080l   p    + 11289600p   p    + 1238475p    - 927080p   p    +
             3,4 3,4            4,4 3,4           4,4          4,4 3,4  
      -----------------------------------------------------------------------
              2            2   2                               
      8563632p   , 1238475l   p    + 10730160l   l   p   p    +
              3,4          3,4 3,3            1,3 3,4 3,3 3,4  
      -----------------------------------------------------------------------
                                          2   2                       2    
      22745800l   l   p   p    + 55191744l   p    + 172038720l   l   p    +
               2,3 3,4 3,3 3,4            1,3 3,4             1,3 2,3 3,4  
      -----------------------------------------------------------------------
                2   2                2              2        
      152938800l   p    - 927080l   p    - 11289600p   p    -
                2,3 3,4          3,4 3,3            3,3 4,4  
      -----------------------------------------------------------------------
                                                                        
      1764672l   p   p    - 20344800l   p   p    + 2476950l   p   p    +
              1,3 3,3 3,4            2,3 3,3 3,4           3,4 3,3 3,4  
      -----------------------------------------------------------------------
                   2                  2                  2             2    
      10730160l   p    + 22745800l   p    + 11289600p   p    + 8563632p    -
               1,3 3,4            2,3 3,4            3,3 3,4           3,3  
      -----------------------------------------------------------------------
                               2                               
      927080p   p    + 1238475p   , - 5365080l   l   p   p    -
             3,3 3,4           3,4            1,3 3,4 3,3 4,4  
      -----------------------------------------------------------------------
                                         2                      2            
      11372900l   l   p   p    - 1238475l   p   p    - 55191744l   p   p    -
               2,3 3,4 3,3 4,4           3,4 3,3 3,4            1,3 4,4 3,4  
      -----------------------------------------------------------------------
                                            2                             2  
      172038720l   l   p   p    - 152938800l   p   p    - 5365080l   l   p   
                1,3 2,3 4,4 3,4             2,3 4,4 3,4           1,3 3,4 3,4
      -----------------------------------------------------------------------
                         2                                                
      - 11372900l   l   p    + 882336l   p   p    + 10172400l   p   p    -
                 2,3 3,4 3,4          1,3 3,3 4,4            2,3 3,3 4,4  
      -----------------------------------------------------------------------
                                                                       
      1238475l   p   p    + 927080l   p   p    - 10730160l   p   p    -
              3,4 3,3 4,4          3,4 3,3 3,4            1,3 4,4 3,4  
      -----------------------------------------------------------------------
                                                               2    
      22745800l   p   p    + 11289600p   p   p    + 882336l   p    +
               2,3 4,4 3,4            3,3 4,4 3,4          1,3 3,4  
      -----------------------------------------------------------------------
                   2                 2              3                     
      10172400l   p    - 1238475l   p    - 11289600p    + 463540p   p    -
               2,3 3,4           3,4 3,4            3,4          3,3 4,4  
      -----------------------------------------------------------------------
                                                 2
      8563632p   p    - 1238475p   p    + 463540p   )
              3,3 3,4           4,4 3,4          3,4

o11 : Ideal of QQ[l   ..l   , l   , l   , p   , p   , p   , p   , p   ]
                   1,2   1,3   2,3   3,4   1,1   2,2   3,3   4,4   3,4

The ML-degree of the model is the degree of the score equations ideal. The ML-degree of the running example is 1:

i12 : G = mixedGraph(digraph {{1,2},{1,3},{2,3},{3,4}},bigraph{{3,4}});
i13 : R = gaussianRing(G);
i14 : U = matrix{{6, 10, 1/3, 1}, {3/5, 3, 1/2, 1}, {4/5, 3/2, 9/8, 3/10}, {10/7, 2/3,1, 8/3}};

               4       4
o14 : Matrix QQ  <-- QQ
i15 : J = scoreEquations(R,U)

o15 = ideal (192199680p    - 99333449, 267221621760p    - 849243924773,
                       3,4                          4,4                
      -----------------------------------------------------------------------
      1353974896462794079472640p    - 142165262245288892244817, 6898968p    -
                                3,3                                     2,2  
      -----------------------------------------------------------------------
      11533057, 19600p    - 95819, 20855l    + 90447,
                      1,1                3,4         
      -----------------------------------------------------------------------
      146915678869660815915l    - 4228634793402814499,
                            2,3                       
      -----------------------------------------------------------------------
      58766271547864326366l    + 4167005135395196717, 574914l    - 896035)
                           1,3                               1,2

o15 : Ideal of QQ[l   ..l   , l   , l   , p   , p   , p   , p   , p   ]
                   1,2   1,3   2,3   3,4   1,1   2,2   3,3   4,4   3,4
i16 : dim J, degree J

o16 = (0, 1)

o16 : Sequence

Ways to use scoreEquations :

For the programmer

The object scoreEquations is a method function with options.