next | previous | forward | backward | up | top | index | toc | Macaulay2 website
GraphicalModelsMLE :: GraphicalModelsMLE

GraphicalModelsMLE -- a package for MLE of parameters for Gaussian graphical models

Description

Graphical Models MLE is a package for algebraic statistics that broadens the functionalities of GraphicalModels. It computes the maximum likelihood estimates (MLE) of the covariance matrix of Gaussian graphical models associated to loopless mixed graphs(LMG).

The main features of the package are the computation of the sampleCovarianceMatrix of sample data, the ideal generated by scoreEquations of log-likelihood functions of Gaussian graphical model, the MLdegree of such models and the MLE for the covariance or concentration matrix via solverMLE.

For more details on the type of graphical models that are accepted see gaussianRing. In particular, for further information about LMG with undirected, directed and bidirected edges, check partitionLMG.

References:

An introduction to key notions such as MLE and ML-degree can be found in the books:

Seth Sullivant, Algebraic statistics, American Mathematical Society, Vol 194, 2018.

Mathias Drton, Bernd Sturmfels and Seth Sullivant, Lectures on Algebraic Statistics, Oberwolfach Seminars, Vol 40, Birkhauser, Basel, 2009.

The definition and classification of loopless mixed graphs (LMG) can be found in the paper:

Kayvan Sadeghi and Steffen Lauritzen, Markov properties for mixed graphs, Bernoulli, 20 (2014), no 2, 676-696.

Examples:

Computation of a sample covariance matrix from sample data:

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

              4        4
o1 : Matrix ZZ  <--- ZZ
i2 : sampleCovarianceMatrix(U)

o2 = | 115/16 -13/8 -29/16 47/8  |
     | -13/8  5/4   7/8    -11/4 |
     | -29/16 7/8   27/16  -21/8 |
     | 47/8   -11/4 -21/8  29/4  |

              4        4
o2 : Matrix QQ  <--- QQ

The ideal generated by the score equations of the log-likelihood function of the graphical model associated to the graph $1\rightarrow 2,1\rightarrow 3,2\rightarrow 3,3\rightarrow 4,3<-> 4$ is computed as follows:

i3 : G = mixedGraph(digraph {{1,2},{1,3},{2,3},{3,4}},bigraph{{3,4}});
i4 : R = gaussianRing(G);
i5 : 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
o5 : Matrix QQ  <--- QQ
i6 : scoreEquations(R,U)

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

Computation of the ML-degree of the 4-cycle:

i7 : G=graph{{1,2},{2,3},{3,4},{4,1}};
i8 : MLdegree(gaussianRing G)

o8 = 5

Next compute the MLE for the covariance matrix of the graphical model associated to the graph $1\rightarrow 3,2\rightarrow 4,3<-> 4,1 - 2$. The input is the sample covariance instead of the sample data.

i9 : G = mixedGraph(digraph {{1,3},{2,4}},bigraph {{3,4}},graph {{1,2}});
i10 : V =  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
o10 : Matrix QQ  <--- QQ
i11 : solverMLE(G,V,SampleData=>false)

o11 = (-.655574, {| .35       .26       -.0548792 -.19146  |}, 2)
                  | .26       .73       -.0291359 -.101648 |
                  | -.0548792 -.0291359 .4        .06      |
                  | -.19146   -.101648  .06       .59      |

o11 : Sequence

As an application of solverMLE: positive definite matrix completion

Consider the following symmetric matrix with some unknown entries:

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

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

              4       4
o13 : Matrix R  <--- R

Unknown entries correspond to the 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. Check solverMLE for more details.

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

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

o16 = (-15.8404, | 115      -13       .645756  -.129151  |, 1)
                 | -13      5         .0922509 -.0184502 |
                 | .645756  .0922509  27       -21       |
                 | -.129151 -.0184502 -21      29        |

o16 : Sequence

Caveat

GraphicalModelsMLE requires Graphs, StatGraphs and GraphicalModels. In order to use the default numerical solver, it also requires EigenSolver.

Graphs allows the user to create graphs whose vertices are labeled arbitrarily. However, several functions in GraphicalModels sort the vertices of the graph. Hence, graphs used as input to methods in GraphicalModelsMLE must have sortable vertex labels, e.g., all numbers or all letters.

StatGraphs allows the user to work with objects such as bigraphs and mixedGraphs.

