Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


paleotree (version 2.5)

branchClasses: 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 time-scaled phylogeny to be analysed, as an object of class phylo, ideally with a $root.time element as is typical for paleotree output phylogenies. If $root.time is not present, the most recent tips will be interpreted as being at the modern day (i.e
whichExtant
A logical vector with length equal to number of tips in the tree. TRUE indicates a taxon that is extant at the moden day. If present
tol
Tolerance used to distinguish extant taxa, if whichExtant is not provided, to avoid issues with number rounding. Taxa within tol of the modern day will be considered extant.

Value

  • The output is a list consisting of four vectors, with the /code{names} of the vectors being their corresponding time of origin. See details.

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 /code{names} of the branch length vectors. This function is mainly of use for modeling internode branch lengths in a phylogeny including fossil taxa.

Examples

Run this code
#simulated example
set.seed(444)
taxa <- simFossilTaxa(p=0.1,q=0.1,nruns=1,mintaxa=20,maxtaxa=30,maxtime=1000,maxExtant=20)
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)

Run the code above in your browser using DataLab