DAISIE_SR_ML {DAISIE} | R Documentation |
Maximization of the loglikelihood under the DAISIE model with clade-specific diversity-dependence
Description
This function computes the maximum likelihood estimates of the parameters of the DAISIE model with clade-specific diversity-dependence and a shift in parameters for data from lineages colonizing an island. It also outputs the corresponding loglikelihood that can be used in model comparisons.
The result of sort(c(idparsopt, idparsfix, idparsnoshift)) should be
identical to c(1:10). If not, an error is reported that the input is
incoherent. The same happens when the length of initparsopt is different
from the length of idparsopt, and the length of parsfix is different from
the length of idparsfix.
Including the 11th parameter (p_f) in either
idparsopt or idparsfix (and therefore initparsopt or parsfix) is optional.
If this parameter is not specified, then the information in the data is
used, otherwise the information in the data is overruled.
Usage
DAISIE_SR_ML_CS(
datalist,
initparsopt,
idparsopt,
parsfix,
idparsfix,
idparsnoshift = 6:10,
res = 100,
ddmodel = 0,
cond = 0,
island_ontogeny = NA,
tol = c(1e-04, 1e-05, 1e-07),
maxiter = 1000 * round((1.25)^length(idparsopt)),
methode = "lsodes",
optimmethod = "subplex",
CS_version = 1,
verbose = 0,
tolint = c(1e-16, 1e-10),
jitter = 0,
num_cycles = 1
)
Arguments
datalist |
Data object containing information on colonisation and
branching times. This object can be generated using the DAISIE_dataprep
function, which converts a user-specified data table into a data object, but
the object can of course also be entered directly. It is an R list object
with the following elements. |
initparsopt |
The initial values of the parameters that must be optimized |
idparsopt |
The ids of the parameters that must be optimized. The ids
are defined as follows: |
parsfix |
The values of the parameters that should not be optimized |
idparsfix |
The ids of the parameters that should not be optimized, e.g. c(1,3) if lambda^c and K should not be optimized. |
idparsnoshift |
The ids of the parameters that should not be different before and after the shift. |
res |
Sets the maximum number of species for which a probability must be computed, must be larger than the size of the largest clade |
ddmodel |
Sets the model of diversity-dependence: |
cond |
cond = 0 : conditioning on island age |
island_ontogeny |
type of island ontonogeny. If NA, then constant ontogeny is assumed. |
tol |
Sets the tolerances in the optimization. Consists of: |
maxiter |
Sets the maximum number of iterations in the optimization. |
methode |
Method of the ODE-solver. See package deSolve for details. Default is "lsodes" |
optimmethod |
Method used in likelihood optimization. Default is "subplex" (see subplex package). Alternative is 'simplex' which was the method in previous versions. |
CS_version |
a numeric or list. Default is 1 for the standard DAISIE model, for a relaxed-rate model a list with the following elements:
|
verbose |
sets whether parameters and likelihood should be printed (1) or not (0). |
tolint |
Vector of two elements containing the absolute and relative tolerance of the integration. |
jitter |
Numeric for |
num_cycles |
The number of cycles the optimizer will go through. Default is 1. |
Value
The output is a dataframe containing estimated parameters and maximum loglikelihood.
lambda_c |
gives the maximum likelihood estimate of lambda^c, the rate of cladogenesis |
mu |
gives the maximum likelihood estimate of mu, the extinction rate |
K |
gives the maximum likelihood estimate of K, the carrying-capacity |
gamma |
gives the maximum likelihood estimate of gamma, the immigration rate |
lambda_a |
gives the maximum likelihood estimate of lambda^a, the rate of anagenesis |
lambda_c2 |
gives the maximum likelihood estimate of lambda^c2, the rate of cladogenesis for the optional second group of species |
mu2 |
gives the maximum likelihood estimate of mu2, the extinction rate for the optional second group of species |
K2 |
gives the maximum likelihood estimate of K2, the carrying-capacity for the optional second group of species |
gamma2 |
gives the maximum likelihood estimate of gamma2, the immigration rate for the optional second group of species |
lambda_a2 |
gives the maximum likelihood estimate of lambda^a2, the rate of anagenesis for the optional second group of species |
loglik |
gives the maximum loglikelihood |
df |
gives the number of estimated parameters, i.e. degrees of feedom |
conv |
gives a message on convergence of optimization; conv = 0 means convergence |
Author(s)
Rampal S. Etienne
References
Valente, L.M., A.B. Phillimore and R.S. Etienne (2015). Equilibrium and non-equilibrium dynamics simultaneously operate in the Galapagos islands. Ecology Letters 18: 844-852. <DOI:10.1111/ele.12461>.
See Also
DAISIE_loglik_all()
,
DAISIE_sim_cr
Examples
## In all following DAISIE_ML calls very high tolerances and low system size
## are used for fast computation for this example. Use default or better
## tol, tolint an res values in actual analyses.
##################
### When all species have the same rates, and we want to optimize all 5
### parameters, we use:
utils::data(Galapagos_datalist)
DAISIE_ML(
datalist = Galapagos_datalist,
initparsopt = c(2.5,2.7,20,0.009,1.01),
ddmodel = 11,
idparsopt = 1:5,
parsfix = NULL,
idparsfix = NULL,
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)
### When all species have the same rates, and we want to optimize all parameters
# except K (which we set equal to Inf), we use:
utils::data(Galapagos_datalist)
DAISIE_ML(
datalist = Galapagos_datalist,
initparsopt = c(2.5,2.7,0.009,1.01),
idparsopt = c(1,2,4,5),
parsfix = Inf,
idparsfix = 3,
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)
### When all species have the same rates except that the finches have a different
# rate of cladogenesis, and we want to optimize all parameters except K (which we
# set equal to Inf), fixing the proportion of finch-type species at 0.163, we use:
utils::data(Galapagos_datalist_2types)
DAISIE_ML(
datalist = Galapagos_datalist_2types,
initparsopt = c(0.38,0.55,0.004,1.1,2.28),
idparsopt = c(1,2,4,5,6),
parsfix = c(Inf,Inf,0.163),
idparsfix = c(3,8,11),
idparsnoshift = c(7,9,10),
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)
### When all species have the same rates except that the finches have a different
# rate of cladogenesis, extinction and a different K, and we want to optimize all
# parameters, fixing the proportion of finch-type species at 0.163, we use:
utils::data(Galapagos_datalist_2types)
DAISIE_ML(
datalist = Galapagos_datalist_2types,
ddmodel = 11,
initparsopt = c(0.19,0.09,0.002,0.87,20,8.9,15),
idparsopt = c(1,2,4,5,6,7,8),
parsfix = c(Inf,0.163),
idparsfix = c(3,11),
idparsnoshift = c(9,10),
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)
### When all species have the same rates except that the finches have a different
# rate of extinction, and we want to optimize all parameters except K (which we
# set equal to Inf), and we also# want to estimate the fraction of finch species
# in the mainland pool. we use:
utils::data(Galapagos_datalist_2types)
DAISIE_ML(
datalist = Galapagos_datalist_2types,
initparsopt = c(2.48,2.7,0.009,1.01,2.25,0.163),
idparsopt = c(1,2,4,5,7,11),
parsfix = c(Inf,Inf),
idparsfix = c(3,8),
idparsnoshift = c(6,9,10),
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)
### When we have two islands with the same rates except for immigration and anagenesis rate,
# and we want to optimize all parameters, we use:
utils::data(Galapagos_datalist)
DAISIE_ML(
datalist = list(Galapagos_datalist,Galapagos_datalist),
datatype = 'multiple',
initparsopt = c(2.5,2.7,20,0.009,1.01,0.009,1.01),
idparsmat = rbind(1:5,c(1:3,6,7)),
idparsopt = 1:7,
parsfix = NULL,
idparsfix = NULL,
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)
### When we consider the four Macaronesia archipelagoes and set all parameters the same
# except for rates of cladogenesis, extinction and immigration for Canary Islands,
# rate of cladogenesis is fixed to 0 for the other archipelagoes,
# diversity-dependence is assumed to be absent
# and we want to optimize all parameters, we use:
utils::data(Macaronesia_datalist)
DAISIE_ML(
datalist = Macaronesia_datalist,
datatype = 'multiple',
initparsopt = c(1.053151832,0.052148979,0.512939011,0.133766934,0.152763179),
idparsmat = rbind(1:5,c(6,2,3,7,5),1:5,1:5),
idparsopt = c(2,4,5,6,7),
parsfix = c(0,Inf),
idparsfix = c(1,3),
tol = c(0.1, 0.02, 0.01),
tolint = c(1e-4, 1e-2),
res = 50
)