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

markovRing -- ring of joint probability distributions on several discrete random variables



The sequence $d$ represents the number of states of each discrete random variable. This example creates a ring of joint probability distributions on 4 random variables with 2, 3, 4, and 5 states. This ring has a total of 120 indeterminates.

i1 : d=(2,3,4,5);
i2 : R = markovRing d;
i3 : numgens R

o3 = 120
i4 : R_0, R_1, R_119 --here are some of the variables in the ring

o4 = (p       , p       , p       )
       1,1,1,1   1,1,1,2   2,3,4,5

o4 : Sequence

If no coefficient choice is specified, the polynomial ring is created over the rationals.

i5 : coefficientRing R

o5 = QQ

o5 : Ring

The optional argument Coefficients allows to change the base field.

i6 : R2 = markovRing (d,Coefficients=>CC);
i7 : coefficientRing R2

o7 = CC

o7 : ComplexField

The indeterminates are labeled with the letter ''p'' suggesting probability distributions. However, it is useful to be able to create a new ring where the indeterminates are labeled different (for example, they may represent marginal probabilities). This can be accomplished with the VariableName option.

i8 : d=(1,2);
i9 : markovRing (d,VariableName => q);
i10 : gens oo

o10 = {q   , q   }
        1,1   1,2

o10 : List

The routines hiddenMap, inverseMarginMap, marginMap, markovMatrices require the ring to be created by this function. The routines conditionalIndependenceIdeal, discreteVanishingIdeal require the ring to be created by this function or the method gaussianRing.


As opposed to gaussianRing, this method does not store information about a graph or the names of the random variables. In case these random variables are not numbered $1, 2, \dots, n$, then the methods conditionalIndependenceIdeal and markovMatrices require an additional input in the form of a list of the random variable names. This list must be in the same order as the implicit order used in the sequence $d$. The user is encouraged to read the caveat on the method conditionalIndependenceIdeal regarding probability distributions on discrete random variables that have been labeled arbitrarily.

See also

Ways to use markovRing :

For the programmer

The object markovRing is a method function with a single argument.