Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rlineage

Tree Simulation Under the Time-Dependent Birth–Death Models


Description

These three functions simulate phylogenies under any time-dependent birth–death model: rlineage generates a complete tree including the species going extinct before present; rbdtree generates a tree with only the species living at present (thus the tree is ultrametric); rphylo generates a tree with a fixed number of species at present time. drop.fossil is a utility function to remove the extinct species.

Usage

rlineage(birth, death, Tmax = 50, BIRTH = NULL,
         DEATH = NULL, eps = 1e-6)
rbdtree(birth, death, Tmax = 50, BIRTH = NULL,
        DEATH = NULL, eps = 1e-6)
rphylo(n, birth, death, BIRTH = NULL, DEATH = NULL,
       T0 = 50, fossils = FALSE, eps = 1e-06)
drop.fossil(phy, tol = 1e-8)

Arguments

birth, death

a numeric value or a (vectorized) function specifying how speciation and extinction rates vary through time.

Tmax

a numeric value giving the length of the simulation.

BIRTH, DEATH

a (vectorized) function which is the primitive of birth or death. This can be used to speed-up the computation. By default, a numerical integration is done.

eps

a numeric value giving the time resolution of the simulation; this may be increased (e.g., 0.001) to shorten computation times.

n

the number of species living at present time.

T0

the time at present (for the backward-in-time algorithm).

fossils

a logical value specifying whether to output the lineages going extinct.

phy

an object of class "phylo".

tol

a numeric value giving the tolerance to consider a species as extinct.

Details

These three functions use continuous-time algorithms: rlineage and rbdtree use the forward-in-time algorithms described in Paradis (2011), whereas rphylo uses a backward-in-time algorithm from Stadler (2011). The models are time-dependent birth–death models as described in Kendall (1948). Speciation (birth) and extinction (death) rates may be constant or vary through time according to an R function specified by the user. In the latter case, BIRTH and/or DEATH may be used if the primitives of birth and death are known. In these functions time is the formal argument and must be named t.

Note that rphylo simulates trees in a way similar to what the package TreeSim does, the difference is in the parameterization of the time-dependent models which is here the same than used in the two other functions. In this parameterization scheme, time is measured from past to present (see details in Paradis 2015 which includes a comparison of these algorithms).

The difference between rphylo and rphylo(... fossils = TRUE) is the same than between rbdtree and rlineage.

Value

An object of class "phylo".

Author(s)

Emmanuel Paradis

References

Kendall, D. G. (1948) On the generalized “birth-and-death” process. Annals of Mathematical Statistics, 19, 1–15.

Paradis, E. (2011) Time-dependent speciation and extinction from phylogenies: a least squares approach. Evolution, 65, 661–672.

Paradis, E. (2015) Random phylogenies and the distribution of branching times. Journal of Theoretical Biology, 387, 39–45.

Stadler, T. (2011) Simulating trees with a fixed number of extant species. Systematic Biology, 60, 676–684.

See Also

Examples

set.seed(10)
plot(rlineage(0.1, 0)) # Yule process with lambda = 0.1
plot(rlineage(0.1, 0.05)) # simple birth-death process
b <- function(t) 1/(1 + exp(0.2*t - 1)) # logistic
layout(matrix(0:3, 2, byrow = TRUE))
curve(b, 0, 50, xlab = "Time", ylab = "")
mu <- 0.07
segments(0, mu, 50, mu, lty = 2)
legend("topright", c(expression(lambda), expression(mu)),
       lty = 1:2, bty = "n")
plot(rlineage(b, mu), show.tip.label = FALSE)
title("Simulated with 'rlineage'")
plot(rbdtree(b, mu), show.tip.label = FALSE)
title("Simulated with 'rbdtree'")

ape

Analyses of Phylogenetics and Evolution

v5.5
GPL-2 | GPL-3
Authors
Emmanuel Paradis [aut, cre, cph] (<https://orcid.org/0000-0003-3092-2199>), Simon Blomberg [aut, cph] (<https://orcid.org/0000-0003-1062-0839>), Ben Bolker [aut, cph] (<https://orcid.org/0000-0002-2127-0443>), Joseph Brown [aut, cph] (<https://orcid.org/0000-0002-3835-8062>), Santiago Claramunt [aut, cph] (<https://orcid.org/0000-0002-8926-5974>), Julien Claude [aut, cph] (<https://orcid.org/0000-0002-9267-1228>), Hoa Sien Cuong [aut, cph], Richard Desper [aut, cph], Gilles Didier [aut, cph] (<https://orcid.org/0000-0003-0596-9112>), Benoit Durand [aut, cph], Julien Dutheil [aut, cph] (<https://orcid.org/0000-0001-7753-4121>), RJ Ewing [aut, cph], Olivier Gascuel [aut, cph], Thomas Guillerme [aut, cph] (<https://orcid.org/0000-0003-4325-1275>), Christoph Heibl [aut, cph] (<https://orcid.org/0000-0002-7655-3299>), Anthony Ives [aut, cph] (<https://orcid.org/0000-0001-9375-9523>), Bradley Jones [aut, cph] (<https://orcid.org/0000-0003-4498-1069>), Franz Krah [aut, cph] (<https://orcid.org/0000-0001-7866-7508>), Daniel Lawson [aut, cph] (<https://orcid.org/0000-0002-5311-6213>), Vincent Lefort [aut, cph], Pierre Legendre [aut, cph] (<https://orcid.org/0000-0002-3838-3305>), Jim Lemon [aut, cph], Guillaume Louvel [aut, cph] (<https://orcid.org/0000-0002-7745-0785>), Eric Marcon [aut, cph] (<https://orcid.org/0000-0002-5249-321X>), Rosemary McCloskey [aut, cph] (<https://orcid.org/0000-0002-9772-8553>), Johan Nylander [aut, cph], Rainer Opgen-Rhein [aut, cph], Andrei-Alin Popescu [aut, cph], Manuela Royer-Carenzi [aut, cph], Klaus Schliep [aut, cph] (<https://orcid.org/0000-0003-2941-0161>), Korbinian Strimmer [aut, cph] (<https://orcid.org/0000-0001-7917-2056>), Damien de Vienne [aut, cph] (<https://orcid.org/0000-0001-9532-5251>)
Initial release
2021-04-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.