Comparison of a list of trees using the Kendall Colijn metric. Output is given as a pairwise distance matrix. This is equivalent to the $D
output from treespace
but may be preferable for large datasets, and when principal co-ordinate analysis is not required. It includes an option to save memory at the expense of computation time.
multiDist(
trees,
lambda = 0,
return.lambda.function = FALSE,
save.memory = FALSE,
emphasise.tips = NULL,
emphasise.weight = 2
)
an object of the class multiPhylo
containing the trees to be compared
a number in [0,1] which specifies the extent to which topology (default, with lambda=0) or branch lengths (lambda=1) are emphasised. This argument is ignored if return.lambda.function=TRUE
.
If true, a function that can be invoked with different lambda values is returned. This function returns the matrix of metric values for the given lambda.
A flag that saves a lot of memory but increases the execution time (not compatible with return.lambda.function=TRUE).
an optional list of tips whose entries in the tree vectors should be emphasised. Defaults to NULL
.
applicable only if a list is supplied to emphasise.tips
, this value (default 2) is the number by which vector entries corresponding to those tips are emphasised.
The pairwise tree distance matrix or a function that produces the distance matrix given a value for lambda.
## generate 10 random trees, each with 6 tips
trees <- rmtree(10,6)
## pairwise distance matrix when lambda=0
multiDist(trees)
#> 1 2 3 4 5 6 7 8
#> 2 4.358899
#> 3 3.162278 4.582576
#> 4 4.123106 4.472136 3.605551
#> 5 4.472136 4.358899 5.291503 5.000000
#> 6 4.690416 4.123106 4.000000 5.196152 5.656854
#> 7 6.855655 6.164414 6.403124 6.000000 6.082763 6.855655
#> 8 3.316625 4.242641 3.316625 4.242641 5.000000 5.000000 6.324555
#> 9 5.385165 5.830952 5.385165 5.477226 5.916080 6.708204 6.480741 5.099020
#> 10 4.000000 3.605551 4.472136 3.605551 5.099020 4.690416 6.082763 4.582576
#> 9
#> 2
#> 3
#> 4
#> 5
#> 6
#> 7
#> 8
#> 9
#> 10 5.567764
## pairwise distance matrix as a function of lambda:
m <- multiDist(trees, return.lambda.function=TRUE)
## evaluate at lambda=0. Equivalent to multiDist(trees).
m0 <- m(0)
## save memory by recomputing each tree vector for each pairwise tree comparison (for fixed lambda):
m0.5 <- multiDist(trees,0.5,save.memory=TRUE)