Answers.Body: <p>Perhaps the tree which you have calculated is not being caught in the search heuristic? Have you tried (as a trial) setting the tree which you calculated as the starting topology, just to check that it is indeed being calculated on by pratchet()?</p>
  
  <p>Alternatively, you could try playing around with the search heuristic settings, like varying from ratchet to NNI, or you could also try using an external program, like PAUP*.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-19T22:03:15.680Z
Answers.Text: Thank you, I tried these. When I set the start tree to the tree that I created manually, I got the following result:                                                                    ```Error in edgeMatrix[, k + 1] <- c(p1, e12, e34, p2, 1L) : number of items to replace is not a multiple of replacement length```                                                         What does this mean?
Answers.UserDisplayName: Namenlos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-19T22:11:11.780Z
Answers.Text: I am unsure. Have you verified that you provided a bifurcating newick tree file and that the data matrix has the same number of taxa as the tree?
Answers.UserDisplayName: NatWH
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-19T22:29:08.213Z
Answers.Text: The number of taxa is the same, but the tree is not fully resolved. So I presume that is then the problem.
Answers.UserDisplayName: Namenlos
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-19T16:47:54.807Z
Answers.LastActivityDate: 2018-06-19T16:47:54.807Z
Answers.UserDisplayName: NatWH
Answers.Body: <p>For dendrograms with less than about 10 OTUs/taxa/leaves it is possible to evaluate all possible dendrograms using an exhaustive search algorithm. However, for more than about 10 OTUs, heuristics need to be employed to try and "home-in" on and score a smaller set of "better" trees. However, these heuristics are not guaranteed to find <strong><em>the</em></strong> best dendrogram.</p>
  
  <p>Without some specific code it is hard to do more than speculate as to the problem you are encountering, especially where you get an error using data you manually create. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-20T01:23:48.627Z
Answers.LastActivityDate: 2018-06-20T01:23:48.627Z
Answers.UserDisplayName: Nathan S. Watson-Haigh
Body: <p>I called <code>pratchet()</code> on a dataset with binary values for the characters and it returned a parsimony value of 35. I then calculated the parsimony value for the dataset with a tree that I myself constructed and it was 7. How is this possible at all? I thought that <code>pratchet()</code> was supposed to return the most parsimonious tree on the basis of the data set, but that clearly did not happen in this case. Is there other software that is guaranteed to find the most parsimonious tree?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-06-20T01:12:27.183Z
Comments.Text: Please provide a minimal working example of code you have tried. That way a concrete and useful answer can be provided.
Comments.UserDisplayName: Nathan S. Watson-Haigh
Tags: <software-recommendation><phylogenetics><algorithms><phylogeny>
Title: Why does `pratchet()` in `phangorn` not find the most parsimonious trees?
ThreadText: # Why does `pratchet()` in `phangorn` not find the most parsimonious trees?
  
  (Asked by: username_0 on 2018-06-19)
  
  I called `pratchet()` on a dataset with binary values for the characters and it returned a parsimony value of 35. I then calculated the parsimony value for the dataset with a tree that I myself constructed and it was 7. How is this possible at all? I thought that `pratchet()` was supposed to return the most parsimonious tree on the basis of the data set, but that clearly did not happen in this case. Is there other software that is guaranteed to find the most parsimonious tree?
  
  **Tags:** software-recommendation, phylogenetics, algorithms, phylogeny
  
  > **Comments:**
  > **username_1**: Please provide a minimal working example of code you have tried. That way a concrete and useful answer can be provided.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-06-19. Score: 1 | Accepted answer
  
  Perhaps the tree which you have calculated is not being caught in the search heuristic? Have you tried (as a trial) setting the tree which you calculated as the starting topology, just to check that it is indeed being calculated on by pratchet()?
  
  Alternatively, you could try playing around with the search heuristic settings, like varying from ratchet to NNI, or you could also try using an external program, like PAUP\*.
  
  > **Comments:**
  > **username_0**: Thank you, I tried these. When I set the start tree to the tree that I created manually, I got the following result:                                                                    ```Error in edgeMatrix[, k + 1] <- c(p1, e12, e34, p2, 1L) : number of items to replace is not a multiple of replacement length```                                                         What does this mean?  
  > **username_2**: I am unsure. Have you verified that you provided a bifurcating newick tree file and that the data matrix has the same number of taxa as the tree?  
  > **username_0**: The number of taxa is the same, but the tree is not fully resolved. So I presume that is then the problem.  
  
  ---
  
  ### Answer by username_1 on 2018-06-20. Score: 1
  
  For dendrograms with less than about 10 OTUs/taxa/leaves it is possible to evaluate all possible dendrograms using an exhaustive search algorithm. However, for more than about 10 OTUs, heuristics need to be employed to try and "home-in" on and score a smaller set of "better" trees. However, these heuristics are not guaranteed to find ***the*** best dendrogram.
  
  Without some specific code it is hard to do more than speculate as to the problem you are encountering, especially where you get an error using data you manually create.
  
  
  ---
  
  