fitPagel | R Documentation |
Fits Pagel's (1994) model for the correlated evolution of two binary characters.
fitPagel(tree, x, y, method="fitMk", model="ARD", dep.var="xy", ...)
## S3 method for class 'fitPagel'
plot(x, ...)
tree |
an object of class |
x |
a vector of phenotypic values for a binary trait for the species in |
y |
a second binary character for the species in |
method |
function to use for optimization (defaults to |
model |
model of evolution for the individual characters. Can be |
dep.var |
dependent variable. If |
... |
optional arguments to be passed to |
fitPagel
fits both an independent evolution model, as well as Pagel's (1994) binary dependent model, and compares them with a likelihood-ratio test.
plot.fitPagel
plots the fitted models using arrows.
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.
Liam Revell liam.revell@umb.edu
Pagel, M. (1994) Detecting correlated evolution on phylogenies: A general method for the comparative analysis of discrete characters. Proceedings of the Royal Society B, 255, 37-45.
Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.
ace
, fitMk
, make.simmap
## Not run:
## load data
data(bonyfish.tree)
data(bonyfish.data)
## extract discrete characters
spawning_mode<-setNames(bonyfish.data$spawning_mode,
rownames(bonyfish.data))
paternal_care<-setNames(bonyfish.data$paternal_care,
rownames(bonyfish.data))
## fit correlational model
bonyfish.pagel<-fitPagel(bonyfish.tree,paternal_care,
spawning_mode)
## test for a difference between models
anova(bonyfish.pagel)
## plot fitted models
plot(bonyfish.pagel,lwd.by.rate=TRUE)
## reset par
par(mar=c(5.1,4.1,4.1,2.1),
mfrow=c(1,1))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.