GraphicalModels is used to generate gaussianRing, i.e. rings encoding graph properties.

Authors

Version

This documentation describes version 0.3 of GraphicalModelsMLE.

Source code

The source code from which this documentation is derived is in the file GraphicalModelsMLE.m2.

Exports

  • Functions and commands
    • checkPD -- returns positive definite matrices from a list of matrices
    • checkPSD -- returns positive semidefinite matrices from a list of matrices
    • jacobianMatrixOfRationalFunction -- Jacobian matrix of a rational function
    • MLdegree -- ML-degree of a graphical model
    • sampleCovarianceMatrix -- sample covariance matrix of observation vectors
    • scoreEquations -- score equations of the log-likelihood function of a Gaussian graphical model
    • solverMLE -- Maximum likelihood estimate of a loopless mixed graph
  • Methods
    • "checkPD(List)" -- see checkPD -- returns positive definite matrices from a list of matrices
    • "checkPD(Matrix)" -- see checkPD -- returns positive definite matrices from a list of matrices
    • "checkPSD(List)" -- see checkPSD -- returns positive semidefinite matrices from a list of matrices
    • "checkPSD(Matrix)" -- see checkPSD -- returns positive semidefinite matrices from a list of matrices
    • "jacobianMatrixOfRationalFunction(RingElement)" -- see jacobianMatrixOfRationalFunction -- Jacobian matrix of a rational function
    • "MLdegree(Ring)" -- see MLdegree -- ML-degree of a graphical model
    • "sampleCovarianceMatrix(List)" -- see sampleCovarianceMatrix -- sample covariance matrix of observation vectors
    • "sampleCovarianceMatrix(Matrix)" -- see sampleCovarianceMatrix -- sample covariance matrix of observation vectors
    • "scoreEquations(List,Ring)" -- see scoreEquations -- score equations of the log-likelihood function of a Gaussian graphical model
    • "scoreEquations(Matrix,Ring)" -- see scoreEquations -- score equations of the log-likelihood function of a Gaussian graphical model
    • "scoreEquations(Ring,List)" -- see scoreEquations -- score equations of the log-likelihood function of a Gaussian graphical model
    • "scoreEquations(Ring,Matrix)" -- see scoreEquations -- score equations of the log-likelihood function of a Gaussian graphical model
    • "solverMLE(Bigraph,Digraph,Graph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Digraph,Graph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Digraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Digraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Graph,Digraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Graph,Digraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Graph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Graph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Bigraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Bigraph,Graph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Bigraph,Graph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Bigraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Bigraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Graph,Bigraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Graph,Bigraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Graph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Graph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Digraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Bigraph,Digraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Bigraph,Digraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Bigraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Bigraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Digraph,Bigraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Digraph,Bigraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Digraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Digraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Graph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Bigraph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Bigraph,Digraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Bigraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Bigraph,Graph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Digraph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Digraph,Bigraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Digraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Digraph,Graph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Graph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Graph,Bigraph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Graph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,Graph,Digraph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(List,MixedGraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Bigraph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Bigraph,Digraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Bigraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Bigraph,Graph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Digraph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Digraph,Bigraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Digraph,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Digraph,Graph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Graph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Graph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Graph,Bigraph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Graph,Digraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,Graph,Digraph,Bigraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(Matrix,MixedGraph)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(MixedGraph,List)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
    • "solverMLE(MixedGraph,Matrix)" -- see solverMLE -- Maximum likelihood estimate of a loopless mixed graph
  • Symbols
    • ChooseSolver -- optional input to choose numerical solver
    • ConcentrationMatrix -- optional input to output MLE for concentration matrix instead of MLE for covariance matrix
    • CovarianceMatrix -- optional input to output covariance matrix
    • DoSaturate -- optional input to remove saturation
    • OptionsEigenSolver -- optional input to use options of "zeroDimSolve" in "EigenSolver"
    • OptionsNAG4M2 -- optional parameter to set the parameters of solveSystem in NumericalAlgebraicGeometry
    • RealPrecision -- optional input to choose the number of decimals used to round to QQ when inputing data in RR
    • SampleData -- optional input to allow to input the sample covariance matrix instead of sample data
    • SaturateOptions -- optional input to use options "saturate"
    • ZeroTolerance -- optional input to set the largest absolute value that should be treated as zero

For the programmer

The object GraphicalModelsMLE is a package.