scale_tree {bnpsd} | R Documentation |
Scale a coancestry tree
Description
Scale by a scalar factor
all the edges ($edge.length
) of a phylo
object from the ape
package, including the root edge ($root.edge
) if present, and additive edges ($edge.length.add
, present in trees returned by fit_tree()
).
Stops if any of the edges exceed 1 before or after scaling (since these edges are IBD probabilities).
Usage
scale_tree(tree, factor)
Arguments
tree |
The coancestry tree to edit. |
factor |
The scalar factor to multiply all edges. Must be non-negative, and not be so large that any edge exceeds 1 after scaling. |
Value
The edited tree with all edges scaled as desired.
See Also
ape::read.tree()
for reading phylo
objects and their definition.
Examples
# create a random tree
library(ape)
k <- 5
tree <- rtree( k )
# scale this tree
tree_scaled <- scale_tree( tree, 0.5 )
[Package bnpsd version 1.3.13 Index]