anc.recon: Ultra-fast maximum likelihood ancestral state reconstruction
Description
This function performs ancestral state reconstruction using a fast algorithm based on Ho and Ane (2014).
Usage
anc.recon(trait_data, tree, vars = FALSE, CI = FALSE)
Value
A named vector of maximum likelihood ancestral states (with names corresponding to node names if available or node numbers from the tree rearranged in postorder, as obtained by the command reorder(tree,"postorder")). If vars or CI is set to TRUE, a list is returned with these values included.
Arguments
trait_data
A vector or matrix of trait values. Names or row names correspond to species names. Data cannot have any missing data or within-species variation (this type of data can be handled by the phylopars function).
tree
An object of class phylo.
vars
Whether to return the variances of the restricted maximum likelihood estimates
CI
Whether to return 95% confidence intervals of the restricted maximum likelihood estimates
Author
Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist, 125, 1-15.
Ho L.S.T., Ane C. 2014. A linear-time algorithm for Gaussian and non-Gaussian trait evolution models. Syst. Biol. 63:397-408.
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.
require(ape)
tree <- rtree(10000) # random tree with 10,000 taxax <- setNames(rnorm(1e4),tree$tip.label) # random trait datarecon <- anc.recon(trait_data=x,tree=tree)