View source: R/utilities-phylo.R
rescale.phylo | R Documentation |
"phylo"
Applying various transformation to the branches of a phylogenetic tree.
## S3 method for class 'phylo'
rescale(x, model = c("BM", "OU", "EB", "nrate", "lrate",
"trend", "lambda", "kappa", "delta", "white", "depth"), ...)
x |
an object of class |
model |
a model used to transform the tree (see Details). |
... |
argument(s) to be passed to the transformation function (see Examples). |
This function takes a tree and returns either a transformed tree if ...
is not empty and gives the parameter value(s) for the tree transformation. If ...
is left empty, a function is returned to the user that can be efficiently iterated over many parameter values for transformation. The available models are meant to correspond with changing the model of phenotypic evolution for discrete or continuous characters.
A transformation function (or rescaled phylogenetic tree of class 'phylo' (ape format) is returned. Possible transforms include the following:
BM |
is the Brownian motion model, which fits a random walk with variance |
OU |
is the Ornstein-Uhlenbeck model (Butler and King 2004), which fits a random walk with a central tendency with an attraction strength proportional to the parameter |
EB |
is the Early-burst model (Harmon et al. 2010) and also called the |
nrate |
is the multiple-rates model where time slices have independent rates of evolution. The parameters used for transformation are |
lrate |
is the multiple-rates model where local clades have independent rates of evolution. The parameters used for transformation are |
trend |
is a diffusion model with linear trend in rates through time. The parameter used for transformation is |
lambda |
is one of the Pagel (1999) models that fits the extent to which the phylogeny predicts covariance among trait values for species. The model effectively transforms the tree as follows: values of |
kappa |
is a punctuational (speciational) model of trait evolution (Pagel 1999), where character divergence is related to the number of speciation events between two species. Note that if there are missing speciation events in the given phylogeny (due to extinction or incomplete sampling), interpretation under the |
delta |
is a time-dependent model of trait evolution (Pagel 1999). The |
white |
is a |
depth |
is simply a transformation of the total depth of the tree; stretching the tree has an effect of increasing rates of evolution under Brownian motion (relative to characters evolved on the unstretched tree), and compressing the tree has the opposite effect. The parameter used for transformation is |
LJ Harmon and JM Eastman
Pagel, M. 1999. Inferring the historical patterns of biological evolution. Nature 401:877-884.
Butler, M.A. and A.A. King, 2004. Phylogenetic comparative analysis: a modeling approach for adaptive evolution. American Naturalist 164:683-695.
Various papers in prep., L. J. Harmon and J. T. Weir.
geo <- get(data(geospiza))
## returning a function
ltrns <- rescale(geo$phy, "lambda")
plot(ltrns(0))
title("lambda: 0.0")
plot(ltrns(0.5))
title("lambda: 0.5")
plot(ltrns(1))
title("lambda: 1")
## transforming the tree
lphy <- rescale(geo$phy, "lambda", 0.5) # transform tree in one fell swoop
plot(lphy)
title("lambda: 0.5")
## multirate tree -- time
rtrns <- rescale(geo$phy, "nrate")
rphy <- rtrns(time=c(0.2, 0.4, 0.6, 0.8), rate=c(2, 4, 8, 16))
plot(rphy)
title("5-rate tree: by time")
## multirate tree -- lineages
mtrns <- rescale(geo$phy, "lrate")
mphy <- mtrns(node=c(25, 20), rate=c(4, 8))
plot(mphy)
title("3-rate tree: by lineages")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.