# Phylogenetic Tools for Comparative Biology (and Other Things)

## Documentation for package ‘phytools’ version 2.5-2

- DESCRIPTION file.

## Help Pages

A B C D E F G H K L M N O P R S T U V W

phytools-package | phytools: Phylogenetic Tools for comparative biology (and other things)

## -- A --

add.arrow | Add an arrow pointing to a tip or node on the tree
add.color.bar | Add color bar to a plot
add.everywhere | Add tip to all edges in a tree
add.random | Add tips at random to the tree
add.simmap.legend | Add legend to stochastically mapped tree
add.species.to.genus | Add species to genus on a phylogeny or bind simulated species subtrees to a backbone genus tree
aic.w | Computes Akaike weights
allFurcTrees | Generate all bi- and multifurcating unrooted trees
allRotations | Rotates a node or set of nodes in a phylogenetic tree
anc.Bayes | Bayesian ancestral character estimation
anc.ML | Ancestral character estimation using likelihood
anc.trend | Ancestral character estimation with a trend
ancr | Compute marginal or joint ancestral state estimates
ancThresh | Ancestral character estimation under the threshold model using Bayesian MCMC
anole.data | Phylogenetic datasets
anoletree | Phylogenetic datasets
ansi_phylo | Graph a phylogeny using only ANSI characters
ant.geog | Phylogenetic datasets
ant.tree | Phylogenetic datasets
applyBranchLengths | Applies the branch lengths of a reference tree to a target
arc.cladelabels | Add labels to subtrees of a plotted phylogeny
as.multiPhylo | Conversion to object of class '"multiPhylo"'
as.multiPhylo.multiSimmap | Conversion to object of class '"multiPhylo"'
as.multiPhylo.phylo | Conversion to object of class '"multiPhylo"'
as.prcomp | Phylogenetic principal components analysis
as.princomp | Phylogenetic principal components analysis
as.Qmatrix | Convert a fitted M_k_ model to a Q-matrix
as.Qmatrix.fitMk | Convert a fitted M_k_ model to a Q-matrix
ave.rates | Average the posterior rates
averageTree | Compute an average tree from a set of trees and related operations

## -- B --

backbone.toPhylo | Converts tree to backbone or vice versa
bat.tree | Phylogenetic datasets
bat_virus.data | Phylogenetic datasets
bd | Convert object of class '"birthdeath"' to raw birth & death rates
betaCoV.tree | Phylogenetic datasets
bind.tip | Attaches a new tip to a tree
bind.tree.simmap | Binds two trees of class '"simmap"'
biplot.phyl.pca | Phylogenetic principal components analysis
bmPlot | Simulates and visualizes continuous trait evolution on a phylogeny
bonyfish.data | Phylogenetic datasets
bonyfish.tree | Phylogenetic datasets
bounded_bm | Fits bounded and wrapped Brownian motion models
branching.diffusion | Animation of branching random diffusion
brownie.lite | Likelihood test for rate variation in a continuous trait
brownieREML | REML version of 'brownie.lite'
butterfly.data | Phylogenetic datasets
butterfly.tree | Phylogenetic datasets

## -- C --

cladebox | Add labels to subtrees of a plotted phylogeny
cladelabels | Add labels to subtrees of a plotted phylogeny
coef.phyl.RMA | Phylogenetic reduced major axis (RMA) regression
collapse.to.star | Collapse a subtree to a star phylogeny
collapseTree | Interactive tree visualizer
compare.chronograms | Compares two chronograms with precisely matching nodes in a visual manner
compute.mr | Matrix representation parsimony supertree estimation
consensus.edges | Compute consensus edges for a tree under some criterion
contMap | Map continuous trait evolution on the tree
cophylo | Creates a co-phylogenetic plot
cordylid.data | Phylogenetic datasets
cordylid.tree | Phylogenetic datasets
cospeciation | Conducts a statistical test of cospeciation between two trees
cotangleplot | Creates a co-phylogenetic plot
countSimmap | Counts the number of character changes on a object of class '"simmap"' or '"multiSimmap"'
ctt | Generates (or simulates) a 'changes through time' plot from a set of stochastic map character histories

## -- D --

