DAMOCLES_loglik {DAMOCLES} | R Documentation |
Likelihood for DAMOCLES model
Description
Computes likelihood for the presence-absence data of species in a local community for a given phylogeny of species in the region.
Usage
DAMOCLES_loglik(
phy,
pa,
pars,
pchoice = 0,
edgeTList = NULL,
methode = "analytical",
model = 0,
Mlist = NULL,
verbose = FALSE
)
Arguments
phy |
phylogeny in phylo format |
pa |
presence-absence table with the first column the species labels and the second column the presence (1) or absence (0) of the species |
pars |
Vector of model parameters: |
pchoice |
sets the p-value to optimize: |
edgeTList |
list of edge lengths that need to be succesively pruned; if not specified, it will computed using compute_edgeTList |
methode |
method used to solve the ODE. Either 'analytical' for the analytical solution, 'Matrix' for matrix exponentiation using package Matrix or 'expm' using package 'expm' or any of the numerical solvers, used in deSolve. |
model |
model used. Default is 0 (standard null model). Other options are 1 (binary traits) 2 (trinary environmental trait) or 3 (diversity-dependent colonization - beta version) |
Mlist |
list of M matrices that can be specified when methode = 'analytical'. If set at NULL (default) and methode = 'analytical', Mlist will be computed. |
verbose |
Whether intermediate output should be printed. Default is FALSE. |
Value
The loglikelihood
Author(s)
Rampal S. Etienne
References
Pigot, A.L. & R.S. Etienne (2015). A new dynamic null model for phylogenetic community structure. Ecology Letters 18: 153-163.
See Also
Examples
#TEST IT WORKS
library(ape)
phy = ape::rcoal(100)
pars = c(0.5,0.1,0.1)
pa = rbinom(100,c(0,1),0.5)
pa = matrix(c(phy$tip.label,pa),nrow = length(phy$tip.label),ncol = 2)
# - without a root edge
loglik = DAMOCLES_loglik(phy,pa,pars)
loglik
# - with a root edge
phy$root.edge = 2
loglik = DAMOCLES_loglik(phy,pa,pars)
loglik