rerootingMethod: Get marginal ancestral state reconstructions by re-rooting

Description Usage Arguments Details Value Author(s) References See Also

View source: R/rerootingMethod.R


This function uses the re-rooting method of Yang et al. (1995) to get the marginal ancestral state estimates for each internal node of the tree using likelihood. This method get the conditional scaled likelihoods for the root node (which is the same as the marginal ancestral state reconstruction for that node) and successively moves the root to each node in the tree. The function can also return the posterior probabilities for the tip nodes of the tree.


rerootingMethod(tree, x, model=c("ER","SYM"), ...)



an object of class "phylo".


a vector of tip values for species, or a matrix containing the prior probability that the tip is in each state. If x is a vector, then names(x) should be the species names. If x is a matrix of prior probabilities, then rownames should be species names, column names should be states for the discrete character, and rows of the matrix should sum to 1.0.


any revsersible model. model=c("ER","SYM") recommended.


optional arguments. Presently the logical argument tips. If tips=TRUE, then the function will also compute the empirical Bayes posterior probabilities of the tips following Yang (2006). Note that ... is passed internally to fitMk, but should be used in this way with caution because any arguments that conflict with the default arguments of the method will cause the function execution to fail. The most practical use of this would be to force a particular value of the transition matrix, Q, via the argument fixedQ.


This function calls fitMk internally. fitMk uses some code adapted from ace in the ape package.

print and plot methods are now available for the object class.


An object of class "rerootingMethod" containing at least the following elements:


the log-likelihood.


the fitted transition matrix between states.


the marginal ancestral state reconstructions for each node (and, optionally, each tip).


Liam Revell [email protected]


Paradis, E., J. Claude, and K. Strimmer (2004) APE: Analyses of phylogenetics and evolution in R language. Bioinformatics, 20, 289-290.

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

Yang, Z., Kumar, S., Nei, M. (1995) A new method of inference of ancestral nucleotide and amino acid sequences. Genetics, 141, 1641-1650.

See Also

ace, fitMk, make.simmap

liamrevell/phytools documentation built on Sept. 30, 2018, 1:41 a.m.