darter.tree | Phylogenetic datasets
density.anc.Bayes | Bayesian ancestral character estimation
density.mcmcMk | Fits extended M_k_ model for discrete character evolution
density.multiSimmap | Computes a posterior distribution for the number and types of changes on the tree
densityMap | Plot posterior density of stochastic mapping on a tree
densityTree | Plots a posterior sample of trees
describe.simmap | Summarizes a stochastic mapped tree or set of trees
di2multi.contMap | Collapse or resolve polytomies in a tree with a character painted on the edges
di2multi.densityMap | Collapse or resolve polytomies in a tree with a character painted on the edges
di2multi.multiSimmap | Collapse or resolve polytomies in a tree with a character painted on the edges
di2multi.simmap | Collapse or resolve polytomies in a tree with a character painted on the edges
dot.legend | Creates a phylogenetic dot plot
dotTree | Creates a phylogenetic dot plot
drop.clade | Drop a clade from a tree
drop.leaves | Drop all the leaves (tips) from a tree
drop.tip.contMap | Drop tip or tips from an object of class '"contMap"' or '"densityMap"'
drop.tip.densityMap | Drop tip or tips from an object of class '"contMap"' or '"densityMap"'
drop.tip.multiSimmap | Drop or keep tip or tips from an object of class '"multiSimmap"'
drop.tip.simmap | Drop tips or extract clade from tree with mapped discrete character
drop.tip.singleton | Converts a tree without singletons to a tree with singleton nodes
Dtest | Conducts correlational D-test from stochastic mapping

## -- E --

edge.widthMap | Map continuous trait evolution on the tree
edgelabels.cophylo | Add labels to a plotted "cophylo" object
edgeProbs | Compute the relative frequencies of state changes along edges
eel.data | Phylogenetic datasets
eel.tree | Phylogenetic datasets
elapidae.tree | Phylogenetic datasets
errorbar.contMap | Map continuous trait evolution on the tree
estDiversity | Estimate diversity at each node of the tree
evol.rate.mcmc | Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogeny
evol.vcv | Likelihood test for variation in the evolutionary variance-covariance matrix
evolvcv.lite | Likelihood test for a shift in the evolutionary correlation between traits
exhaustiveMP | Exhaustive and branch & bound MP optimization
expand.clade | Expands (or contracts) the tip-spacing of a given clade or clades
export.as.xml | Export trees & data in XML format
extract.clade.simmap | Drop tips or extract clade from tree with mapped discrete character
extract.strahlerNumber | Computes Strahler number for trees and nodes

## -- F --

fancyTree | Plots special types of phylogenetic trees
fastAnc | (Reasonably) fast estimation of ML ancestral states
fastBM | (Reasonably) fast quantitative trait simulation on phylogenies
fastDist | Get the MRCA (or height above the root of the MRCA) of a pair of tip taxa
fastHeight | Get the MRCA (or height above the root of the MRCA) of a pair of tip taxa
fastMRCA | Get the MRCA (or height above the root of the MRCA) of a pair of tip taxa
findMRCA | Get the MRCA of a set of taxa
fit.bd | Fits birth-death (speciation/extinction) model to reconstructed phylogeny
fit.yule | Fits birth-death (speciation/extinction) model to reconstructed phylogeny
fitBayes | Evolutionary model fitting with intraspecific variability using Bayesian MCMC
fitcontMk | Fits binary discrete character evolution model where the transition rate varies as a function of a continuous trait
fitDiversityModel | Fit diversity-dependent phenotypic evolution model
fitfnMk | Fits extended M_k_ model for discrete character evolution
fitgammaMk | Fits extended M_k_ model for discrete character evolution
fitHRM | Fits extended M_k_ model for discrete character evolution
fitMk | Fits extended M_k_ model for discrete character evolution
fitMk.parallel | Fits extended M_k_ model for discrete character evolution
fitmultiBM | Fits multi-rate (or multi-trend) discrete character dependent continuous trait evolution
fitmultiMk | Fits extended M_k_ model for discrete character evolution
fitmultiTrend | Fits multi-rate (or multi-trend) discrete character dependent continuous trait evolution
fitPagel | Function to test for correlated evolution of binary traits
fitpolyMk | Fits extended M_k_ model for discrete character evolution
fitsemiThresh | Fits binary, multi-state, and semi-threshold models using the discretized diffusion approximation
fitThresh | Fits binary, multi-state, and semi-threshold models using the discretized diffusion approximation
flatworm.data | Phylogenetic datasets
flatworm.tree | Phylogenetic datasets
force.ultrametric | Coerces a phylogenetic tree to be ultrametric

