A few notes on the short Macaulay2 demo session


Purpose of these notes:

  • Expand on the code slide in lecture 5.

  • Please feel free to write code in R that does the same thing as the conditionalIndependenceIdeal command in M2.

Discussion of m2 code snippet

Go to M2 in the cloud, Start Macaulay2, and type the following two commands:

loadPackage "GraphicalModels"
R=gaussianRing 4;

The second command tells M2 that there are 4 random variables and each is \(N(\mu,\sigma)\) (contrast to the lecture before this one, where we used markovRing which meant the random variables were discrete).

Next, verify the example we did in class by defining the 2 statements:

twoStatements = {{{1},{3},{2}}, {{1},{3},{}}} 

This is a list of lists, because in M2 every list is denoted using {}. Each CI statement is itself a list of lists: {{1},{3},{2}} means that 1 is conditionally independent of 3 given 2.

Compute the (generators/basis of) the ideal of conditional independence corresponding to these two statements as follows:

I = conditionalIndependenceIdeal (R,twoStatements) 

As we worked through slide #6 in Lecture#5, we wrote the following decomposition of the model into a union of two linear spaces:

primaryDecomposition I

Remember, computers operate on ideals of polynomials to describe the decompositinon of the corresponding variety into a union of irreducibles. You can read more about ideals and varieties in the “Algebra Primer” chapter of the textbook.

Now, here is a slightly different example from page 18 of this tutorial:

twoStatements = {{{1},{2},{3}}, {{1},{3},{}}} 
I = conditionalIndependenceIdeal (R,twoStatements) 
primaryDecomposition I

What do you see?

* Does the second compoment in the output ensure that the covariance matrix is positive definite? 
* What is the CI statement corresponding to the first component? 

License

This document was created for Math 561, Spring 2023, at Illinois Tech. This set of notes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License


  1. Sonja Petrović, Associate Professor of Applied Mathematics, College of Computing, Illinios Tech. Homepage, Email.↩︎