Learn R Programming

phylocurve (version 2.1.1)

ultraFastAnc: Ultra-fast maximum likelihood ancestral state reconstruction

Description

This function performs ancestral state reconstruction using a fast algorithm based on phylogenetically independent contrasts (Felsenstein 1985). Contrary to fastAnc, which reroots the tree at each internal node and recalculates the root state for each tree, this algorithm only requires a single tree traversal (Goolsby, In Review). This function is several hundred to several thousand times faster than the rerooting method used in fastAnc, which is the next-fastest maximum likelihood ancestral state reconstruction method currently described (Revell 2012). As in the fastAnc function, the variance and 95% intervals of estimates are optionally returned.

NOTE: trees with polytomies are supported but (currently) slow down the algorithm considerably.

Usage

ultraFastAnc(phy, x, vars = FALSE, CI = FALSE)

Arguments

phy

A tree of class 'phylo'

x

A named vector of trait values

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

Value

A named vector of maximum likelihood ancestral states (with names corresponding to node number). If vars or CI is set to TRUE, a list is returned with these values included.

References

Goolsby E.W. (In Review). "Ultra-fast ancestral state reconstruction of continuous characters: a rerooting-free maximum likelihood approach."

Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist, 125, 1-15.

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

See Also

fastAnc, ace, pic

Examples

Run this code
# NOT RUN {
require(ape)
tree <- rtree(1e4) # random tree with 10,000 taxa
x <- setNames(rnorm(1e4),tree$tip.label) # random trait data
recon <- ultraFastAnc(phy=tree,x=x,CI=TRUE)
# }

Run the code above in your browser using DataLab