Learn R Programming

phytools (version 0.2-1)

fastAnc: Fast estimation of ML ancestral states

Description

This function performs fast estimation of the ML ancestral states for a continuous trait by taking advantage of the fact that the state computed for the root node of the tree during Felsenstein's (1985) contrasts algorithm is also the MLE of the root node. Thus, the function reroots the tree at all internal nodes and computes the contrasts state at the root each time.

Usage

fastAnc(tree, x)

Arguments

tree
an object of class "phylo".
x
a vector of tip values for species; names(x) should be the species names.

Value

  • a named vector containing the states at internal nodes - names are node numbers.

See Also

ace, anc.Bayes, anc.ML, pic

Examples

Run this code
tree<-rtree(50)
x<-fastBM(tree) # simulate using fastBM
fastAnc(tree,x) # estimate states

Run the code above in your browser using DataLab