Last data update: 2014.03.03

R: Compute phylogeny with branch lengths equal to corresponding...
getMeanBranchLengthTreeR Documentation

Compute phylogeny with branch lengths equal to corresponding macroevolutionary rate estimates

Description

Takes a bammdata object and computes a phylogenetic tree where branch lengths are equal to the mean of the marginal distributions of rates on each branch. This tree can be plotted to visualize rate variation across a phylogeny.

Usage

getMeanBranchLengthTree(ephy, rate = "speciation")

Arguments

ephy

An object of class bammdata.

rate

The type of rate-tree to be computed. Options: "speciation" (default), "extinction", "ndr" (net diversification), and "trait".

Value

A list with the following components:

  • phy A phylogenetic tree, topologically identical to the model tree, but with branch lengths replaced by the mean (marginal) rates on each branch as estimated from the posterior samples in the bammdata object.

  • mean The mean rate over all branches.

  • median the median rate over all branches.

Author(s)

Dan Rabosky

References

http://bamm-project.org

See Also

plot.bammdata

Examples

data(whales)
data(events.whales)
ed <- getEventData(whales, events.whales, burnin=0.1, nsamples=500)
ed2 <- subsetEventData(ed, index = 1:20)
ratetree <- getMeanBranchLengthTree(ed2, rate='speciation')
plot(ratetree$phy, show.tip.label=FALSE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BAMMtools)
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BAMMtools/getMeanBranchLengthTree.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getMeanBranchLengthTree
> ### Title: Compute phylogeny with branch lengths equal to corresponding
> ###   macroevolutionary rate estimates
> ### Aliases: getMeanBranchLengthTree
> ### Keywords: models
> 
> ### ** Examples
> 
> data(whales)
> data(events.whales)
> ed <- getEventData(whales, events.whales, burnin=0.1, nsamples=500)
Processing event data from data.frame

Discarded as burnin: GENERATIONS <  995000
Analyzing  500  samples from posterior

Setting recursive sequence on tree...

Done with recursive sequence

> ed2 <- subsetEventData(ed, index = 1:20)
> ratetree <- getMeanBranchLengthTree(ed2, rate='speciation')
> plot(ratetree$phy, show.tip.label=FALSE)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>