]> git.donarmstrong.com Git - ape.git/blob - man/rlineage.Rd
some big fixes for ape 2.7-1
[ape.git] / man / rlineage.Rd
1 \name{rlineage}
2 \alias{rlineage}
3 \alias{rbdtree}
4 \alias{drop.fossil}
5 \title{Tree Simulation Under the Time-Dependent Birth--Death Models}
6 \description{
7   These two functions simulate phylogenies under any time-dependent
8   birth--death model. \code{lineage} generates a complete tree including
9   the species that go extinct; \code{rbdtree} generates a tree with only
10   the species until present; \code{drop.fossil} is a utility function to
11   remove the extinct species.
12 }
13 \usage{
14 rlineage(birth, death, Tmax = 50, BIRTH = NULL,
15          DEATH = NULL, eps = 1e-6)
16 rbdtree(birth, death, Tmax = 50, BIRTH = NULL,
17         DEATH = NULL, eps = 1e-6)
18 drop.fossil(phy, tol = 1e-8)
19 }
20 \arguments{
21   \item{birth, death}{a numeric value or a (vectorized) function
22     specifying how speciation and extinction through time.}
23   \item{Tmax}{a numeric value giving the length of the simulation.}
24   \item{BIRTH, DEATH}{a (vectorized) function which is the primitive
25     of \code{birth} or \code{death}. This can be used to speed-up the
26     computation. By default, numerical integration is done.}
27   \item{eps}{a numeric value giving the time resolution of the
28     simulation; this may be increased (e.g., 0.001) to shorten
29     computation times.}
30   \item{phy}{an object of class \code{"phylo"}.}
31   \item{tol}{a numeric value giving the tolerance to consider a species
32     as extinct.}
33 }
34 \details{
35   Both functions use continuous-time algorithms described in the
36   references. The models are time-dependent birth--death models as
37   described in Kendall (1948). Speciation (birth) and extinction (death)
38   rates may be constant or vary through time according to an \R function
39   specified by the user. In the latter case, \code{BIRTH} and/or
40   \code{DEATH} may be used of the primitives of \code{birth} and
41   \code{death} are known. In these functions time is the formal argument
42   and must be named \code{t}.
43 }
44 \value{
45   An object of class \code{"phylo"}.
46 }
47 \references{
48   Kendall, D. G. (1948) On the generalized ``birth-and-death''
49   process. \emph{Annals of Mathematical Statistics}, \bold{19}, 1--15.
50
51   Paradis, E. (2011) Time-dependent speciation and extinction from
52   phylogenies: a least squares approach. \emph{Evolution}, \bold{65},
53   661--672.
54 }
55 \author{Emmanuel Paradis}
56 \seealso{
57   \code{\link{yule}}, \code{\link{yule.time}}, \code{\link{birthdeath}},
58   \code{\link{rtree}}, \code{\link{stree}}
59 }
60 \examples{
61 plot(rlineage(0.1, 0)) # Yule process with lambda = 0.1
62 plot(rlineage(0.1, 0.05)) # simple birth-death process
63 b <- function(t) 1/(1 + exp(0.2*t - 1)) # logistic
64 layout(matrix(0:3, 2, byrow = TRUE))
65 curve(b, 0, 50, xlab = "Time", ylab = "")
66 mu <- 0.07
67 segments(0, mu, 50, mu, lty = 2)
68 legend("topright", c(expression(lambda), expression(mu)),
69        lty = 1:2, bty = "n")
70 plot(rlineage(b, mu), show.tip.label = FALSE)
71 title("Simulated with 'rlineage'")
72 plot(rbdtree(b, mu), show.tip.label = FALSE)
73 title("Simulated with 'rbdtree'")
74 }
75 \keyword{datagen}