## -- G --

gammatest | gamma test of Pybus & Harvey (2000)
gamma_pruning | Internally used function
genSeq | Simulate a DNA alignment on the tree under a model
genus.to.species.tree | Add species to genus on a phylogeny or bind simulated species subtrees to a backbone genus tree
geo.legend | Adds a geological (or other temporal) legend to a plotted tree
geo.palette | Adds a geological (or other temporal) legend to a plotted tree
get.treepos | Get position or node of a plotted tree interactively
getCladesofSize | Get all subtrees larger than or equal to a specified size
getDescendants | Get descendant node numbers
getExtant | Returns a list of the extant or extinct lineages in a tree containing non-contemporaneous tips
getExtinct | Returns a list of the extant or extinct lineages in a tree containing non-contemporaneous tips
getnode | Get position or node of a plotted tree interactively
getParent | Get descendant node numbers
getSisters | Get the sister node number, label, or set of nodes for a node or tip
getStates | Get the states at nodes or tips from a mapped tree
graph.polyMk | Fits extended M_k_ model for discrete character evolution
gtt | Creates lineage-through-time plot (including extinct lineages)

## -- H --

hide.hidden | Compute marginal or joint ancestral state estimates

## -- K --

keep.tip.contMap | Drop tip or tips from an object of class '"contMap"' or '"densityMap"'
keep.tip.densityMap | Drop tip or tips from an object of class '"contMap"' or '"densityMap"'
keep.tip.multiSimmap | Drop or keep tip or tips from an object of class '"multiSimmap"'
keep.tip.simmap | Drop tips or extract clade from tree with mapped discrete character

## -- L --

labelnodes | Function to interactively label nodes of a plotted tree
ladderize.simmap | Ladderize a tree with a mapped discrete character
lambda.transform | lambda transformation of matrix
lik.bd | Fits birth-death (speciation/extinction) model to reconstructed phylogeny
likMlambda | Likelihood for joint lambda
likSurface.rateshift | Find the temporal position of one or more rate shifts
linklabels | Function to add tip labels to a plotted tree with linking lines
liolaemid.data | Phylogenetic datasets
liolaemid.tree | Phylogenetic datasets
locate.fossil | Locate a fossil lineage in a tree using continuous characters
locate.yeti | Locate a cryptic, recently extinct, or missing taxon on a tree
logLik.fitDiversityModel | Fit diversity-dependent phenotypic evolution model
ls.consensus | Compute an average tree from a set of trees and related operations
ls.tree | Least squares branch lengths for a given tree
ltt | Creates lineage-through-time plot (including extinct lineages)
ltt.multiPhylo | Creates lineage-through-time plot (including extinct lineages)
ltt.multiSimmap | Creates lineage-through-time plot (including extinct lineages)
ltt.phylo | Creates lineage-through-time plot (including extinct lineages)
ltt.simmap | Creates lineage-through-time plot (including extinct lineages)
ltt95 | Creates a (1-alpha)% CI for a set of LTTs

## -- M --

