polyDist {treenomial} | R Documentation |
Calculates the distance between coefficient matrices
Description
Calculates the distance between two coefficient matrices or a coefficient matrix and a list of coefficient matrices.
Usage
polyDist(
x,
Y,
method = c("fraction", "logDiff", "wLogDiff", "pa", "ap"),
numThreads = -1
)
Arguments
x |
single coefficient matrix to find distances to |
Y |
a list of coefficient matrices |
method |
method to use when calculating coefficient distances:
|
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
the substituted y coefficient vector only supports the “logDiff” method and the “fraction” method
-
“pa” and “ap” force symmetry in the output distance matrix
Examples
library(treenomial)
library(ape)
# distance between coefficient matrices of one 10 tip tree
# and 100 trees with 30 tips using
# create the coefficient matrices
tenTipTree <- rtree(10)
tenTipTreeCoeff <- treeToPoly(tenTipTree, numThreads = 0)
thirtyTipList <- rmtree(100, 30)
thirtyTipCoeffs <- treeToPoly(thirtyTipList, numThreads = 0)
# find the distance
polyDist(tenTipTreeCoeff, thirtyTipCoeffs, numThreads = 0)