fit.bd: Fits birth-death (speciation/extinction) model to...

View source: R/bd.R

fit.bdR Documentation

Fits birth-death (speciation/extinction) model to reconstructed phylogeny

Description

Fits a birth-death (fit.bd) or pure-birth (fit.yule) model to a reconstructed phylogenetic tree with branch lengths.

Usage

fit.bd(tree, b=NULL, d=NULL, rho=1, ...)
fit.yule(tree, b=NULL, d=NULL, rho=1, ...)
lik.bd(theta, t, rho=1, N=NULL)
## S3 method for class 'fit.bd'
print(x, ...)

Arguments

tree

object of class "phylo".

b

birth (speciation) rate. Presently doesn't do anything as the rate cannot be fixed.

d

death (extinction) rate. Presently doesn't do anything as the rate cannot be fixed.

rho

sampling fraction.

theta

vector of b and d for likelihood function.

t

branching times for calculation of the likelihood.

N

number of tips in the tree.

x

object of class "fit.bd" for print method.

...

optional arguments.

Details

The function fit.bd fits a birth-death model to a phylogenetic tree with edge lengths and a (potentially) incomplete sampling fraction.

The function fit.yule fits a pure-birth model with a (potentially) incomplete sampling fraction.

The function lik.bd computes the likelihood of a set of birth & death rates given the set of branching times computed for a tree and a sampling fraction.

Value

fit.bd returns an object of class "fit.bd" which can be printed. This object is a list containing the fitted model parameters, likelihood, optimization conditions, a summary of the optimization, and a likelihood function.

fit.yule returns an object of class "fit.yule". This object is a list containing the fitted model parameter, likelihood, optimization conditions, a summary of the optimization, and a likelihood function.

Author(s)

Liam Revell liam.revell@umb.edu

References

Nee, S., May, R. M. and Harvey, P. H. (1994) The reconstructed evolutionary process. Philosophical Transactions of the Royal Society of London B, 344, 305-311.

Revell, L. J. (2024) phytools 2.0: an updated R ecosystem for phylogenetic comparative methods (and other things). PeerJ, 12, e16505.

Stadler, T. (2012) How can we improve the accuracy of macroevolutionary rate estimates? Systematic Biology, 62, 321-329.

See Also

birthdeath

Examples

data(salamanders)
## compute sampling fraction based on 55 species of Plethodon
sampling.f<-Ntip(salamanders)/55
## fit birth-death model
bd.fit<-fit.bd(salamanders,rho=sampling.f)
print(bd.fit)
## fit Yule model
yule.fit<-fit.yule(salamanders,rho=sampling.f)
print(yule.fit)
## compare b-d and yule models
anova(yule.fit,bd.fit)
## create a likelihood surface for b-d model
ngrid<-100
b<-seq(0.01,0.06,length.out=ngrid)
d<-seq(0.005,0.03,length.out=ngrid)
logL<-sapply(d,function(d,b) sapply(b,function(b,d) 
    bd.fit$lik(c(b,d)),d=d),b=b)
contour(x=b,y=d,logL,nlevels=100,
    xlab=expression(lambda),
    ylab=expression(mu),bty="l")
title(main="Likelihood surface for plethodontid diversification",
    font.main=3)
points(bd.fit$b,bd.fit$d,cex=1.5,pch=4,
    col="blue",lwd=2)
legend("bottomright","ML solution",pch=4,col="blue",
    bg="white",pt.cex=1.5,pt.lwd=2)

phytools documentation built on June 22, 2024, 10:39 a.m.