make.era.map | Create "era" map on a phylogenetic tree
make.simmap | Simulate stochastic character maps on a phylogenetic tree or trees
make.transparent | Plots a posterior sample of trees
mammal.data | Phylogenetic datasets
mammal.geog | Phylogenetic datasets
mammal.tree | Phylogenetic datasets
Map.Overlap | Proportional overlap between two mapped character histories on a tree
map.overlap | Proportional overlap between two mapped character histories on a tree
map.to.singleton | Converts a tree without singletons to a tree with singleton nodes
mapped.states | Returns a vector, matrix, or list of the mapped states on a tree or set of trees
markChanges | Add marked changes to a plotted tree with mapped discrete character
matchLabels | Matches nodes between two trees
matchNodes | Matches nodes between two trees
mccr | Creates lineage-through-time plot (including extinct lineages)
mcmcMk | Fits extended M_k_ model for discrete character evolution
mergeMappedStates | Merge two or more mapped states into one state
midpoint.root | Midpoint root a phylogeny
midpoint_root | Midpoint root a phylogeny
minRotate | Rotates all nodes of the tree to minimize the difference in order with a vector
minSplit | Finding the minimum (median) split in the posterior sample
minTreeDist | Compute an average tree from a set of trees and related operations
modified.Grafen | Computes modified Grafen edge lengths
mrp.supertree | Matrix representation parsimony supertree estimation
multi.mantel | Multiple matrix regression (partial Mantel test)
multi2di.contMap | Collapse or resolve polytomies in a tree with a character painted on the edges
multi2di.densityMap | Collapse or resolve polytomies in a tree with a character painted on the edges
multi2di.multiSimmap | Collapse or resolve polytomies in a tree with a character painted on the edges
multi2di.simmap | Collapse or resolve polytomies in a tree with a character painted on the edges
multiC | Returns a list with phylogenetic VCV matrix for each mapped state
multiOU | Brownian or OU simulation with multiple evolutionary regimes
multirateBM | Function to fit a multi-rate Brownian evolution model
multiRF | Computes Robinson-Foulds distance between a set of trees

## -- N --

node.paths | Computes modified Grafen edge lengths
nodeheight | Compute the heights above the root of each node
nodeHeights | Compute the heights above the root of each node
nodelabels.cophylo | Add labels to a plotted "cophylo" object

## -- O --

optim.phylo.ls | Phylogeny inference using the least squares method
orderMappedEdge | Order the columns of 'mapped.edge' to match across trees

## -- P --

