mace | R Documentation |
Estimate the ancestral states of multiple traits simultaneously using a regularized maximum likelihood objective.
mace(trait, phy, lambda = NULL)
trait |
a matrix of trait values. Each row is one species and each column is a trait. |
phy |
a phylogenetic tree of type phylo with branch lengths. |
lambda |
regularizer parameter. |
Traits are assumed to evolve according to the Brownian motion model.
a numeric vector of estimated ancestral states.
The default choice for lambda
was proposed by Ho et al. (2019).
Lam Si Tung Ho
Ho, Lam Si Tung, Vu Dinh, and Cuong V. Nguyen. "Multi-task learning improves ancestral state reconstruction." Theoretical Population Biology 126 (2019): 33-39.
m = 3
anc = c(0, 8, 16)
sig2 = c(1, 1, 2)
tree = rtree(50)
trait = rTrait(n = 1, phy = tree, model = "BM",
parameters=list(ancestral.state = anc[1], sigma2 = sig2[1]))
for (i in 2:m) {
trait = cbind(trait,rTrait(n = 1, phy = tree, model = "BM",
parameters=list(ancestral.state = anc[i], sigma2 = sig2[i])))
}
res = mace(trait, tree)
print(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.