Learn R Programming

BAMMtools (version 2.1.12)

dtRates: Calculate macroevolutionary rate changes on a phylogeny from BAMM output

Description

dtRates calculates the mean of the marginal posterior density of the rate of speciation/extinction or trait evolution for small segments along each branch in a phylogeny.

Usage

dtRates(ephy, tau, ism = NULL, tmat = FALSE)

Value

A bammdata object with a new component named "dtrates", which is a list with two or three components:

  • tau: The parameter value of tau used in the calculation.

  • rates: If ephy$type = "trait": a numeric vector with the phenotypic rates of each segment on each branch. If ephy$type = "diversification": a list with two components. The first component is a numeric vector of speciation rates. The second component is a numeric vector of extinction rates.

  • tmat: A matrix of the starting and ending times of the segments on each branch. Only if tmat = TRUE.

Arguments

ephy

An object of class bammdata.

tau

A numeric that specifies the size (as a fraction of tree height) of the segments that each branch will be discretized into.

ism

An integer vector indexing which posterior samples to include in the calculation.

tmat

A logical. If TRUE the matrix of branch segments is returned.

Author

Mike Grundler

Details

dtRates bins the phylogeny into windows of time and calculates average rates of speciation/extinction or phenotypic evolution along each segment of a branch within a window. The width of each window is determined by tau. tau is a fraction of the root to tip distance so a value of tau = 0.01 bins the phylogeny into 100 time windows of equal width.

References

http://bamm-project.org/

See Also

plot.bammdata

Examples

Run this code
data(whales, events.whales)
ed <- getEventData(whales, events.whales, burnin=0.25, nsamples=500)

# use all posterior samples
ed <- dtRates(ed, tau=0.01)

# use specified range of posterior samples
ed <- dtRates(ed, tau=0.01, ism=50:150)

Run the code above in your browser using DataLab