sim.history {phytools} | R Documentation |
This function simulates a stochastic character history for a discretely valued character trait on the tree. The resultant tree is stored as a modified "phylo"
object in stochastic character map (e.g., make.simmap
) format.
sim.history(tree, Q, anc=NULL, nsim=1, ...)
tree |
a phylogenetic tree as an object of class |
Q |
a matrix containing the instantaneous transition rates between states. Note that normally this is the transpose of the matrix produced by |
anc |
an optional value for the state at the root node; if |
nsim |
number of simulations. |
... |
other optional arguments. Currently only |
A modified phylogenetic tree of class "phylo"
(or a modified "multiPhylo"
object, for nsim
> 1) with the following additional elements:
maps |
a list of named vectors containing the times spent in each state on each branch, in the order in which they occur. |
mapped.edge |
a matrix containing the total time spent in each state along each edge of the tree. |
states |
a vector containing the tip states. |
node.states |
a matrix containing the states at internal & terminal nodes (according to the dimensions of |
Liam Revell liam.revell@umb.edu
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.
make.simmap
, read.simmap
, plotSimmap
, sim.rates