Usage
dd_ML(brts, initparsopt = if (ddmodel < 5) { c(0.1 + bd(as.numeric(brts))$r1/(1 - bd(as.numeric(brts))$a),
0.1, 2 * (length(brts) + missnumspec))} else { c(0.1 + bd(as.numeric(brts))$r1/(1 - bd(as.numeric(brts))$a),
0.1, 2 * (length(brts) + missnumspec), 0.01)}, idparsopt = 1:length(initparsopt), idparsfix = (1:(3 + (ddmodel ==
5)))[-idparsopt], parsfix = (ddmodel < 5) * c(0.2,0.1, 2 * (length(brts) + missnumspec))[-idparsopt] + (ddmodel == 5) *
c(0.2, 0.1, 2 * (length(brts) + missnumspec), 0)[-idparsopt], res = 10 * (1 + length(brts) + missnumspec), ddmodel = 1,
missnumspec = 0, cond = TRUE, btorph = 1)
Arguments
brts
A set of branching times of a phylogeny, all positive
initparsopt
The initial values of the parameters that must be optimized
idparsopt
The ids of the parameters that must be optimized, e.g. 1:3 for all parameters.
The ids are defined as follows:
id == 1 corresponds to lambda (speciation rate)
id == 2 corresponds to mu (extinction rate)
id == 3 corresponds to K (clade-level carryin
idparsfix
The ids of the parameters that should not be optimized, e.g. c(1,3) if lambda and K
should not be optimized, but only mu. In that case idparsopt must be 2. The default is to fix all parameters
not specified in idparsopt.
parsfix
The values of the parameters that should not be optimized
res
Sets the maximum number of species for which a probability must be computed, must be larger than 1 + length(brts)
ddmodel
Sets the model of diversity-dependence:
ddmodel == 1 : linear dependence in speciation rate
ddmodel == 2 : exponential dependence in speciation rate
ddmodel == 3 : linear dependence in extinction rate
ddmodel == 4 : exponential dependence in extinctio
missnumspec
The number of species that are in the clade but missing in the phylogeny
cond
Conditioning on non-extinction of the phylogeny (TRUE or FALSE)
btorph
Sets whether the likelihood is for the branching times (0) or the phylogeny (1)