Learn R Programming

phytools (version 0.6-60)

fitMk: Fits Mk model

Description

The function fitMk fits a so-called Mk model for discrete character evolution. It is primarily designed to be used inside of make.simmap.

Two plot methods are available. plot.fitMk plots an object of class "fitMk" returned by fitMk. plot.gfit plots an object of class "gfit" from geiger's fitDiscrete function. Both plots portray the fitted model using a graph of arrows connecting states.

The newer function fitmultiMk fits an Mk model in which the transition rates between character states are allowed to vary depending on the mapped state of a discrete character on the tree. It can be combined with, for example, paintSubTree to test hypotheses about how the process of discrete character evolution for x varies between different parts of the tree.

Finally, the function mcmcMk runs a Bayesian MCMC version of fitMk.

Usage

fitMk(tree, x, model="SYM", fixedQ=NULL, ...)
# S3 method for fitMk
plot(x, ...)
# S3 method for gfit
plot(x, ...)
fitmultiMk(tree, x, model="ER", ...)
mcmcMk(tree, x, model="ER", ngen=10000, ...)

Arguments

tree

an object of class "phylo". In the case of fitmultiMk an object of class "simmap" with a mapped discrete character.

x

a vector of tip values for species; names(x) should be the species names. In the case of plot.fitMk, an object of class "fitMk".

model

model. See make.simmap or ace for details.

fixedQ

fixed value of transition matrix Q, if one is desired.

ngen

number of generations of MCMC for mcmcMk.

...

optional arguments, including pi, the prior distribution at the root node (defaults to pi="equal"). For plot method optional arguments include (but may not be limited to): signif, the number of digits for the rates to be plotted; main, a character vector of length two with the headings for each subplot; cex.main, cex.traits, and cex.rates, font sizes for the various text elements of the plot; and show.zeros, a logical argument specifying whether or not to plot arrows with the ML estimated transition rate is not different from zero (with tolerance specified by the optional argument tol).

Value

An object of class "fitMk", "fitmultiMk", or "mcmcMk". In the case of plot.fitMk, a plotted Mk model.

Details

Note that both fitMk and fitmultiMk recycle code from ace in the ape package for computing the likelihood.

References

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

See Also

ace, make.simmap