text: user6205: Could someone direct me to a resource (textbook chapter, lecture notes, online video, etc.) that demonstrates, in a mathematically or computationally rigorous way, how to use maximum likelihood estimation to generate a phylogenetic tree, given a set of aligned sequences?
  I've found several resources which describe the procedure for maximum likelihood estimation, such as:
  
  giving the formula and the parameters that need to be determined (which I already know);
  how to use it for aligned sequences (I already know this),
  I am seeking a worked-out example.
  
  Alternatively, if someone is willing to work out a small example, how would you use maximum likelihood estimation to generate a tree for the following three sequences?
  organism_1 ATCG
  organism_2 ATCC
  organism_3 ATTT
  
  
  user3848: @DataScienceNovice ... here's a rough explanation. Just to note a tree with three taxa doesn't really work as a tree - you need 4 taxa.
  
  If we have tree 1 ((A,B),(C,D)) the probability of the tree is expressed as the summed log likelihood for each position 1, 2, 3 .... in the alignment. The probability is derived from a mutation matrix, thus certain mutations e.g. transitions A<->G; C<->T are more probable (high likelihood), e.g. transversions A<->C; A<->T; G<->C; G<->T are less probable in accordance with the matrix. This hypothetical matrix (most matrices) is scoring transitions as much more probable than transversions.
  
  The 'total probability' expressed  log likelihood for each column, i.e. each alignment position is added together leveraging an interesting property of logs (see final sentence of this paragraph). That becomes the 'score' or 'likelihood' for that tree. Note in the example you provided you have 4 alignment positions, so 4 probabilities of the log-likelihood will be added. Note, the probabilities are actually multiplied but log-likelihoods added is the same thing.
  
  We will now rearrange the tree lets try tree 2 ((C,D),(B,G)), again the hypothetical matrix scores transition/transversions, thus essentially if this tree has higher transitions than the tree in point 1. that will provide a higher likelihood. The tree that maximises the transitions as sister groups will maximise the likelihood. Equally maximising transversions as the most divergent groups will maximise the likelihood of that tree.
  
  Re-arrange the tree again tree 3 ... ((C,B),(D,A)) ... which tree has the highest transitions vs transversions? ...
  
  In this example Tree 2 has the highest likelihood. Thus that is the maximum likelihood. Simple?
  
  
  In the example you have the outcome will depend on the matrix. Alignment position 3 comprises a transition, whilst position 4 comprises a transition and a transversion. Generally transversions are 1:2 to 1:4 less likely even though there are twice as many. So the example you gave the 'tree' (you can't really have a tree with 3 taxa) would be ((organism2,organism3),organism1). This is against the total number of mutations because organism2 and organism3 has two mutations whilst organism2 and organism1 only have one, but the mutation types are different (also see point 3 below). In other words the occurrence of a transversion between organism1 against organism2,organism3, mean organism2 and organism3 are more likely sister groups even though they comprise 2 mutations (transitions) against the single mutation between organism1 and organism2.
  A good maximum likelihood program for phylogenetics is RAxML.
  
  
  The reality is it's not that simple because the mutation matrix is a function of the tree, which is a function of the mutation matrix and in technical tree building the matrix is also calculated alongside the total probability of the tree via maximum likelihood. Just to be clear it can be calculated as a separate maximum likelihood calculation and then fixed for the tree calculation, but it's not a good idea because of non-linear interactions.
  
  In addition, mutation rate (heterogeneity) is also calculated via maximum likelihood.
  
  The final thing to note is back-mutations are also calculated and that refers to past posts on this site, which I will link if I find them.
  
  
  Complexity If the parameters are calculated via maximum likelihood simultaneous to the tree the parameter space becomes EXTREMELY large and the calculation is searching the tree landscape against the parameter landscape which becomes a multi-dimensional calculation.
  Reality In reality much of a maximum likelihood calculation becomes about the search strategy because its impossible to traverse all of the parameter space so a heuristic estimate needs to be performed and the calculation can get stuck on lower plateaus of probability and fail to identify the tree maximum likelihood. This is the nuts and bolts of real world tree building.
  Note However if you fix the matrix and the rate, which a lot of people do, then points 1 to 5 describe the maximum likelihood tree.
  
original_text: 6205: <p>Could someone direct me to a resource (textbook chapter, lecture notes, online video, etc.) that demonstrates, in a mathematically or computationally rigorous way, how to use maximum likelihood estimation to generate a phylogenetic tree, given a set of aligned sequences?</p>
  <p>I've found several resources which describe the procedure for maximum likelihood estimation, such as:</p>
  <ol>
  <li>giving the formula and the parameters that need to be determined (which I already know);</li>
  <li>how to use it for aligned sequences (I already know this),
  I am seeking a worked-out example.</li>
  </ol>
  <p>Alternatively, if someone is willing to work out a small example, how would you use maximum likelihood estimation to generate a tree for the following three sequences?</p>
  <pre><code>organism_1 ATCG
  organism_2 ATCC
  organism_3 ATTT
  </code></pre>
   3848: <p>@DataScienceNovice ... here's a rough explanation. Just to note a tree with three taxa doesn't really work as a tree - you need 4 taxa.</p>
  <ol>
  <li><p>If we have <strong>tree 1</strong> ((A,B),(C,D)) the probability of the tree is expressed as the summed log likelihood for each position 1, 2, 3 .... in the alignment. The probability is derived from a mutation matrix, thus certain mutations e.g. transitions <code>A&lt;-&gt;G</code>; <code>C&lt;-&gt;T</code> are more probable (high likelihood), e.g. transversions <code>A&lt;-&gt;C</code>; <code>A&lt;-&gt;T</code>; <code>G&lt;-&gt;C</code>; <code>G&lt;-&gt;T</code> are less probable in accordance with the matrix. This hypothetical matrix (most matrices) is scoring transitions as much more probable than transversions.</p>
  </li>
  <li><p>The 'total probability' expressed  log likelihood for each column, i.e. each alignment position is added together leveraging an interesting property of logs (see final sentence of this paragraph). That becomes the 'score' or 'likelihood' for that tree. Note in the example you provided you have 4 alignment positions, so 4 probabilities of the log-likelihood will be added. Note, the probabilities are actually multiplied but log-likelihoods added is the same thing.</p>
  </li>
  <li><p>We will now rearrange the tree lets try <strong>tree 2</strong> ((C,D),(B,G)), again the hypothetical matrix scores transition/transversions, thus essentially if this tree has higher transitions than the tree in point 1. that will provide a higher likelihood. The tree that maximises the transitions <strong>as sister groups</strong> will maximise the likelihood. Equally maximising transversions as the most <strong>divergent groups</strong> will maximise the likelihood of that tree.</p>
  </li>
  <li><p>Re-arrange the tree again <strong>tree 3</strong> ... ((C,B),(D,A)) ... which tree has the highest transitions vs transversions? ...</p>
  </li>
  <li><p>In this example Tree 2 has the highest likelihood. Thus that is the maximum likelihood. Simple?</p>
  </li>
  </ol>
  <p>In the example you have the outcome will depend on the matrix. Alignment position 3 comprises a transition, whilst position 4 comprises a transition and a transversion. Generally transversions are 1:2 to 1:4 less likely even though there are twice as many. So the example you gave the 'tree' (you can't really have a tree with 3 taxa) would be ((<code>organism2</code>,<code>organism3</code>),<code>organism1</code>). This is against the total number of mutations because <code>organism2</code> and <code>organism3</code> has two mutations whilst <code>organism2</code> and <code>organism1</code> only have one, but the mutation types are different (also see point 3 below). In other words the occurrence of a transversion between <code>organism1</code> against <code>organism2</code>,<code>organism3</code>, mean <code>organism2</code> and <code>organism3</code> are more likely <strong>sister groups</strong> even though they comprise 2 mutations (transitions) against the single mutation between <code>organism1</code> and <code>organism2</code>.</p>
  <p>A good maximum likelihood program for phylogenetics is <strong><a href="https://cme.h-its.org/exelixis/web/software/raxml/" rel="nofollow noreferrer">RAxML</a></strong>.</p>
  <hr />
  <ol>
  <li><p>The reality is it's not that simple because the mutation matrix is a function of the tree, which is a function of the mutation matrix and in technical tree building the matrix is also calculated alongside the total probability of the tree via maximum likelihood. Just to be clear it can be calculated as a separate maximum likelihood calculation and then fixed for the tree calculation, but it's not a good idea because of non-linear interactions.</p>
  </li>
  <li><p>In addition, mutation rate (heterogeneity) is also calculated via maximum likelihood.</p>
  </li>
  <li><p>The final thing to note is back-mutations are also calculated and that refers to past posts on this site, which I will link if I find them.</p>
  </li>
  </ol>
  <p><strong>Complexity</strong> If the parameters are calculated via maximum likelihood simultaneous to the tree the parameter space becomes EXTREMELY large and the calculation is searching the tree landscape against the parameter landscape which becomes a multi-dimensional calculation.</p>
  <p><strong>Reality</strong> In reality much of a maximum likelihood calculation becomes about the search strategy because its impossible to traverse all of the parameter space so a heuristic estimate needs to be performed and the calculation can get stuck on lower plateaus of probability and fail to identify the tree maximum likelihood. This is the nuts and bolts of real world tree building.</p>
  <p><strong>Note</strong> However if you fix the matrix and the rate, which a lot of people do, then points 1 to 5 describe the maximum likelihood tree.</p>
  