branchClasses {paleotree} | R Documentation |
Partitions the branch lengths of a tree into several classes based on their placement.
Description
Partitions the branch lengths of a tree into several classes based on their placement.
Usage
branchClasses(tree, whichExtant = NULL, tol = 0.01)
Arguments
tree |
A dated phylogeny to be analyzed, as an object of class |
whichExtant |
A logical vector with length equal to number of tips in the tree. A |
tol |
Tolerance used to distinguish extant taxa,
if |
Details
This function will partition the internode
(node to node, including internal node to terminal tip) branch lengths of a tree into
four separate classes: all
(all the internode branches of a tree), int
(internal branches
which run from one internode to another), live
(terminal branches which run from an internal node to
a terminal tip representing an extinction event before the present) and dead
(terminal branches
which run from an internal node to a terminal tip at the modern day, reflecting a still-living taxon).
The depths of the internal 'mother' node (i.e. time of origin, before the modern day) of each branch length are included as the labels of the branch length vectors.
This function is mainly of use for modeling internode branch lengths in a phylogeny including fossil taxa.
Value
The output is a list consisting of four vectors, with the labels of the vectors being their corresponding time of origin. See details.
Examples
#simulated example
set.seed(444)
record <- simFossilRecord(
p = 0.1,
q = 0.1,
nruns = 1,
nTotalTaxa = c(30,40),
nExtant = c(10,20)
)
taxa <- fossilRecord2fossilTaxa(record)
tree <- taxa2phylo(taxa)
brlenRes <- branchClasses(tree)
#see frequency histograms of branch lengths
layout(1:4)
for(x in 1:length(brlenRes)){
hist(
brlenRes[[x]],
main = "Branch Lengths",
xlab = names(brlenRes)[x])
}
#see frequency histograms of branch depths
layout(1:4)
for(x in 1:length(brlenRes)){
hist(
as.numeric(names(brlenRes[[x]])),
main = "Branch Depths",
xlab = names(brlenRes)[x])
}
layout(1)