ace {ape} | R Documentation |
This function estimates ancestral character states, and the associated uncertainty, for continuous and discrete characters.
ace(x, phy, type = "continuous", method = "ML", CI = TRUE, model = if (type == "continuous") "BM" else "ER", scaled = TRUE, kappa = 1, corStruct = NULL)
x |
a vector or a factor. |
phy |
an object of class "phylo" . |
type |
the type of variable; either "continuous" or
"discrete" (or an abbreviation of these). |
method |
a character specifying the method used for
estimation. Three choices are possible: "ML" , "pic" ,
or "GLS" . |
CI |
a logical specifying whether to return the 95% confidence intervals of the ancestral state estimates (for continuous characters) or the likelihood of the different states (for discrete ones). |
model |
a character specifying the model (ignored if method
= "GLS" ), or a numeric matrix if type = "discrete" (see
details). |
scaled |
a logical specifying whether to scale the contrast
estimate (used only if method = "pic" ). |
kappa |
a positive value giving the exponent transformation of the branch lengths (see details). |
corStruct |
if method = "GLS" , specifies the correlation
structure to be used (this also gives the assumed model). |
If type = "continuous"
, the default model is Brownian motion
where characters evolve randomly following a random walk. This model
can be fitted by maximum likelihood (the default, Schluter et
al. 1997), least squares (method = "pic"
, Felsenstein 1985), or
generalized least squares (method = "GLS"
, Martins and Hansen
1997). In the latter case, the specification of phy
and
model
are actually ignored: it is instead given through a
correlation structure with the option corStruct
.
For discrete characters (type = "discrete"
), only maximum
likelihood estimation is available (Pagel 1994). The model is
specified through a numeric matrix with integer values taken as
indices of the parameters. The numbers of rows and of columns of this
matrix must be equal, and are taken to give the number of states of
the character. For instance, matrix(c(0, 1, 1, 0), 2)
will
represent a model with two character states and equal rates of
transition, matrix(c(0, 1, 2, 0), 2)
a model with unequal
rates, matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3)
a model with
three states and equal rates of transition (the diagonal is always
ignored). There are short-cuts to specify these models: "ER"
is
an equal-rates model (e.g., the first and third examples above),
"ARD"
is an all-rates-different model (the second example), and
"SYM"
is a symmetrical model (e.g., matrix(c(0, 1, 2, 1,
0, 3, 2, 3, 0), 3)
). If a short-cut is used, the number of states
if determined from the data.
a list with the following elements:
ace |
if type = "continuous" , the estimates of the
ancestral character values. |
CI95 |
if type = "continuous" , the estimated 95%
confidence intervals. |
sigma2 |
if type = "continuous" , model = "BM" , and
method = "ML" , the maximum likelihood estimate of the
Brownian parameter. |
rates |
if type = "discrete" , the maximum likelihood
estimates of the transition rates. |
loglik |
if method = "ML" , the maximum log-likelihood. |
lik.anc |
if type = "discrete" , the scaled likelihoods of
each ancestral state. |
call |
the function call. |
The current version (as in ape 1.7) is somehow experimental, and the code has not been thoroughly tested. Any feedback will be welcome!
Emmanuel Paradis paradis@isem.univ-montp2.fr
Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist, 125, 1–15.
Martins, E. P. and Hansen, T. F. (1997) Phylogenies and the comparative method: a general approach to incorporating phylogenetic information into the analysis of interspecific data. American Naturalist, 149, 646–667.
Pagel, M (1994) Detecting correlated evolution on phylogenies: a general method for the comparative analysis of discrete characters. Proceedings of the Royal Society of London. Series B. Biological Sciences, 255, 37–445.
Schluter, D., Price, T., Mooers, A. O. and Ludwig, D. (1997) Likelihood of ancestor states in adaptive radiation. Evolution, 51, 1699–1711.
corBrownian
, corGrafen
,
corMartins
, compar.ou
### Just some random data... data(bird.orders) x <- rnorm(23) ### Compare the three methods for continuous characters: ace(x, bird.orders) ace(x, bird.orders, method = "pic") ace(x, bird.orders, method = "GLS", corStruct = corBrownian(1, bird.orders)) ### For discrete characters: ans <- ace(c(rep(0, 5), rep(1, 18)), bird.orders, type = "d") #### Showing he likelihood of state "1" on each node: plot(bird.orders, type = "c", FALSE) nodelabels(thermo = ans$lik.anc[, 2], cex = 0.75)