NormalizeInfo {TreeDist} | R Documentation |
Normalize tree distances
Description
NormalizeInfo()
is an internal function used to normalize information
against a reference, such as the total information present in a pair of
trees.
Usage
NormalizeInfo(
unnormalized,
tree1,
tree2,
InfoInTree,
infoInBoth = NULL,
how = TRUE,
Combine = "+",
...
)
Arguments
unnormalized |
Numeric value, vector or matrix to be normalized. |
tree1 , tree2 |
Trees from which |
InfoInTree |
Function to calculate the information content of each tree. |
infoInBoth |
Optional numeric specifying information content of both
trees independently. If unspecified ( |
how |
Method for normalization, perhaps specified using the |
... |
Additional parameters to |
Details
The unnormalized value(s) are normalized by dividing by a denominator
calculated based on the how
parameter. Valid options include:
FALSE
No normalization is performed; the unnormalized values are returned.
TRUE
Unless
infoInBoth
is specified, the information in each tree is computed usingInfoInTree()
, and the two values combined usingCombine()
.- A numeric value, vector or matrix
how
is used as the denominator; the returned value isunnormalized / how
.- A function
Unless
infoInBoth
is specified, the information in each tree is computed usingInfoInTree()
, and the two values combined usinghow
.NormalizeInfo(how = Func)
is thus equivalent toNormalizeInfo(how = TRUE, Combine = Func)
.
Value
NormalizeInfo()
returns an object corresponding to the normalized
values of unnormalized
.
Author(s)
Martin R. Smith (martin.smith@durham.ac.uk)
Examples
library("TreeTools", quietly = TRUE)
pair1 <- c(BalancedTree(9), StarTree(9))
pair2 <- c(BalancedTree(9), PectinateTree(9))
# We'll let the number of nodes define the total information in a tree
Nnode(pair1)
Nnode(pair2)
# Let's normalize a unit distance
rawDist <- cbind(c(1, 1), c(1, 1))
# With `Combine = "+"`, the maximum distance is the sum of
# the information in each tree
denominator <- outer(Nnode(pair1), Nnode(pair2), "+")
NormalizeInfo(rawDist, pair1, pair2, InfoInTree = ape::Nnode, Combine = "+")
rawDist / denominator
# A denominator can be specified manually using `how`:
NormalizeInfo(rawDist, pair1, pair2, InfoInTree = ape::Nnode, how = 16)
rawDist / 16
# `how` also allows the denominator to be computed from trees:
outer(Nnode(pair1), Nnode(pair2), pmin)
NormalizeInfo(rawDist, pair1, pair2, InfoInTree = ape::Nnode, how = pmin)
rawDist / outer(Nnode(pair1), Nnode(pair2), pmin)