# Re: [R-sig-phylo] distances between trees

```Hi Karla,

```
I cannot answer to your question on comparing trees with different sets of labels, but surely dist.topo() should return an error in this situation. I modified the code to handle this -- it is also much faster (~ 100 times faster when comparing 100 trees with 100 tips).
```
```
And yes, you are right: from the definition of the RF distance in ?RF.dist and the one for the PH distance in ?dist.topo, they are the same.
```
Best,

Emmanuel

Le 20/11/2016 à 18:07, Karla Shikev a écrit :
```
```Here's another question.

I'm looking for ways to compute distances between two trees when there are
differences in the sets of tip labels.

Based on some preliminary tests using simulated trees, phangorn's RF.dist
gives me exactly the same results as ape's dist.topo (which makes me wonder
if Penny and Hendy (1985)'s topological distance and the Robinson-Foulds
distance are equivalent). But, if there is one tip missing from one of the
trees, dist.topo gives me a distance anyway, but RF.dist gives me an error
message:

```
```tr1<-pbtree(n=30)
tr2<-pbtree(n=29)
dist.topo(tr1, tr2)
```
```[1] 51
```
```RF.dist(tr1, tr2)
```
```Error in RF.dist(tr1, tr2) : trees have different labels

However, this distance does not seem reasonable to me. For instance, if I
take the same tree and drop different tips, I get:

```
```tr<-pbtree(n=10)
tr1<-drop.tip(tr, "t1")
tr2<-drop.tip(tr, "t2")
dist.topo(tr1, tr2)
```
```[1] 4
```
```RF.dist(tr1, tr2)
```
```Error in RF.dist(tr1, tr2) : trees have different labels

Sometimes dist.topo gives me a distance of 2, other times I get 4,
depending on the simulated tree, yet both trees are completely consistent
with one another. Is there a metric that would circumvent this issue?

Thanks again,

Karla

[[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Pour nous remonter une erreur de filtrage, veuillez vous rendre ici :
http://f.security-mail.net/301GGR55Htk

```
```
_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
```