# Model -- A group-based model

## Description

A phylogenetic tree model on tree T has outcomes which 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 mathbbZ/2 or (ℤ/2)2), and the transition probability for pair (g,h) depends only on h-g. This reduces the number of parameters from |G|2 to |G|. Depending on the model, some of the parameters for different group elements are identified to further restrict the model.

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

There are four built in models which are 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{} 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 :

• fourierToProbability(Ring,Ring,ZZ,Model), see fourierToProbability -- Map from Fourier coordinates to probablity coordinates
• leafColorings(LeafTree,Model), see leafColorings -- lists the friendly colorings of a tree
• leafColorings(ZZ,Model), see leafColorings -- lists the friendly colorings of a tree
• phyloToric42(Graph,Model), see phyloToric42 -- Compute the invariants of a group-based phylogenetic tree model using the 4ti2 package.
• phyloToric42(LeafTree,Model), see phyloToric42 -- Compute the invariants of a group-based phylogenetic tree model using the 4ti2 package.
• phyloToric42(ZZ,List,Model), see phyloToric42 -- Compute the invariants of a group-based phylogenetic tree model using the 4ti2 package.
• phyloToricAMatrix(Graph,Model), see phyloToricAMatrix -- Constructs the A matrix whose columns parametrize the toric variety of the tree T with n leaves
• phyloToricAMatrix(LeafTree,Model), see phyloToricAMatrix -- Constructs the A matrix whose columns parametrize the toric variety of the tree T with n leaves
• phyloToricAMatrix(ZZ,List,Model), see phyloToricAMatrix -- Constructs the A matrix whose columns parametrize the toric variety of the tree T with n leaves
• phyloToricFP(LeafTree,Model), see phyloToricFP -- Compute the invariants of a group-based phylogenetic tree model using the toric fiber product structure
• phyloToricFP(ZZ,List,Model), see phyloToricFP -- Compute the invariants of a group-based phylogenetic tree model using the toric fiber product structure
• phyloToricLinears(LeafTree,Model), see phyloToricLinears -- Compute the linear invariants of a group-based phylogenetic tree model
• phyloToricLinears(ZZ,List,Model), see phyloToricLinears -- Compute the linear invariants of a group-based phylogenetic tree model
• phyloToricRandom(LeafTree,Model), see phyloToricRandom -- Compute a random invariant of a group-based phylogenetic tree model using the toric fiber product structure
• phyloToricRandom(ZZ,List,Model), see phyloToricRandom -- Compute a random invariant of a group-based phylogenetic tree model using the toric fiber product structure
• pRing(LeafTree,Model), see pRing -- Constructs the ring of probability coordinates
• pRing(ZZ,Model), see pRing -- Constructs the ring of probability coordinates
• qRing(LeafTree,Model), see qRing -- Constructs the ring of Fourier coordinates
• qRing(ZZ,Model), see qRing -- Constructs the ring of Fourier coordinates

## Fixed objects of class Model :

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

## For the programmer

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