# Model -- a group-based model

## Description

A phylogenetic tree model on tree $T$ has outcomes that are described by assigning each leaf of the tree any label from a particular set (typically the label set is the set of DNA bases, \{A,T,C,G\}). The probability of a certain assignment of labels depends on transition probabilities between each ordered pair of labels. These transition probabilities are the parameters of the model.

In a group based model, the label set is a group $G$ (typically $\mathbb{Z}/2$ or $(\mathbb{Z}/2)^2$), and the transition probability for a pair $(g,h)$ depends only on $h-g$. This reduces the number of parameters from $|G|^2$ to $|G|$. Depending on the model, further identifications of parameters are imposed.

An object of class Model stores the information about a group-based model required to compute phylogenetic invariants. This information includes the elements of the group, how those elements are partitioned, and a set of automorphisms of the group that preserve the partitions.

There are four built-in models: Cavender-Farris-Neyman or binary model (CFNmodel); Jukes-Cantor model (JCmodel); Kimura 2-parameter model (K2Pmodel); and Kimura 3-parameter model (K3Pmodel). Other models can be constructed with model.

 i1 : M = CFNmodel o1 = Model{AList => HashTable{0 => {1, 0}}} 1 => {0, 1} Automorphisms => HashTable{} Buckets => {{0}, {1}} Group => {0, 1} o1 : Model i2 : T = leafTree(3,{}) o2 = {{0, 1, 2}, {set {0}, set {1}, set {2}}} o2 : LeafTree i3 : phyloToricAMatrix(T,M) o3 = | 1 1 0 0 | | 0 0 1 1 | | 1 0 1 0 | | 0 1 0 1 | | 1 0 0 1 | | 0 1 1 0 | 6 4 o3 : Matrix ZZ <--- ZZ

• model -- construct a Model

## Methods that use an object of class Model :

• "buckets(Model)" -- see buckets -- the equivalence classes of group elements of a Model
• "fourierToProbability(Ring,Ring,ZZ,Model)" -- see fourierToProbability -- map from Fourier coordinates to probablity coordinates
• "group(Model)" -- see group -- the group of a Model
• "leafColorings(LeafTree,Model)" -- see leafColorings -- list the consistent colorings of a tree
• "leafColorings(ZZ,Model)" -- see leafColorings -- list the consistent colorings of a tree
• "phyloToric42(Graph,Model)" -- see phyloToric42 -- compute the invariants of a group-based phylogenetic model with 4ti2
• "phyloToric42(LeafTree,Model)" -- see phyloToric42 -- compute the invariants of a group-based phylogenetic model with 4ti2
• "phyloToric42(ZZ,List,Model)" -- see phyloToric42 -- compute the invariants of a group-based phylogenetic model with 4ti2
• "phyloToricAMatrix(Graph,Model)" -- see phyloToricAMatrix -- construct the design matrix of a group-based phylogenetic model
• "phyloToricAMatrix(LeafTree,Model)" -- see phyloToricAMatrix -- construct the design matrix of a group-based phylogenetic model
• "phyloToricAMatrix(ZZ,List,Model)" -- see phyloToricAMatrix -- construct the design matrix of a group-based phylogenetic model
• "phyloToricFP(LeafTree,Model)" -- see phyloToricFP -- compute the invariants of a group-based phylogenetic model with toric fiber products
• "phyloToricFP(ZZ,List,Model)" -- see phyloToricFP -- compute the invariants of a group-based phylogenetic model with toric fiber products
• "phyloToricLinears(LeafTree,Model)" -- see phyloToricLinears -- compute the linear invariants of a group-based phylogenetic model
• "phyloToricLinears(ZZ,List,Model)" -- see phyloToricLinears -- compute the linear invariants of a group-based phylogenetic model
• "phyloToricRandom(LeafTree,Model)" -- see phyloToricRandom -- compute a random invariant of a group-based phylogenetic model
• "phyloToricRandom(ZZ,List,Model)" -- see phyloToricRandom -- compute a random invariant of a group-based phylogenetic model
• "pRing(LeafTree,Model)" -- see pRing -- construct the ring of probability coordinates
• "pRing(ZZ,Model)" -- see pRing -- construct the ring of probability coordinates
• "qRing(LeafTree,Model)" -- see qRing -- construct the ring of Fourier coordinates
• "qRing(ZZ,Model)" -- see qRing -- construct the ring of Fourier coordinates

## Fixed objects of class Model :

• CFNmodel -- the model corresponding to the Cavender-Farris-Neyman model or binary Jukes Cantor
• JCmodel -- the model corresponding to the Jukes Cantor model
• K2Pmodel -- the model corresponding to the Kimura 2-parameter model
• K3Pmodel -- the model corresponding to the Kimura 3-parameter model

## For the programmer

The object Model is a type, with ancestor classes HashTable < Thing.