paintBranches | Paint sub-trees with a discrete character
paintSubTree | Paint sub-trees with a discrete character
paste.tree | Paste two trees together
pbtree | Simulate pure-birth or birth-death stochastic tree or trees
pgls.Ives | Phylogenetic regression with intraspecific sampling error
pgls.SEy | Phylogenetic regression with intraspecific sampling error
phenogram | Plot traitgram (phenogram)
phenogram95 | Plots special types of phylogenetic trees
phyl.cca | Phylogenetic canonical correlation analysis
phyl.pairedttest | Phylogenetic paired _t_-test
phyl.pca | Phylogenetic principal components analysis
phyl.resid | Phylogenetic size-correction via GLS regression
phyl.RMA | Phylogenetic reduced major axis (RMA) regression
phyl.vcv | Compute evolutionary VCV matrix for a tree & dataset
phylANOVA | Phylogenetic ANOVA and post-hoc tests
phylo.heatmap | Creates a phylogenetic heat map
phylo.impute | Phylogenetic imputation for multivariate continuous character data
phylo.to.map | Plot tree with tips linked to geographic coordinates
phylo.toBackbone | Converts tree to backbone or vice versa
phyloDesign | Compute design matrix for least squares analyses
phylomorphospace | Creates phylomorphospace plot
phylomorphospace3d | Creates three-dimensional phylomorphospace plot
phyloScattergram | Plots special types of phylogenetic trees
phylosig | Compute phylogenetic signal with two methods
phytools | phytools: Phylogenetic Tools for comparative biology (and other things)
plot.anc.Bayes | Bayesian ancestral character estimation
plot.ancr | Compute marginal or joint ancestral state estimates
plot.backbonePhylo | Plots backbone tree with triangles as clades
plot.changesMap | Computes a posterior distribution for the number and types of changes on the tree
plot.contMap | Map continuous trait evolution on the tree
plot.cophylo | Creates a co-phylogenetic plot
plot.cospeciation | Conducts a statistical test of cospeciation between two trees
plot.density.mcmcMk | Fits extended M_k_ model for discrete character evolution
plot.densityMap | Plot posterior density of stochastic mapping on a tree
plot.describe.simmap | Summarizes a stochastic mapped tree or set of trees
plot.edge.widthMap | Map continuous trait evolution on the tree
plot.expand.clade | Expands (or contracts) the tip-spacing of a given clade or clades
plot.fitHRM | Fits extended M_k_ model for discrete character evolution
plot.fitMk | Fits extended M_k_ model for discrete character evolution
plot.fitPagel | Function to test for correlated evolution of binary traits
plot.fitpolyMk | Fits extended M_k_ model for discrete character evolution
plot.gfit | Fits extended M_k_ model for discrete character evolution
plot.ltt95 | Creates a (1-alpha)% CI for a set of LTTs
plot.mcmcMk | Fits extended M_k_ model for discrete character evolution
plot.multiSimmap | Plot stochastic character mapped tree
plot.phyl.RMA | Phylogenetic reduced major axis (RMA) regression
plot.phylo.to.map | Plot tree with tips linked to geographic coordinates
plot.phylosig | Compute phylogenetic signal with two methods
plot.Qmatrix | Convert a fitted M_k_ model to a Q-matrix
plot.rateshift | Find the temporal position of one or more rate shifts
plot.simBMphylo | Creates a graphical illustration of Brownian motion evolution on a phylogeny
plot.simmap | Plot stochastic character mapped tree
plot.summary.evol.rate.mcmc | Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogeny
plotBranchbyTrait | Plot branch colors by a quantitative trait or value
plotFanTree.wTraits | Plot a tree with a discrete (or continuous) character data matrix at the tips
plotSimmap | Plot stochastic character mapped tree
plotThresh | Tree plotting with posterior probabilities of ancestral states from the threshold model
plotTree | Plots rooted phylogenetic tree
plotTree.barplot | Plot a tree with bars at the tips
plotTree.boxplot | Plot a tree with bars at the tips
plotTree.datamatrix | Plot a tree with a discrete (or continuous) character data matrix at the tips
plotTree.errorbars | Plot a tree with error bars around divergence dates
plotTree.lollipop | Plot a tree with one or more matched lollipop plots
plotTree.singletons | Converts a tree without singletons to a tree with singleton nodes
plotTree.splits | Plots a phylogeny in two columns
plotTree.wBars | Plot a tree with bars at the tips
posterior.evolrate | Analysis of the posterior sample from evol.rate.mcmc
posthoc | Generic post-hoc test
posthoc.ratebytree | Likelihood test for rate variation among trees, clades, or traits
primate.data | Phylogenetic datasets
primate.tree | Phylogenetic datasets
print.backbonePhylo | Print method for backbone phylogeny
print.cospeciation | Conducts a statistical test of cospeciation between two trees
print.evol.rate.mcmc | Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogeny
print.fit.bd | Fits birth-death (speciation/extinction) model to reconstructed phylogeny
print.fitDiversityModel | Fit diversity-dependent phenotypic evolution model
print.Qmatrix | Convert a fitted M_k_ model to a Q-matrix
print.summary.evol.rate.mcmc | Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogeny
project.phylomorphospace | Creates phylomorphospace plot
pscore | Compute the parsimony score

## -- R --

ratebystate | Method for investigating the rate of one trait as a function of the state of another
ratebytree | Likelihood test for rate variation among trees, clades, or traits
rateshift | Find the temporal position of one or more rate shifts
read.newick | Newick or Nexus style tree reader
read.simmap | Read SIMMAP style trees from file
readNexus | Newick or Nexus style tree reader
reorder.backbonePhylo | Reorders a backbone phylogeny
reorderSimmap | Reorder edges of a '"simmap"' tree
rep.multiPhylo | Replicate a tree or set of trees
rep.phylo | Replicate a tree or set of trees
repPhylo | Replicate a tree or set of trees
reroot | Re-root a tree along an edge
rerootingMethod | Get marginal ancestral state reconstructions by re-rooting
rescale | Rescale phylogenetic objects of different types
rescale.multiSimmap | Rescale object of class '"simmap"'
rescale.simmap | Rescale object of class '"simmap"'
rescaleSimmap | Rescale object of class '"simmap"'
resolveAllNodes | Compute all possible resolutions of a node or all nodes in a multifurcating tree
resolveNode | Compute all possible resolutions of a node or all nodes in a multifurcating tree
rootedge.to.singleton | Converts a tree without singletons to a tree with singleton nodes
rotate.multi | Rotates a node or set of nodes in a phylogenetic tree
rotateNodes | Rotates a node or set of nodes in a phylogenetic tree
roundBranches | Rounds the branch lengths of a tree
roundPhylogram | Plot a round, sigmoidal, or spline phylogram or cladogram
rstate | Pick a random state according to a vector of probabilities

