simJamil: Simulate species abundance data following Jamil & ter Braak...

Description Usage Arguments Value Author(s) References Examples

Description

Simulate species probability of occurrence data according to the method used by Tahira Jamil and Cajo ter Braak in their recent paper Generalized linear mixed models can detect unimodal species-environment relationships.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
simJamil(
  n,
  m,
  x,
  gl = 4,
  randx = TRUE,
  tol = 0.5,
  tau = gl/2,
  randm = TRUE,
  expectation = FALSE
)

Arguments

n

numeric; the number of samples/sites.

m

numeric, the number of species/variables.

x

numeric; values for the environmental gradient. Can be missing, in which case suitable values are generated. See Details.

gl

numeric; gradient length in arbitrary units. The default is 4 units with gradient values ranging from -2 to 2.

randx

logical; should locations along the gradient (x) be located randomly or equally-spaced?

tol

numeric; the species tolerances. Can be a vector of length m, hence allowing for varying tolerances along the gradient x.

tau

numeric; constant that ensures some of the optima are located beyond the observed gradient end points.

randm

logical; should species optima along the gradient be located randomly or equally-spaced?

expectation

logical; if TRUE the binomial probabilities p[ij] from the response curve are returned directly. If FALSE, the default, random draws from a Bernoulli distribution with probability p[ij] are made.

Value

a matrix of n rows and m columns containing the simulated species abundance data.

Author(s)

Gavin L. Simpson

References

Jamil and ter Braak (2013) Generalized linear mixed models can detect unimodal species-environment relationships. PeerJ 1:e95; DOI 10.7717/peerj.95.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(42)
N <- 100   # Number of locations on gradient (samples)
glen <- 4  # Gradient length
grad <- sort(runif(N, -glen/2, glen/2)) # sample locations
M <- 10    # Number of species
sim <- simJamil(n = N, m = M, x = grad, gl = glen, randx = FALSE,
                randm = FALSE, expectation = TRUE)
## visualise the response curves
matplot(grad, sim, type = "l", lty = "solid")

## simulate binomial responses from those response curves
sim <- simJamil(n = N, m = M, x = grad, gl = glen, randx = FALSE,
                randm = FALSE)

gavinsimpson/coenocliner documentation built on Feb. 9, 2021, 4:11 p.m.