treeDist {treenomial}R Documentation

Calculates the distance between trees

Description

Calculates the distance between two trees or a tree and a list of trees.

Usage

treeDist(
  x,
  Y,
  type = c("default", "yEvaluated", "tipLabel"),
  method = c("fraction", "logDiff", "wLogDiff", "pa", "ap"),
  y,
  numThreads = -1
)

Arguments

x

single phylo object

Y

a list of phylo objects

type

one of:

“real”

tree distinguishing polynomials in two variables x (columns) and y (rows)

“yEvaluated”

tree distinguishing polynomials with y evaluated at a specified argument

“tipLabel”

complex coefficient polynomial that utilize binary trait tip labels on the phylo objects

method

method to use when calculating coefficient distances:

“fraction”

for two coefficient matrices A and B returns sum(abs(A-B)/(A+B)), excluding elements where both A and B are zero

“logDiff”

for two coefficient matrices A and B returns sum(log(1+abs(A-B))

“wLogDiff”

performs the “logDiff” method with weights on the rows

“pa”

total pairs where the coefficient is present in one matrix and absent in the other (presence-absence)

“ap”

opposite comparison of pa (absence-presence)

y

the y value to evaluate the polynomial at when type is “yEvaluated”, ignored otherwise

numThreads

number of threads to be used, the default (-1) will use the number of cores in the machine and numThreads = 0 will only use the main thread

Value

vector of distances

Note

Examples


library(treenomial)
library(ape)

# distance between one 10 tip tree and 100 trees with 30 tips

# generate the trees
tenTipTree <- rtree(10)
thirtyTipList <- rmtree(100, 30)

# find the distance
treeDist(tenTipTree, thirtyTipList, numThreads = 0)

[Package treenomial version 1.1.4 Index]