Skip to contents

Computes likelihood and metrics for randomly sampled presence-absence data of species in a local community for a given phylogeny of species in the region.

Usage

HERACLES_ImportanceSampling(
  nSamples,
  n,
  regionalSpecies,
  S_regional,
  p = n/S_regional,
  pa,
  phy,
  phydist,
  parsDAM,
  Mlist = NULL,
  model,
  pchoice,
  samptype,
  edgeObj = NULL,
  methode = "analytical",
  traitdist = NULL
)

Arguments

nSamples

The number of samples used in importance sampling

n

The number of species in the local community

regionalSpecies

The list of species present in the regional community (SP)

S_regional

The number of species in the regional species pool

p

The probability used for the binomial distribution

pa

presence-absence table with the first column the species labels and the second column the presence (1) or absence (0) of the species

phy

phylogeny in phylo format

phydist

TBD

parsDAM

Vector of model parameters:
pars[1] corresponds to mu (extinction rate in local community)
pars[2] corresponds to gamma_0 in formula gamma(t) = gamma_0/(1 + gamma_1 * t) where gamma(t) is immigration rate into local community)
pars[3] corresponds to gamma_1 in formula gamma(t) = gamma_0/(1 + gamma_1 * t) where gamma(t) is immigration rate into local community)

Mlist

list of M matrices that can be specified when methode = 'analytical'. If set at NULL (default) and methode = 'analytical', Mlist will be computed.

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)

pchoice

sets the p-value to optimize:
pchoice == 0 corresponds to the sum of p_0f + p_1f
pchoice == 1 corresponds to p_0f
pchoice == 2 corresponds to p_1f

samptype

Type of sampling distribution, can be either 'uniform' or 'binomial' in which case the local samples are uniformly or binomially generated, with the local diversity being a stochastic variable, or 'fixed' in which case the observed local diversity is used and configurations consistent with this diversity are sampled

edgeObj

list of edge lengths that need to be successively 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.

traitdist

TBD

Value

A list containing attributes of the loglikelihood and importance sampling, and of the metrics (mntd and mpd, and TBD)

References

Pigot, A.L. & R.S. Etienne (2015). A new dynamic null model for phylogenetic community structure. Ecology Letters 18: 153-163.

Author

Rampal S. Etienne & Alex L. Pigot

Examples

cat('No examples yet') #TBD
#> No examples yet