Learn R Programming

expoTree (version 1.0.1)

runExpoTree: Density-dependent likelihood caluculation

Description

Calculates the density dependent likelihood of a phylogenetic tree. It takes branching and sampling times as an argument and integrates the likelihoood function over the whole tree.

Usage

runExpoTree(pars,times,ttypes,survival=TRUE,shifts=NULL,vflag=0, return.full=FALSE,rescale=TRUE,root.lineages=0)

Arguments

pars
Matrix of parameters. If the number of columns is larger than 5, only the first 5 columns are used. Each row is of the form c(N,beta,mu,psi,rho). The rows correspond to rate shifts.
times
Vector of event times.
ttypes
Vector of event types.
survival
Condition on the likelihood of observing the tree.
shifts
Times of rate shifts.
vflag
Verbosity level.
return.full
Return full probability vector rather than just the entry for I=1.
rescale
Rescale probability vector in the calculation. Avoids some numerical issues.
root.lineages
Number of lineages that are extant at the 'root' of the tree.

Value

Log-Likelihood or vector of log-likelihoods.

Details

Parameter matrix:

N = Total population size. Must be at least the maximal number of extant lineages at any given time.

beta = Branching rate. For epidemic trees, this is the infection rate. For species trees, this is the speciation rate.

mu = Extinction rate. For epidemic trees, this is the death/recovery rate. For species trees, this is the extinction rate.

psi = Sampling rate.

rho = Initial sampling rate.

References

Leventhal, Guenthard, Bonhoeffer & Stadler, 2013

See Also

expoTree

Examples

Run this code
times <- cumsum(runif(10))
ttypes <- rep(1,10)

N <- 15
beta <- 1
mu <- 0.1
psi <- 0
rho <- 1
pars <- matrix(c(N,beta,mu,psi,rho),nrow=1)
lik <- runExpoTree(pars,times,ttypes)

Run the code above in your browser using DataLab