Learn R Programming

phytools (version 0.7-70)

fitPagel: Function to test for correlated evolution of binary traits

Description

This function fit's Pagel's (1994) model for the correlated evolution of two binary characters.

plot.fitPagel plots the fitted models using arrows.

Usage

fitPagel(tree, x, y, method="fitMk", model="ARD", dep.var="xy", ...)
# S3 method for fitPagel
plot(x, ...)

Arguments

tree

an object of class "phylo".

x

a vector of phenotypic values for a binary trait for the species in tree; or a matrix in which the rows of x give the probability of being in each column state. (The latter option is only supported for method="fitMk".) For S3 plot method, an object of class "fitPagel".

y

a second binary character for the species in tree; or a matrix in which the rows give the probability of being in each column state.

method

function to use for optimization (defaults to method="fitMk"). Other options are "ace" to use the ace function in ape for optimization, or to "fitDiscrete" (if the geiger package is installed) to use geiger's fitDiscrete for optimization.

model

model of evolution for the individual characters. Can be model="ER", "SYM" (equivalent to "ER" in this case), and "ARD".

dep.var

dependent variable. If dep.var="xy" than the rate of subsitution in x depends on y & vice versa. If dep.var="x" than the substitution rate in x depends on y, but not the converse. Finally, if dep.var="y" than the rate of substitution in y depends on x, but not the converse.

...

optional arguments to be passed to fitMk, ace, or fitDiscrete. 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.sub, cex.traits, and cex.rates, font sizes for the various text elements of the plot; and lwd.by.rate, a logical argument specifying whether or not to scale arrow line widths in proportion to the estimated rates.

Value

An object of class "fitPagel" which contains the optimized matrices under an independence & a dependence model, log-likelihoods, a likelihood ratio, and a P-value for the independence model based on a chi-squared test.

plot.fitPagel creates a plot showing the different fitted models with arrows.

References

Pagel, M. (1994) Detecting correlated evolution on phylogenies: A general method for the comparative analysis fo discrete characters. Proceedings of the Royal Society B, 255, 37-45.

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

See Also

ace, fitMk, make.simmap