Usage
dd_ML( brts, initparsopt = if(ddmodel < 5) {c(0.2,0.1,2*(length(brts) + missnumspec))}
else {c(0.2,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 = 1, btorph = 1, soc = 2, tol = c(1E-3,1E-4,1E-6), maxiter = 1000 * round((1.25)^length(idparsopt)), changeloglikifnoconv = FALSE, optimmethod = 'subplex', methode = 'analytical' )
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 intrinsic speciation rate, extinction rate and carrying capacity.
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 carrying capacity)
id == 4 corresponds to r (r = b/a where mu = mu_0 + b * N and lambda = lambda_0 - a * N)
(This is only available when ddmodel = 5)
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 with parameter K (= diversity where speciation = extinction)
ddmodel == 1.3
: linear dependence in speciation rate with parameter K' (= diversity where speciation = 0)
ddmodel == 2
: exponential dependence in speciation rate with parameter K (= diversity where speciation = extinction)
ddmodel == 2.1
: variant of exponential dependence in speciation rate with offset at infinity
ddmodel == 2.2
: 1/n dependence in speciation rate
ddmodel == 2.3
: exponential dependence in speciation rate with parameter x (= exponent)
ddmodel == 3
: linear dependence in extinction rate
ddmodel == 4
: exponential dependence in extinction rate
ddmodel == 4.1
: variant of exponential dependence in extinction rate with offset at infinity
ddmodel == 4.2
: 1/n dependence in extinction rate with offset at infinity
ddmodel == 5
: linear dependence in speciation and extinction rate
missnumspec
The number of species that are in the clade but missing in the phylogeny
cond
Conditioning:
cond == 0 : conditioning on stem or crown age
cond == 1 : conditioning on stem or crown age and non-extinction of the phylogeny
cond == 2 : conditioning on stem or crown age and on the total number of extant taxa (including missing species)
cond == 3 : conditioning on the total number of extant taxa (including missing species)
Note: cond == 3 assumes a uniform prior on stem age, as is the standard in constant-rate birth-death models, see
e.g. D. Aldous & L. Popovic 2004. Adv. Appl. Prob. 37: 1094-1115 and T. Stadler 2009. J. Theor. Biol. 261: 58-66.
This conditioning turns out, for the diversity-dependent model,
to provide the least-biased parameter estimates when extinction is low, but may still contain considerable bias if extinction is high.
The default value has therefore been changed from 1 to 3 starting with DDD version 2.2.
btorph
Sets whether the likelihood is for the branching times (0) or the phylogeny (1)
soc
Sets whether stem or crown age should be used (1 or 2)
tol
Sets the tolerances in the optimization. Consists of:
reltolx = relative tolerance of parameter values in optimization
reltolf = relative tolerance of function value in optimization
abstolx = absolute tolerance of parameter values in optimization
maxiter
Sets the maximum number of iterations in the optimization
changeloglikifnoconv
if TRUE the loglik will be set to -Inf if ML does not converge
optimmethod
Method used in optimization of the likelihood. Current default is 'subplex'. Alternative is 'simplex' (default of previous versions)
methode
The method used to solve the master equation, default is 'analytical' which uses matrix exponentiation; alternatively numerical ODE solvers can be used, such as 'lsoda' or 'ode45'. These were used in the package before version 3.1.