## -- S --

salamanders | Phylogenetic datasets
sampleFrom | Sample from a set of distributions
scores | Phylogenetic principal components analysis
scores.phyl.pca | Phylogenetic principal components analysis
setMap | Set color map for various phylogenetic objects of classes
setMap.contMap | Set color map for various phylogenetic objects of classes
setMap.densityMap | Set color map for various phylogenetic objects of classes
setMap.multirateBM_plot | Set color map for various phylogenetic objects of classes
setMap.phyloScattergram | Set color map for various phylogenetic objects of classes
sigmoidPhylogram | Plot a round, sigmoidal, or spline phylogram or cladogram
sim.absorbing | Simulates and visualizes continuous trait evolution on a phylogeny
sim.corrs | Multivariate Brownian simulation with multiple correlations and rates
sim.ctt | Generates (or simulates) a 'changes through time' plot from a set of stochastic map character histories
sim.history | Simulate character history or a discrete character at the tips of the tree under some model
sim.Mk | Simulate character history or a discrete character at the tips of the tree under some model
sim.multiCtt | Generates (or simulates) a 'changes through time' plot from a set of stochastic map character histories
sim.multiMk | Simulate character history or a discrete character at the tips of the tree under some model
sim.multiTrend | Simulates and visualizes continuous trait evolution on a phylogeny
sim.ratebystate | Conduct simulation of state dependent rate variation
sim.rates | Brownian or OU simulation with multiple evolutionary regimes
sim.reflective | Simulates and visualizes continuous trait evolution on a phylogeny
simBMphylo | Creates a graphical illustration of Brownian motion evolution on a phylogeny
simmap | Simulate stochastic character maps on a phylogenetic tree or trees
skewers | Matrix comparison using the method of random skewers
splinePhylogram | Plot a round, sigmoidal, or spline phylogram or cladogram
splitEdgeColor | Split edge colors when descendant edges have different mapped states
splitplotTree | Plots a phylogeny in two columns
splitTree | Split tree at a point
starTree | Create star phylogeny
strahlerNumber | Computes Strahler number for trees and nodes
summary.evol.rate.mcmc | Bayesian MCMC method for identifying exceptional phenotypic diversification in a phylogeny
summary.multiSimmap | Summarizes a stochastic mapped tree or set of trees
summary.simmap | Summarizes a stochastic mapped tree or set of trees
sunfish.data | Phylogenetic datasets
sunfish.tree | Phylogenetic datasets

## -- T --

threshBayes | Threshold model using Bayesian MCMC
threshDIC | Deviance Information Criterion from the threshold model
threshState | Computes value for a threshold character from a liability and thresholds
tiplabels.cophylo | Add labels to a plotted "cophylo" object
tipRotate | Rotates all nodes of the tree to minimize the difference in order with a vector
to.matrix | Convert a character vector to a binary matrix
tortoise.geog | Phylogenetic datasets
tortoise.tree | Phylogenetic datasets
tree.grow | Creates an animation of a tree growing from left-to-right or upwards
treeSlice | Slices the tree at a particular point and returns all subtrees, or the tree rootward of the point
tropidurid.data | Phylogenetic datasets
tropidurid.tree | Phylogenetic datasets

## -- U --

untangle | Attempts to untangle crossing branches for plotting

## -- V --

vcvPhylo | Calculates cophenetic (i.e., phylogenetic VCV) matrix
vertebrate.data | Phylogenetic datasets
vertebrate.tree | Phylogenetic datasets

## -- W --

wasp.data | Phylogenetic datasets
wasp.trees | Phylogenetic datasets
whale.tree | Phylogenetic datasets
write.simmap | Write a stochastic character mapped tree to file
writeAncestors | Write a tree to file with ancestral states and (optionally) CIs at nodes
writeNexus | Write a tree to file in Nexus format