Learn R Programming

DDD (version 1.4)

dd_KI_ML: Maximization of the loglikelihood under a diversity-dependent diversification model with decoupling of a subclade's diversication dynamics from the main clade's dynamics

Description

This function computes the maximum likelihood estimates of the parameters of a diversity-dependent diversification model with decoupling of the diversification dynamics of a subclade from the dynamics of the main clade for a given set of phylogenetic branching times of main clade and subclade and the time of splitting of the lineage that will form the subclade. It also outputs the corresponding loglikelihood that can be used in model comparisons.

Usage

dd_KI_ML(brtsM, brtsS, tsplit, initparsopt = c(0.5, 0.1, 2 * (1 + length(brtsM)), 2 * (1 + length(brtsS)),
    (tsplit + max(brtsS))/2), parsfix = NULL, idparsopt = c(1:3, 6:7), idparsfix = NULL,
    idparsnoshift = (1:7)[c(-idparsopt, (-1)^(length(idparsfix) != 0) * idparsfix)],
    res = 10 * (1 + length(c(brtsM, brtsS)) + missnumspec), ddmodel = 1, missnumspec = 0, cond = TRUE)

Arguments

brtsM
A set of branching times of the main clade in a phylogeny, all positive
brtsS
A set of branching times of the subclade in a phylogeny, all positive
tsplit
The branching time at which the lineage forming the subclade branches off, positive
initparsopt
The initial values of the parameters that must be optimized
parsfix
The values of the parameters that should not be optimized
idparsopt
The ids of the parameters that must be optimized, e.g. 1:7 for all parameters. The ids are defined as follows: id == 1 corresponds to lambda_M (speciation rate) of the main clade id == 2 corresponds to mu_M (extinction rate) of the main clade id ==
idparsfix
The ids of the parameters that should not be optimized, e.g. c(1,3,4,6) if lambda and K should not be optimized, but only mu. In that case idparsopt must be c(2,5,7). The default is to fix all parameters not specified in idparsopt.
idparsnoshift
The ids of the parameters that should not shift; This can only apply to ids 4, 5 and 6, e.g. idparsnoshift = c(4,5) means that lambda and mu have the same values before and after tshift
res
sets the maximum number of species for which a probability must be computed, must be larger than 1 + max(length(brtsM),length(brtsS))
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)

Value

  • parsgives the list of parameter estimates
  • fvaluesgives the maximum loglikelihood

Details

The output is a dataframe where $par and $fvalues are the first elements. There are more elements that are all from the optimization algorithm, optimx. The computed loglikelihood contains the factor q! m!/(q + m)! where q is the number of species in the phylogeny and m is the number of missing species, as explained in the supplementary material to Etienne et al. 2012.

References

- Etienne et al. 2012, Proc. Roy. Soc. B 279: 1300-1309, doi: 10.1098/rspb.2011.1439 - Etienne & Haegeman 2012. Am. Nat. In press.

See Also

dd_KI_loglik, dd_ML, dd_SR_ML, optimx

Examples

Run this code
cat("Estimating parameters for two sets of branching times brtsM, brtsS with the default settings:")
brtsM = 1:20
brtsS = seq(0.1,3.9,0.5)
t_split = 5;
dd_KI_ML(brtsM,brtsS,tsplit)

Run the code above in your browser using DataLab