3 \title{Fits the Yule Model With Covariates}
5 yule.cov(phy, formula, data = NULL)
8 \item{phy}{an object of class \code{"phylo"}.}
9 \item{formula}{a formula specifying the model to be fitted.}
10 \item{data}{the name of the data frame where the variables in
11 \code{formula} are to be found; by default, the variables are looked
12 for in the global environment.}
15 This function fits by maximum likelihood the Yule model with
16 covariates, that is a birth-only model where speciation rate is
17 determined by a generalized linear model.
20 The model fitted is a generalization of the Yule model where the
21 speciation rate is determined by:
23 \deqn{\ln\frac{\lambda_i}{1 - \lambda_i} = \beta_1 x_{i1} + \beta_2 x_{i2}
24 + \dots + \alpha }{ln(li / (1 - li)) = b1 xi1 + b2 xi2 + ... a}
26 where \eqn{\lambda_i}{li} is the speciation rate for species i,
27 \eqn{x_{i1}, x_{i2}, \dots}{xi1, xi2, ...} are species-specific
28 variables, and \eqn{\beta_1, \beta_2, \dots, \alpha}{b1, b2, ..., a}
29 are parameters to be estimated. The term on the left-hand side above
30 is a logit function often used in generalized linear models for
31 binomial data (see \code{\link[stats]{family}}). The above model can
32 be written in matrix form:
34 \deqn{\mathrm{logit} \lambda_i = x_i' \beta}{logit li = xi' b}
36 The standard-errors of the parameters are computed with the second
37 derivatives of the log-likelihood function. (See References for other
38 details on the estimation procedure.)
40 The function needs three things:
43 \item a phylogenetic tree which may contain multichotomies;
45 \item a formula which specifies the predictors of the model described
46 above: this is given as a standard R formula and has no response (no
47 left-hand side term), for instance: \code{~ x + y}, it can include
48 interactions (\code{~ x + a * b}) (see \code{\link[stats]{formula}}
51 \item the predictors specified in the formula must be accessible to
52 the function (either in the global space, or though the \code{data}
53 option); they can be numeric vectors or factors. The length and the
54 order of these data are important: the number of values (length) must
55 be equal to the number of tips of the tree + the number of nodes. The
56 order is the following: first the values for the tips in the same
57 order than for the labels, then the values for the nodes sequentially
58 from the root to the most terminal nodes (i.e. in the order given by
62 The user must obtain the values for the nodes separately.
64 Note that the method in its present implementation assumes that the
65 change in a species trait is more or less continuous between two nodes
66 or between a node and a tip. Thus reconstructing the ancestral values
67 with a Brownian motion model may be consistent with the present
68 method. This can be done with the function \code{\link{ace}}.
71 A NULL value is returned, the results are simply printed. The output
72 includes the deviance of the null (intercept-only) model and a
73 likelihood-ratio test of the fitted model against the null model.
74 Note that the deviance of the null model is different from the one
75 returned by \code{\link{yule}} because of the different parametrizations.
78 Paradis, E. (2005) Statistical analysis of diversification with
79 species traits. \emph{Evolution}, \bold{59}, 1--12.
81 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
83 \code{\link{branching.times}}, \code{\link{diversi.gof}},
84 \code{\link{diversi.time}}, \code{\link{ltt.plot}},
85 \code{\link{birthdeath}}, \code{\link{bd.ext}}, \code{\link{yule}}
88 ### a simple example with some random data
90 x <- rnorm(45) # the tree has 23 tips and 22 nodes
91 ### the standard-error for x should be as large as
92 ### the estimated parameter
93 yule.cov(bird.orders, ~ x)
94 ### another example with a tree that has a multichotomy
96 y <- rnorm(272) # 137 tips + 135 nodes
97 yule.cov(bird.families, ~ y)