bmPlot: Simulates and visualizes discrete-time Brownian evolution on a phylogeny
Description
This function conducts discrete-time Brownian motion simulation on an input tree, plots the outcome, and returns the tip and internal node states to the user as a named vector. The function will first rescale and round the branch lengths to integer length. If integer branch lengths are provided, the user should also set ngen=max(nodeHeights(tree)). For type="threshold" the visualization is of the threshold model (Felsenstein 2012), in which the evolving character is liability and the segements of evolution are colored by their value for the threshold trait. If type="threshold" is used, the function requires at least one addition input: thresholds, a vector containing the ordered thresholds between states. The user can also provide the colors for plotting in cols. Note that one more color than threshold should be provided as one threshold implies two states; two thresholds, three states; etc. If no value for cols is provided, the function will recycle a set of four colors up to the number of times required by thresholds.
the BM rate (variance of the Brownian evolution process).
ngen
number of generations for the simulation: will rescale the tree to this total length.
...
arguments to be passed to different methods.
Value
This function conducts and plots discrete time Brownian simulation and returns a vector containing the simulated states at internal nodes and tips of the tree.
References
Felsenstein, J. 2012. A comparative method for both discrete and continuous characters using the threshold model. American Naturalist, 179, 145-156.
# plot BM simulation on 20 taxon tree tree<-pbtree(n=20)
x<-bmPlot(tree)
# plot simulation of a threshold character tree<-pbtree(n=20)
x<-bmPlot(tree,type="threshold",thresholds=c(0,1,2))