View source: R/likelihood_bdRho.R
likelihood_bdRho | R Documentation |
Computes the log likelihood of a rooted ultrametric phylogeny under a constant-time homogeneous birth-death model and Bernoulli sampling. The birth-death process is conditioned on the starting time of the process tottime
and the survival of the process at present time. The log likelihood can be calculated specifying the sampling probability or integrating over it according to a specified sampling probability distribution (either uniform: unif = TRUE
or beta distribution: beta = TRUE
). This function can computes the log likelihood on a stem or crown phylogeny or a set of phylogenies assuming common or specific diversification rates. It is by default parametrised on the net diversification rate and the turnover rate but can be reparametrised on the product y*λ and the net diversification rate r. This function is specifically adapted for diversification analysis on phylogenies on which the sampling probability is unknown.
likelihood_bdRho( tottime, nbtips, tj, yj, reparam = FALSE, beta, unif, root, dt, rel.tol, tuned_dichotomy, brk )
tottime |
Numeric vector. The stem or crown age (also called MRCA) of the phylogenie(s) depending on the conditioning of the process specified (see |
nbtips |
Integer. The number of extant sampled tips in the phylogeny typically noted |
tj |
List of numeric vector(s). A list of atomic numeric vectors where each vector is specifying the node depths for each phylogeny. If only one phylogeny is used, the list is of length 1. The node depths of a phylogeny can be computed using |
yj |
Numeric vector. The sampling probabilitie(s) typically calculated as k/N where |
reparam |
Logical. If |
beta |
Logical. This argument is only used if |
unif |
Logical. This argument is only used if |
root |
Integer. Specifying the conditioning of the birth-death process. |
dt |
Numeric. This argument is only used if |
rel.tol |
Numeric. This argument is only used if |
tuned_dichotomy |
Logical. This argument is only used if |
brk |
Numeric. This argument is only used if |
This function is a closure, it takes all of the above as arguments and creates another function with arguments depending on the birth-death model chosen:
If a unique phylogeny is used and the corresponding sampling probability is given in yj
, then the classical birth-death-sampling model is used and the function created takes div
: the net diversification rate and turn
: the turnover rate as arguments.
If a unique phylogeny is used, yj = NULL
and the log likelihood is set for being reparametrised reparam = TRUE
, then the reparametrised birth-death-sampling model is used and the function created takes div
: the net diversification rate and ylamb
: the product of the sampling probability and speciation rate y*λ as arguments.
If a unique phylogeny is used, yj = NULL
and reparam = FALSE
, then the birth-death∫ρ model is used and the function created takes tun.init
: the initial tuning parameters values and seqphy.init
: the phylogenies number for which to use the corresponding tuning parameter (1 for a unique phylogeny). This former function creates another function that takes as argument div
: the net diversification rate, turn
: the turnover rate, and hyperparameters of the sampling probabilitie(s) distribution a
: the first argument of the sampling probabilitie(s) distribution chosen and b
: the second argument of the sampling probabilitie(s) distribution chosen (see phi
for more details).
If a set of phylogenies are used for computing the log likelihood then all the parameters (except the one relatives to the hyperparameters of the sampling probabilitie(s) distribution described above): div
, turn
, ylamb
, tun.init
and seqphy.init
have to be of length the number of phylogenies used.
This function is specifically intended to be used on phylogenies with unknown or highly uncertain global diversity estimates (the sampling probability is not known with accuracy). Note that the sampling probability is never estimated and that this function is not able to evaluate negative rates.
Returns an object of class function
. This function can take the following arguments (as described above depending on the chosen model) and will return the value of the log likelihood alone or in a list together with the tuning parameters values (for the birth-death∫ρ model):
Numeric vector. The net diversification rate(s) also called r. The length of the numeric vector equals the number of phylogenie(s) used.
Numeric vector. The turnover rate(s) also called ε. The length of the numeric vector equals the number of phylogenie(s) used.
Numeric vector. The product of the sampling probabilitie(s) and speciation rates y*λ also called c in Stadler 2009. The length of the numeric vector equals the number of phylogenie(s) used.
Numeric vector. The initial tuning parameters values. Typically, it will take the value log(1). The length of the numeric vector equals the number of phylogenie(s) used.
Integer vector. A regular sequence of the number of phylogenie(s) used, i.e. if 10 phylogenies are used seqphy.init = c(1:10)
Numeric. The value of α or a respectively for the beta or the uniform distribution. This value cannot be negative for both distributions and cannot exceed b and 1 for the uniform distribution.
Numeric. The value of β or b respectively for the beta or the uniform distribution. This value cannot be negative for both distributions, cannot be inferior to a and cannot exceed 1 for the uniform distribution.
Sophia Lambert
Stadler, T. (2009). On incomplete sampling under birth–death models and connections to the sampling-based coalescent. Journal of theoretical biology, 261(1), 58-66.
fitMCMC_bdRho
and likelihood_bdK
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.