Learn R Programming

ifit (version 1.0.0)

trait-model: Jabot's trait model

Description

Function traitSim (written in C++) simulates a realization from the trait model suggested by Jabot (2010); function traiStat computes a possible summary statistics.

Usage

traitSim(theta, nspecies = 1000L, population = 500L, ngen = 5000L)

traitStat(n, q = c(0.01, seq(0.05, 0.95, by = 0.05), 0.99))

Value

traitSim returns a integer vector of length nspecies containing the trait distribution of population individuals after ngen generations

traitStat returns a numeric vector containing the species richness (i.e., the number of distinct traits in the population), the Gini index, and the quantiles of the trait characteristic corresponding to the input arguments q

Arguments

theta

a vector of length 4 containing the model parameters,

nspecies

the number of different levels of the trait characteristic (default 1000)

population

number of individuals living in the community (default 500)

ngen

number of generations (death/birth cycles) after which the actual population is returned (default 5000)

n

the observed data

q

the quantiles used to summarize the trait distribution

Details

The model describes the distribution of a numeric trait in a population of size population. The trait can only assume the values \((i-1)/(nspecies-1)\) for \(i=1,...,nspecies\). The local competitive ability of a species with trait u is proportional to $$F(u)=1-\omega+\omega\phi(u; \mu, \sigma)$$ where \(\omega\), \(\mu\) and \(\sigma\) are parameters, and \(\phi(u;\mu, \sigma)\) denotes the probability density function of a normal random variable with mean \(\mu\) and variance \(\sigma^2\).

The traits of the initial population are randomly drawn with probability proportional to \(F(u)\). Then, for ngen steps, one individual randomly chosen dies. It is replaced either by an immigrant (with probability \(\gamma\)) or by a descendant of another randomly choosen existing individual (with probability \(1-\gamma\)). In the first case (immigration), the trait of the new individual is drawn with probability proportional to \(F(u)\). In the second case (reproduction), the the probability that the trait of the new individual is u is proportional to the abundance of u in the population times \(F(u)\).

The vector of model parameters is \(\theta=(\gamma, \mu, \sigma, \omega)'\). Note that the parametrization used in this package differs from the one originally suggested by Jabot (2010). Specifically, Jabot assumes that \(\gamma=J/(J+population-1)\) and \(F(u)=1+2A\pi\sigma\phi(u;\mu, \sigma)\) where \(J\) and \(A\) are alternative parameters used in place of \(\gamma\) and \(\omega\), respectively.

References

Franck Jabot (2010) 'A Stochastic Dispersal-Limited Trait-Based Model of Community Dynamics', Journal of Theoretical Biology, 262, pp. 650–61, tools:::Rd_expr_doi("10.1016/j.jtbi.2009.11.004").

Examples

Run this code
set.seed(1)
theta <- c(0.2, 0.7, 0.2, 0.7)
y <- traitSim(theta)
plot(seq(0, 1, length = length(y)), y, type = "h", xlab = "trait", ylab = "frequency")
print(tobs <- traitStat(y))
# \donttest{
# It takes some time to run
tsim <- function(theta) traitStat(traitSim(theta))
m <- ifit(tobs, tsim, l = rep(0, 4), u = rep(1, 4), trace = 1000)
m
confint(m)
diagIFIT(m)
numsimIFIT(m)
# }

Run the code above in your browser using DataLab