3 \title{Fits the Time-Dependent Yule Model}
5 yule.time(phy, birth, BIRTH = NULL, root.time = 0, opti = "nlm", start = 0.01)
8 \item{phy}{an object of class \code{"phylo"}.}
9 \item{birth}{a (vectorized) function specifying how the birth
10 (speciation) probability changes through time (see details).}
11 \item{BIRTH}{a (vectorized) function giving the primitive of
13 \item{root.time}{a numeric value giving the time of the root node
14 (time is measured from the past towards the present).}
15 \item{opti}{a character string giving the function used for
16 optimisation of the likelihood function. Three choices are possible:
17 \code{"nlm"}, \code{"nlminb"}, or \code{"optim"}, or any unambiguous
18 abbreviation of these.}
19 \item{start}{the initial values used in the optimisation.}
22 This function fits by maximum likelihood the time-dependent Yule
23 model. The time is measured from the past (\code{root.time}) to the
27 The model fitted is a straightforward extension of the Yule model with
28 covariates (see \code{\link{yule.cov}}). Rather than having
29 heterogeneity among lineages, the speciation probability is the same
30 for all lineages at a given time, but can change through time.
32 The function \code{birth} \emph{must} meet these two requirements: (i)
33 the parameters to be estimated are the formal arguments; (ii) time is
34 named \code{t} in the body of the function. However, this is the
35 opposite for the primitive \code{BIRTH}: \code{t} is the formal
36 argument, and the parameters are used in its body. See the examples.
38 It is recommended to use \code{BIRTH} if possible, and required if
39 speciation probability is constant on some time interval. If this
40 primitive cannot be provided, a numerical integration is done with
41 \code{\link[base]{integrate}}.
43 The standard-errors of the parameters are computed with the Hessian of
44 the log-likelihood function.
47 An object of class "yule" (see \code{\link{yule}}).
49 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
51 \code{\link{branching.times}}, \code{\link{ltt.plot}},
52 \code{\link{birthdeath}}, \code{\link{yule}}, \code{\link{yule.cov}}
55 ### define two models...
56 birth.logis <- function(a, b) 1/(1 + exp(-a*t - b)) # logistic
57 birth.step <- function(l1, l2, Tcl) { # 2 rates with one break-point
58 ans <- rep(l1, length(t))
62 ### ... and their primitives:
63 BIRTH.logis <- function(t) log(exp(-a*t) + exp(b))/a + t
64 BIRTH.step <- function(t)
66 if (t <= Tcl) return(t*l1)
71 yule.time(bird.families, birth.logis)
72 yule.time(bird.families, birth.logis, BIRTH.logis) # same but faster
73 \dontrun{yule.time(bird.families, birth.step)} # fails
74 yule.time(bird.families, birth.step, BIRTH.step)