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

solverMLE -- Maximum likelihood estimate of a loopless mixed graph

Synopsis

Description

This function takes as input a graph, or a digraph, or a bigraph or a mixed graph and a list or matrix that encodes, by default, the sample data. It computes the critical points of the score equations and selects the maximum value achieved among those that lie in the cone of positive-definite matrices. The default output is the maximum value in the log-likelihood function, maximum likelihood estimators (MLE) for the covariance matrix and the ML-degree of the model. MLE for the concentration matrix can be obtained by setting the optional input ConcentrationMatrix to false.

The same optional inputs as in scoreEquations can be used, plus extra optional inputs related to the numerical solver (EigenSolver by default, NAG4M2 alternatively) and its functionalities.

Below we reproduce Example 2.1.13 for the 4-cycle in the book: Mathias Drton, Bernd Sturmfels and Seth Sullivant, Lectures on Algebraic Statistics, Oberwolfach Seminars, Vol 40, Birkhauser, Basel, 2009.

i1 : G=graph{{1,2},{2,3},{3,4},{1,4}};
i2 : U =matrix{{1,2,1,-1},{2,1,3,0},{-1, 0, 1, 1},{-5, 3, 4, -6}};

              4       4
o2 : Matrix ZZ  <-- ZZ
i3 : solverMLE(G,U)

o3 = (-6.2615, | 7.1875   -1.625   -2.22576 5.875    |, 5)
               | -1.625   1.25     .875     -1.62833 |
               | -2.22576 .875     1.6875   -2.625   |
               | 5.875    -1.62833 -2.625   7.25     |

o3 : Sequence

The data sample can also be given as a list:

i4 : G=graph{{1,2},{2,3},{3,4},{1,4}};
i5 : U = {{1,2,1,-1},{2,1,3,0},{-1, 0, 1, 1},{-5, 3, 4, -6}};
i6 : solverMLE(G,U)

o6 = (-6.2615, | 7.1875   -1.625   -2.22576 5.875    |, 5)
               | -1.625   1.25     .875     -1.62833 |
               | -2.22576 .875     1.6875   -2.625   |
               | 5.875    -1.62833 -2.625   7.25     |

o6 : Sequence

In the following example we compute the MLE for the covariance matrix of the graphical model associated to the graph $1\rightarrow 2,1\rightarrow 3,2\rightarrow 3,3\rightarrow 4,3<-> 4$ In this case we give as input the sample covariance matrix:

i7 : G = mixedGraph(digraph {{1,3},{2,4}},bigraph {{3,4}});
i8 : S =  matrix {{7/20, 13/50, -3/50, -19/100}, {13/50, 73/100, -7/100, -9/100},{-3/50, -7/100, 2/5, 3/50}, {-19/100, -9/100, 3/50, 59/100}};

              4       4
o8 : Matrix QQ  <-- QQ
i9 : solverMLE(G,S,SampleData=>false)

o9 = (-.665426, | .35       .26      -.0362724 -.19     |, 5)
                | .26       .73      -.07      -.145523 |
                | -.0362724 -.07     .4        .06      |
                | -.19      -.145523 .06       .59      |

o9 : Sequence

Next we provide the MLE for the concentration matrix of the graphical model associated to the graph $1\rightarrow 3,2\rightarrow 4,3<->4,1 - 2$. Again the sample covariance matrix is given as input.

i10 : G = mixedGraph(digraph {{1,3},{2,4}},bigraph {{3,4}},graph {{1,2}});
i11 : S =  matrix {{7/20, 13/50, -3/50, -19/100}, {13/50, 73/100, -7/100, -9/100},{-3/50, -7/100, 2/5, 3/50}, {-19/100, -9/100, 3/50, 59/100}};

               4       4
o11 : Matrix QQ  <-- QQ
i12 : solverMLE(G,S,SampleData=>false,ConcentrationMatrix=>true)

o12 = (-.665426, | 4.47695  -1.37472 0        1.10266  |, 5)
                 | -1.37472 1.87907  .204176  0        |
                 | 0        .204176  2.56734  -.210726 |
                 | 1.10266  0        -.210726 2.07144  |

o12 : Sequence

Application to positive definite matrix completion problems

Consider the following symmetric matrix with some unknown entries:

i13 : R=QQ[x,y];
i14 : M=matrix{{115,-13,x,47},{-13,5,7,y},{x,7,27,-21},{47,y,-21,29}}

o14 = | 115 -13 x   47  |
      | -13 5   7   y   |
      | x   7   27  -21 |
      | 47  y   -21 29  |

              4      4
o14 : Matrix R  <-- R

Unknown entries correspond to non-edges of the 4-cycle. A positive definite completion of this matrix is obtained by giving values to x and y and computing the MLE for the covariance matrix in the Gaussian graphical model given by the 4-cycle. To understand which values of x and y will result in a maximum likelihood estimate, see Example 12.16 in the book: Mateusz Michalek and Bernd Sturmfels, Invitation to Nonlinear Algebra, Graduate Studies in Mathematics, Vol ???, American Mathematical Society, 2021.

i15 : G=graph{{1,2},{2,3},{3,4},{1,4}};
i16 : V=matrix{{115,-13,-29,47},{-13,5,7,-11},{-29,7,27,-21},{47,-11,-21,29}}

o16 = | 115 -13 -29 47  |
      | -13 5   7   -11 |
      | -29 7   27  -21 |
      | 47  -11 -21 29  |

               4       4
o16 : Matrix ZZ  <-- ZZ
i17 : (mx,MLE,ML)=solverMLE(G,V,SampleData=>false)

o17 = (-14.5793, | 115      -13      -35.6122 47       |, 5)
                 | -13      5        7        -6.51331 |
                 | -35.6122 7        27       -21      |
                 | 47       -6.51331 -21      29       |

o17 : Sequence

The MLE of the covariance matrix is the unique positive definite completion of the matrix M such that its inverse, namely the concentration matrix, has zero's in the entries corresponding to non-edges of the graph. Observe that all entries of V remain the same in the MLE except for those that correspond to non-edges of the graph.

See also

Ways to use solverMLE:

For the programmer

The object solverMLE is a method function with options.